activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r427057 [3/22] - in /incubator/activemq/trunk/amazon: ./ amq_brokersession/ amq_corelib/ amq_examples/ amq_examples/bs_async_recv/ amq_examples/bs_send/ amq_examples/bs_sync_recv/ amq_examples/cl_send/ amq_transport/ command/ marshal/
Date Mon, 31 Jul 2006 09:36:51 GMT
Added: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp Mon Jul 31 02:36:40 2006
@@ -0,0 +1,117 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#include "BrokerSession.h"
+#include "BrokerSessionImpl_.h"
+
+#include "amq_corelib/BlockingMessageConsumerRef.h"
+#include "amq_corelib/NonBlockingMessageConsumerRef.h"
+#include "amq_corelib/Logger.h"
+#include "amq_corelib/RCSID.h"
+
+using namespace ActiveMQ;
+using namespace std;
+
+RCSID(BrokerSession, "$Id$");
+
+BrokerSession::BrokerSession(const string& uri,
+                             const string& user,
+                             const string& password)
+    : impl_(new BrokerSessionImpl(uri, user, password))
+  {}
+
+void
+BrokerSession::connect() {
+    impl_->connect();
+}
+
+bool
+BrokerSession::isConnected() const {
+    return impl_->isConnected();
+}
+
+void
+BrokerSession::disconnect() {
+    impl_->disconnect();
+}
+
+void
+BrokerSession::publish(const Message& msg) {
+    impl_->publish(msg);
+}
+
+void
+BrokerSession::publish(const Destination& d, const Message& msg) {
+    impl_->publish(d, msg);
+}
+
+void
+BrokerSession::subscribe(const Destination& dest, MessageConsumerRef& q) {
+    impl_->subscribe(dest, q);
+}
+
+void
+BrokerSession::unsubscribe(const Destination& dest) {
+    impl_->unsubscribe(dest);
+}
+
+NonBlockingMessageConsumerRef
+BrokerSession::newNonBlockingMessageConsumer() {
+    return impl_->newNonBlockingMessageConsumer();
+}
+
+BlockingMessageConsumerRef
+BrokerSession::newBlockingMessageConsumer() {
+    return impl_->newBlockingMessageConsumer();
+}
+
+ExceptionCallback
+BrokerSession::setExceptionCallback(ExceptionCallback c) {
+    return impl_->setExceptionCallback(c);
+}
+
+void
+BrokerSession::setLogger(auto_ptr<Logger> lgr) {
+    impl_->setLogger(lgr);
+}
+
+void
+BrokerSession::setLogger(Logger *lgr) {
+    setLogger(auto_ptr<Logger>(lgr));
+}
+
+Destination
+BrokerSession::createTopic(const std::string& name) {
+    return impl_->createTopic(name);
+}
+
+Destination
+BrokerSession::createQueue(const std::string& name) {
+    return impl_->createQueue(name);
+}
+
+Destination
+BrokerSession::createTemporaryTopic() {
+    return impl_->createTemporaryTopic();
+}
+
+Destination
+BrokerSession::createTemporaryQueue() {
+    return impl_->createTemporaryQueue();
+}

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.cpp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,255 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BROKERSESSION_H
+#define ACTIVEMQ_BROKERSESSION_H
+
+#include <string>
+#include <memory>
+
+#include "BrokerSessionImpl_.h"
+
+#include "amq_corelib/ExceptionCallback.h"
+#include "amq_corelib/Logger.h"
+
+/// Holds all of the ActiveMQ-related classes
+/**
+   This namespace contains all classes needed to do asynchronous
+   messaging with ActiveMQ.
+*/
+namespace ActiveMQ {
+    class NonBlockingMessageConsumerRef;
+    class BlockingMessageConsumerRef;
+    class MessageConsumerRef;
+    class Transport;
+    class Destination;
+    class Message;
+
+    /// High-level ActiveMQ messaging library with background thread
+    /**
+       This class is the primary class for use with ActiveMQ if your application:
+         - doesn't have out-of-the-ordinary needs for message transport
+         - can tolerate a background thread
+       
+       This library creates a background thread which listens to
+       messages from ActiveMQ.  This thread takes care of shuffling
+       data between the core library(see ActiveMQ::CoreLib) and the
+       transport represented by the URI provided.
+
+       The BrokerSession library is able to be shared between multiple
+       threads (see ActiveMQ::BlockingMessageConsumer for a
+       multi-thread-friendly way to have messages delivered).
+
+       @version $Id$
+    */
+    class BrokerSession {
+    public:
+        /// Creates a new handle on an ActiveMQ broker.
+        /**
+           Creates a new (unconnected) handle and state associated
+           with a logical ActiveMQ broker.
+
+           @param uri uri of the broker
+           @param user username to use for authentication
+           @param password password to use for authentication
+        */
+        BrokerSession(const std::string& uri,
+                      const std::string& user = "",
+                      const std::string& password = "");
+
+        /// Connects to the broker
+        /**
+           Connects to the broker and enables the other commands.
+
+           Connection semantics / reconnects / timeouts etc work
+           within URI configuration options.  See the ActiveMQ
+           documentation regarding transport URIs at:
+
+           http://www.activemq.org/Configuring+Transports
+        */
+        void connect();
+
+        /// Checks connection
+        /**
+           Indicates whether this BrokerSession is connected.
+
+           @returns true if connected
+        */
+        bool isConnected() const;
+
+        /// Disconnects from the broker
+        /**
+           Disconnects from the broker and disables the other commands.
+        */
+        void disconnect();
+
+        /// Publishes a message
+        /**
+           Publishes a message.  It extracts the Destination from the
+           message and calls publish(msg,dest).
+
+           When this method returns, the message has been guaranteed
+           to have been sent to the broker.
+
+           @param msg message to send
+        */
+        void publish(const Message& msg);
+
+        /// Publishes a message
+        /**
+           Publishes a message on a given Destination.
+
+           When this method returns, the message has been guaranteed
+           to have been sent to the broker.
+
+           @param dest destination of the message
+           @param msg message to send
+        */
+        void publish(const Destination& dest, const Message& msg);
+
+        /// Subscribes
+        /**
+           Subscribes this session to a particular Destination.  When
+           a message is received on this Destination, it will be
+           delivered to the given consumer.
+
+           When this method returns, all new messages on the given
+           Destination will be passed to the given MessageConsumer.
+           Any existing MessageConsumers receiving on this Destination
+           will cease to.
+
+           @param dest destination to receive messages on
+           @param q MessageConsumer to deliver messages to
+        */
+        void subscribe(const Destination& dest, MessageConsumerRef& q);
+
+        /// Unsubscribes
+        /**
+           Stops the receipt of messages from the broker on the given
+           Destination.  After this call no more messages will be
+           received from the MessageConsumer subscribed to this
+           Destination.
+
+           Throws ActiveMQ::Exception if this destination is not already subscribed.
+           
+           @param dest the Destination to stop listening to
+        */
+        void unsubscribe(const Destination& dest);
+        
+        /// Creates a new NonBlockingMessageConsumer
+        /**
+           This creates a new MessageConsumer with its own event fd
+           and nonblocking semantics.
+           
+           @returns a weak reference to the new object (which is owned by the library).
+        */
+        NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
+
+        /// Creates a new BlockingMessageConsumer
+        /**
+           This creates a new MessageConsumer with blocking semantics.
+           
+           @returns a weak reference to the new object (which is owned by the library).
+        */
+        BlockingMessageConsumerRef newBlockingMessageConsumer();
+
+        /// Sets the exception handler for internally-generated exceptions
+        /**
+           Since the BrokerSession library has an internal thread for
+           doing I/O and interaction with the core library, it needs a
+           way to communicate these exceptions to the user of the
+           library.  This is done by setting this callback - any
+           function or function object that can be called with a const
+           ActiveMQ::Exception & will be implicitly constructed into
+           an ExceptionCallback object.  The default handler simply
+           prints the exception message to stderr.
+
+           @param c The function/functor to call with an internally-generated exception.
+           @returns The previously-set exception handler
+        */
+        ExceptionCallback setExceptionCallback(ExceptionCallback c);
+
+        /// Gets the exception handler
+        /**
+           Gets the callback that will be called on exceptions.  See
+           documentation for setExceptionCallback above.
+
+           @returns the exception handler
+        */
+        ExceptionCallback& getExceptionCallback() const;
+
+        /// Sets the handler for log events.
+        /**
+           Sets the handler for log events.  This call will deallocate
+           any existing Logger set by a previous call.
+
+           Note this is passed in as an auto_ptr to demonstrate the
+           library's ownership of this memory.  If this doesn't work
+           well with your application, there is a dumb pointer overload.
+        
+           @param lgr the subclass instance of ActiveMQ::Logger to log with
+        */
+        void setLogger(std::auto_ptr<Logger> lgr);
+
+        /// Sets the handler for log events.
+        /**
+           Sets the handler for log events.  Any heap-allocated
+           pointer to an instance of a subclass of ActiveMQ::Logger
+           will be accepted.  This call will deallocate any existing
+           Logger set by a previous call.
+        
+           <b>The library will own this pointer and take care of freeing it.</b>
+
+           @param lgr the subclass instance of ActiveMQ::Logger to log with
+        */
+        void setLogger(Logger *lgr);
+
+        /// Creates a new topic
+        /**
+           @returns a new Destination that represents a topic
+        */
+        Destination createTopic(const std::string& name);
+
+        /// Creates a new queue
+        /**
+           @returns a new Destination that represents a queue
+        */
+        Destination createQueue(const std::string& name);
+
+        /// Creates a new temporary topic
+        /**
+           @returns a new Destination that represents a temporary topic
+        */
+        Destination createTemporaryTopic();
+
+        /// Creates a new temporary queue
+        /**
+           @returns a new Destination that represents a temporary queue
+        */
+        Destination createTemporaryQueue();
+
+    private:
+        BrokerSession(const BrokerSession &);
+        BrokerSession& operator=(const BrokerSession &);
+
+        std::auto_ptr<BrokerSessionImpl> impl_;
+    };
+};
+
+#endif // ACTIVEMQ_BROKERSESSION_H

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSession.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp Mon Jul 31 02:36:40 2006
@@ -0,0 +1,285 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <assert.h>
+#include <pthread.h>
+#include <sys/poll.h>
+
+#include <memory>
+#include <map>
+#include <string>
+#include <utility>
+#include <iostream>
+
+#include "BrokerSessionImpl_.h"
+
+#include "amq_corelib/BlockingMessageConsumer.h"
+#include "amq_corelib/NonBlockingMessageConsumer.h"
+#include "amq_corelib/BlockingMessageConsumerRef.h"
+#include "amq_corelib/NonBlockingMessageConsumerRef.h"
+#include "amq_corelib/Buffer.h"
+#include "amq_corelib/Lock.h"
+#include "amq_corelib/CoreLib.h"
+#include "amq_corelib/RCSID.h"
+
+#include "amq_transport/TCPTransport.h"
+#include "amq_transport/TransportFactory.h"
+
+using namespace ActiveMQ;
+using namespace std;
+
+RCSID(BrokerSessionImpl, "$Id$");
+
+#define READ_BUFFER_SIZE 4096
+
+void *
+BrokerSessionImpl::backgroundThreadTask_(void *arg) {
+    // If we're passed a bad argument there's nothing we can do -
+    // we're in a separate thread and can't get at the brokersession's
+    // exception callback
+    assert(arg != NULL);
+
+    BrokerSessionImpl *bsi(static_cast<BrokerSessionImpl *>(arg));
+    int listenfd = bsi->transport_->getFD();
+    unsigned char readbuf[READ_BUFFER_SIZE];
+
+    // The background thread just waits for data in the transport's
+    // socket, then hands it to the core library.
+
+    while (1) {
+        struct pollfd pfd;
+        pfd.fd = listenfd;
+        pfd.events = POLLIN;
+    
+        int rc = poll(&pfd,1,-1);
+        if (rc == 1) {
+            try {
+                int numread = bsi->transport_->recv(readbuf, READ_BUFFER_SIZE);
+                if (numread == 0)
+                    return NULL;
+                Buffer b;
+                bsi->corelib_.handleData(readbuf, numread, b);
+                if (!b.empty())
+                    bsi->transport_->send(b);
+            } catch (const Exception& e) {
+                (bsi->getExceptionCallback())(e);
+                {
+                    Lock l(&bsi->brokersessionMutex_);
+                    bsi->connected_ = false;
+                }
+                return NULL;
+            }
+        }
+        else if (rc == -1 && errno != EINTR)
+        {
+           (bsi->getExceptionCallback())(Exception(errno >= sys_nerr
+                                                        ? "Unknown error" :
+                                                        sys_errlist[errno]));
+            return NULL;
+        }
+    }
+    return NULL;
+}
+
+
+static
+void
+defaultErrorHandler_(const Exception& msg) {
+    cerr << "Exception: " << msg.what() << endl;
+}
+
+BrokerSessionImpl::BrokerSessionImpl(const string& uri,
+                             const string& user,
+                             const string& password)
+  : corelib_(user, password),
+    transport_(TransportFactory::instance().getFromURI(uri)),
+    connected_(false),
+    exceptionCB_(defaultErrorHandler_)
+{
+    pthread_mutex_init(&brokersessionMutex_,NULL);
+}
+
+void
+BrokerSessionImpl::disconnect() {
+    Lock l(&brokersessionMutex_);
+    if (connected_) {
+        l.unlock();
+        connected_ = false;
+        Buffer b;
+        corelib_.disconnect(b);
+        transport_->send(b);
+        pthread_join(backgroundThread_, NULL);
+    }
+}
+
+BrokerSessionImpl::~BrokerSessionImpl() {
+    try {
+        disconnect();
+        pthread_mutex_destroy(&brokersessionMutex_);
+    }
+    catch (...) {}
+}
+
+void
+BrokerSessionImpl::connect() {
+    Lock l(&brokersessionMutex_);
+    if (!connected_) {
+        Buffer b;
+        transport_->connect();
+        corelib_.initialize(b);
+        transport_->send(b);
+        connected_ = true;
+
+        pthread_create(&backgroundThread_,
+                       NULL,
+                       BrokerSessionImpl::backgroundThreadTask_, this);
+    }
+}
+
+bool
+BrokerSessionImpl::isConnected() const {
+    Lock l(&brokersessionMutex_);
+    return connected_;
+}
+
+void
+BrokerSessionImpl::publish(const Message& m) {
+    publish(m.getDestination(), m);
+}
+
+void
+BrokerSessionImpl::publish(const Destination &dest,
+                       const Message& m) {
+    Lock l(&brokersessionMutex_);
+    if (!connected_)
+        throw Exception("BrokerSession is not connected");
+    Buffer b;
+    corelib_.publish(dest, m, b);
+    transport_->send(b);
+}
+
+void
+BrokerSessionImpl::subscribe(const Destination& dest,
+                         MessageConsumerRef& q) {
+    Lock l(&brokersessionMutex_);
+    if (!connected_)
+        throw Exception("BrokerSession is not connected");
+    Buffer b;
+    corelib_.subscribe(dest, q, b);
+    transport_->send(b);
+}
+
+void
+BrokerSessionImpl::unsubscribe(const Destination& dest) {
+    Lock l(&brokersessionMutex_);
+    if (!connected_)
+        throw Exception("BrokerSession is not connected");
+    Buffer b;
+    corelib_.unsubscribe(dest, b);
+    transport_->send(b);
+}
+
+BlockingMessageConsumerRef
+BrokerSessionImpl::newBlockingMessageConsumer() {
+    Lock l(&brokersessionMutex_);
+    return corelib_.newBlockingMessageConsumer();
+}
+
+NonBlockingMessageConsumerRef
+BrokerSessionImpl::newNonBlockingMessageConsumer() {
+    Lock l(&brokersessionMutex_);
+    return corelib_.newNonBlockingMessageConsumer();
+}
+
+ExceptionCallback
+BrokerSessionImpl::setExceptionCallback(ExceptionCallback c) {
+    Lock l(&brokersessionMutex_);
+    ExceptionCallback old;
+    old = exceptionCB_;
+    exceptionCB_ = c;
+    return old;
+}
+
+ExceptionCallback&
+BrokerSessionImpl::getExceptionCallback() {
+    Lock l(&brokersessionMutex_);
+    return exceptionCB_;
+}
+
+void
+BrokerSessionImpl::setLogger(auto_ptr<Logger> lgr) {
+    Lock l(&brokersessionMutex_);
+    corelib_.setLogger(lgr);
+}
+
+void
+BrokerSessionImpl::fatal_(const string& msg) {
+    Lock l(&brokersessionMutex_);
+    corelib_.getLogger().logFatal(msg);
+}
+
+void
+BrokerSessionImpl::error_(const string& msg) {
+    Lock l(&brokersessionMutex_);
+    corelib_.getLogger().logError(msg);
+}
+
+void
+BrokerSessionImpl::warning_(const string& msg) {
+    Lock l(&brokersessionMutex_);
+    corelib_.getLogger().logWarning(msg);
+}
+
+void
+BrokerSessionImpl::inform_(const string& msg) {
+    Lock l(&brokersessionMutex_);
+    corelib_.getLogger().logInform(msg);
+}
+
+void
+BrokerSessionImpl::debug_(const string& msg) {
+    Lock l(&brokersessionMutex_);
+    corelib_.getLogger().logDebug(msg);
+}
+
+
+Destination
+BrokerSessionImpl::createTopic(const std::string& name) {
+    return corelib_.createTopic(name);
+}
+
+Destination
+BrokerSessionImpl::createQueue(const std::string& name) {
+    return corelib_.createQueue(name);
+}
+
+Destination
+BrokerSessionImpl::createTemporaryTopic() {
+    return corelib_.createTemporaryTopic();
+}
+
+Destination
+BrokerSessionImpl::createTemporaryQueue() {
+    return corelib_.createTemporaryQueue();
+}

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl.cpp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,86 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BROKERSESSION_IMPL_H
+#define ACTIVEMQ_BROKERSESSION_IMPL_H
+
+#include <memory>
+
+#include "amq_corelib/CoreLib.h"
+#include "amq_corelib/ExceptionCallback.h"
+#include "amq_corelib/Logger.h"
+
+namespace ActiveMQ {
+    class BrokerSession;
+    class NonBlockingMessageConsumerRef;
+    class BlockingMessageConsumerRef;
+    class MessageConsumer;
+    class Transport;
+    class Destination;
+    class Message;
+
+    /// Private implementation class for BrokerSession.
+    class BrokerSessionImpl {
+    public:
+        virtual ~BrokerSessionImpl();
+    private:
+        friend class BrokerSession;
+        BrokerSessionImpl(const std::string& uri,
+                          const std::string& user = "",
+                          const std::string& password = "");
+        void connect();
+        bool isConnected() const;
+        void disconnect();
+        void publish(const Message& msg);
+        void publish(const Destination& dest, const Message& msg);
+        void subscribe(const Destination& dest, MessageConsumerRef& q);
+        void unsubscribe(const Destination& dest);
+        NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
+        BlockingMessageConsumerRef newBlockingMessageConsumer();
+        ExceptionCallback setExceptionCallback(ExceptionCallback c);
+        ExceptionCallback& getExceptionCallback();
+        void setLogger(std::auto_ptr<Logger> lgr);
+        Destination createTemporaryTopic();
+        Destination createTemporaryQueue();
+        Destination createTopic(const std::string& name);
+        Destination createQueue(const std::string& name);
+
+        CoreLib corelib_;
+        std::auto_ptr<Transport> transport_;
+        bool connected_;
+
+        pthread_t backgroundThread_;
+        mutable pthread_mutex_t brokersessionMutex_;
+
+        ExceptionCallback exceptionCB_;
+
+        static void *backgroundThreadTask_(void *arg);
+
+        void fatal_(const std::string& msg);
+        void error_(const std::string& msg);
+        void warning_(const std::string& msg);
+        void inform_(const std::string& msg);
+        void debug_(const std::string& msg);
+
+        BrokerSessionImpl(const BrokerSessionImpl &);
+        BrokerSession& operator=(const BrokerSession &);
+    };
+};
+
+#endif // ACTIVEMQ_BROKERSESSION_IMPL_H

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_brokersession/BrokerSessionImpl_.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_brokersession/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/Makefile.am?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/Makefile.am (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/Makefile.am Mon Jul 31 02:36:40 2006
@@ -0,0 +1,5 @@
+INCLUDES = -I../
+lib_LTLIBRARIES = libamq_brokersession.la
+libamq_brokersession_la_SOURCES = BrokerSession.cpp BrokerSessionImpl.cpp
+libamq_brokersession_la_LIBADD = -L../amq_corelib -lamq_corelib -L../amq_transport -lamq_transport -lpthread
+include_HEADERS = BrokerSession.h BrokerSessionImpl_.h

Added: incubator/activemq/trunk/amazon/amq_brokersession/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_brokersession/Makefile.in?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_brokersession/Makefile.in (added)
+++ incubator/activemq/trunk/amazon/amq_brokersession/Makefile.in Mon Jul 31 02:36:40 2006
@@ -0,0 +1,476 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = amq_brokersession
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libamq_brokersession_la_DEPENDENCIES =
+am_libamq_brokersession_la_OBJECTS = BrokerSession.lo \
+	BrokerSessionImpl.lo
+libamq_brokersession_la_OBJECTS =  \
+	$(am_libamq_brokersession_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libamq_brokersession_la_SOURCES)
+DIST_SOURCES = $(libamq_brokersession_la_SOURCES)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I../
+lib_LTLIBRARIES = libamq_brokersession.la
+libamq_brokersession_la_SOURCES = BrokerSession.cpp BrokerSessionImpl.cpp
+libamq_brokersession_la_LIBADD = -L../amq_corelib -lamq_corelib -L../amq_transport -lamq_transport -lpthread
+include_HEADERS = BrokerSession.h BrokerSessionImpl_.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  amq_brokersession/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  amq_brokersession/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libamq_brokersession.la: $(libamq_brokersession_la_OBJECTS) $(libamq_brokersession_la_DEPENDENCIES) 
+	$(CXXLINK) -rpath $(libdir) $(libamq_brokersession_la_LDFLAGS) $(libamq_brokersession_la_OBJECTS) $(libamq_brokersession_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BrokerSession.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BrokerSessionImpl.Plo@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+	uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-includeHEADERS install-info \
+	install-info-am install-libLTLIBRARIES install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-includeHEADERS uninstall-info-am \
+	uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp Mon Jul 31 02:36:40 2006
@@ -0,0 +1,79 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#include "RCSID.h"
+#include "BlockingMessageConsumer.h"
+#include "Message.h"
+#include "Lock.h"
+
+#include <algorithm>
+
+#include <stdio.h>
+#include <errno.h>
+#include <assert.h>
+
+using namespace ActiveMQ;
+using std::auto_ptr;
+
+RCSID(BlockingMessageConsumer, "$Id$");
+
+BlockingMessageConsumer::BlockingMessageConsumer() {
+    pthread_mutex_init(&messages_lock_, NULL);
+}
+
+void
+BlockingMessageConsumer::enqueue(Message *msg) {
+    {
+        Lock l(&messages_lock_);
+        messages_.push_back(msg);
+    }
+    ready_.post();
+}
+
+unsigned int
+BlockingMessageConsumer::getNumReadyMessages() const {
+    Lock l(&messages_lock_);
+    return messages_.size();
+}
+
+auto_ptr<Message>
+BlockingMessageConsumer::receive() {
+    ready_.wait();
+    Message *ret;
+    {
+        Lock l(&messages_lock_);
+        assert(!messages_.empty());
+        ret = messages_.front();
+        messages_.pop_front();
+    }
+    return auto_ptr<Message>(ret);
+}
+
+BlockingMessageConsumer::~BlockingMessageConsumer() {
+    pthread_mutex_destroy(&messages_lock_);
+}
+
+void
+BlockingMessageConsumer::removeQueued(const Destination &d) {
+    Lock l(&messages_lock_);
+    messages_.erase(std::remove_if(messages_.begin(),
+                                   messages_.end(),
+                                   HasDest(d)),
+                    messages_.end());
+}

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.cpp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,75 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BLOCKINGMSGCONSUMER_H
+#define ACTIVEMQ_BLOCKINGMSGCONSUMER_H
+
+#include <pthread.h>
+#include <memory>
+#include <deque>
+
+#include "MessageConsumer.h"
+#include "Sem.h"
+
+extern const char* const BlockingMessageConsumer_RCSID;
+
+namespace ActiveMQ {
+    class CoreLib;
+
+    /// Message vendor with blocking semantics. (private)
+    /**
+       This class holds messages that have been received by a
+       BrokerSession object but not delivered to the application.  It
+       contains an internal queue and a semaphore.
+
+       When a Message is enqueued, it is stored internally and one of
+       the threads waiting on the blocking receive() call is woken
+       with the new message.
+
+       <b>The user of the API never actually owns one of these.</b>
+       The library vends instances of BlockingMessageConsumerRef.
+       The BlockingMessageConsumer object is destroyed when all of
+       its references have been destroyed.
+
+       See BlockingMessageConsumerRef for usage details.
+
+       @version $Id$
+    */
+    class BlockingMessageConsumer : public MessageConsumer {
+    private:
+        std::deque<Message *> messages_;
+        Semaphore ready_;
+        mutable pthread_mutex_t messages_lock_;
+
+        BlockingMessageConsumer(const BlockingMessageConsumer& oth);
+        const BlockingMessageConsumer& operator=(const BlockingMessageConsumer& oth);
+
+        friend class CoreLibImpl;
+        BlockingMessageConsumer();
+        virtual ~BlockingMessageConsumer();
+        void enqueue(Message *msg);
+        void removeQueued(const Destination &d);
+
+        friend class BlockingMessageConsumerRef;
+        unsigned int getNumReadyMessages() const;
+        std::auto_ptr<Message> receive();
+    };
+};
+
+#endif // ACTIVEMQ_BLOCKINGMSGCONSUMER_H

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumer.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp Mon Jul 31 02:36:40 2006
@@ -0,0 +1,77 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#include "RCSID.h"
+#include "BlockingMessageConsumerRef.h"
+#include "BlockingMessageConsumer.h"
+#include "CoreLib.h"
+#include "Exception.h"
+
+using namespace ActiveMQ;
+using std::auto_ptr;
+
+RCSID(BlockingMessageConsumerRef, "$Id$");
+
+BlockingMessageConsumerRef::BlockingMessageConsumerRef
+    (CoreLib *a, BlockingMessageConsumer *q) :
+    MessageConsumerRef(a), cons_(q) {
+    if (isValid())
+        owner_->registerRef(this);
+}
+
+BlockingMessageConsumerRef::BlockingMessageConsumerRef
+(const BlockingMessageConsumerRef& oth)
+    : MessageConsumerRef(oth), cons_(oth.cons_)
+{
+    if (isValid())
+        owner_->registerRef(this);
+}
+
+BlockingMessageConsumerRef &
+BlockingMessageConsumerRef::operator=(const BlockingMessageConsumerRef& oth) {
+    if (this == &oth)
+        return *this;
+    cons_ = oth.cons_;
+    MessageConsumerRef::operator=(oth);
+    return *this;
+}
+
+BlockingMessageConsumerRef::~BlockingMessageConsumerRef() {
+    if (isValid())
+        owner_->deregisterRef(this);
+}
+
+int
+BlockingMessageConsumerRef::getNumReadyMessages() const {
+    if (!isValid())
+        throw Exception("getNumReadyMessages called on invalid reference!");
+    return cons_->getNumReadyMessages();
+}
+
+auto_ptr<Message>
+BlockingMessageConsumerRef::receive() {
+    if (!isValid())
+        throw Exception("receive called on invalid reference!");
+    return cons_->receive();
+}
+
+bool
+BlockingMessageConsumerRef::isValid() const {
+    return owner_ != NULL && cons_ != NULL;
+}

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.cpp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,102 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H
+#define ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H
+
+#include <semaphore.h>
+#include <pthread.h>
+#include <memory>
+#include <deque>
+
+#include "MessageConsumerRef.h"
+#include "BlockingMessageConsumer.h"
+
+namespace ActiveMQ {
+    class CoreLib;
+
+    /// handle on message vendor with blocking semantics.
+    /**
+       This class is a handle on a BlockingMessageConsumer, which is
+       an object that holds messages that have been received by a
+       BrokerSession object but not yet received by the application.  It
+       contains an internal queue and a semaphore (this class is
+       thread safe).
+
+       When a Message is enqueued, it is stored internally and the
+       semaphore is posted.
+
+       The receive() call will block until a message is ready, then
+       return that message.
+
+       BlockingMessageConsumers are owned by the library, so this weak
+       reference class is provided to allow flexible sharing of the
+       handle (like a pointer) while at the same time providing
+       protection from pointer invalidation.  When the owning library
+       is destructed, it will nullify existing weak reference objects
+       so that calls will throw instead of crashing.
+
+       @version $Id$
+    */
+    class BlockingMessageConsumerRef : public MessageConsumerRef {
+    public:
+        BlockingMessageConsumerRef() : MessageConsumerRef(), cons_(NULL) {}
+        BlockingMessageConsumerRef(const BlockingMessageConsumerRef &);
+        BlockingMessageConsumerRef& operator=(const BlockingMessageConsumerRef& oth);
+        virtual ~BlockingMessageConsumerRef();
+
+        /// gets the number of messages that are ready
+        /**
+           @returns the number of waiting messages
+        */
+        int getNumReadyMessages() const;
+
+        /// blocking receive
+        /**
+           Receives a Message.  If none are ready, this will block
+           until one is.  It is returned as a std::auto_ptr to make
+           the ownership policy clear.
+
+           Note that a variant of receive() that returns a regular
+           pointer is defined on ActiveMQ::MessageConsumerRef.
+
+           @returns the new Message
+        */
+        std::auto_ptr<Message> receive();
+
+        /// checks validity
+        /**
+           Since this class is a weak reference, it could be
+           invalidated.  If it's invalid, calling these functions will
+           throw.
+
+           @returns true if the reference is invalid
+        */
+        virtual bool isValid() const;
+
+    private:
+        friend class CoreLibImpl;
+        BlockingMessageConsumerRef(CoreLib *a, BlockingMessageConsumer *q);
+        
+        BlockingMessageConsumer *cons_;
+        MessageConsumer *getConsumer() const { return cons_; }
+    };
+};
+
+#endif // ACTIVEMQ_BLOCKINGMSGCONSUMER_REF_H

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BlockingMessageConsumerRef.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/Buffer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/Buffer.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/Buffer.h (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/Buffer.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,37 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BUFFER_H
+#define ACTIVEMQ_BUFFER_H
+
+#include <inttypes.h>
+#include <vector>
+
+namespace ActiveMQ {
+    /// A buffer of data
+    /**
+       A Buffer is just a vector of bytes.  A vector is used to
+       encapsulate length information.
+
+       @version $Id$
+    */
+    typedef std::vector<uint8_t> Buffer;
+};
+
+#endif // ACTIVEMQ_BUFFER_H

Propchange: incubator/activemq/trunk/amazon/amq_corelib/Buffer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/Buffer.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,62 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_BYTESMESSAGE_H
+#define ACTIVEMQ_BYTESMESSAGE_H
+
+#include <vector>
+
+#include "Message.h"
+
+namespace ActiveMQ {
+    class CoreLibImpl;
+
+    /// Message containing a byte buffer
+    /**
+       Represents an ActiveMQ Message containing an opaque byte array.
+
+       @version $Id$
+    */
+    class BytesMessage : public Message {
+    public:
+        /// gets the type
+        /**
+           Gets the integer type of this message.
+
+           @returns the type
+        */
+        int getType() const { return Command::Types::ACTIVEMQ_BYTES_MESSAGE; }
+
+        /// Constructs a new BytesMessage.
+        /**
+           Makes a new BytesMessage containing the given data.
+        */
+        BytesMessage(const Buffer& data) : data_(data) {}
+
+        /// gets the data as a byte array
+        /*
+          @param buf the buffer to put the data into
+        */
+        void marshall(Buffer& buf) const { buf = data_; }
+    private:
+        Buffer data_;
+    };
+};
+
+#endif // ACTIVEMQ_BYTESMESSAGE_H

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/BytesMessage.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp Mon Jul 31 02:36:40 2006
@@ -0,0 +1,147 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#include <string>
+#include <memory>
+
+#include "MessageConsumer.h"
+#include "NonBlockingMessageConsumerRef.h"
+#include "BlockingMessageConsumerRef.h"
+#include "RCSID.h"
+
+#include "CoreLib.h"
+#include "CoreLibImpl_.h"
+
+using namespace ActiveMQ;
+using std::string;
+using std::auto_ptr;
+
+RCSID(CoreLib, "$Id$");
+
+CoreLib::CoreLib(const string& user,
+                 const string& password) :
+    pimpl_(new CoreLibImpl(this,user,password))
+  {}
+
+void
+CoreLib::initialize(Buffer& b) {
+    pimpl_->initialize(b);
+}
+
+void
+CoreLib::publish(const Message& m, Buffer& b) {
+    pimpl_->publish(m,b);
+}
+
+void
+CoreLib::publish(const Destination& d,
+                 const Message& m,
+                 Buffer& b) {
+    pimpl_->publish(d,m,b);
+}
+
+void
+CoreLib::disconnect(Buffer& b) {
+    return pimpl_->disconnect(b);
+}
+
+void
+CoreLib::subscribe(const Destination& d, MessageConsumerRef& q, Buffer& b) {
+    return pimpl_->subscribe(d,q,b);
+}
+
+void
+CoreLib::unsubscribe(const Destination& d, Buffer& b) {
+    return pimpl_->unsubscribe(d,b);
+}
+
+void
+CoreLib::handleData(const Buffer& incoming, Buffer& b) {
+    pimpl_->handleData(incoming, b);
+}
+
+void
+CoreLib::handleData(const unsigned char *buf, size_t len, Buffer& b) {
+    pimpl_->handleData(buf,len, b);
+}
+
+BlockingMessageConsumerRef
+CoreLib::newBlockingMessageConsumer(void) {
+    return pimpl_->newBlockingMessageConsumer();
+}
+
+NonBlockingMessageConsumerRef
+CoreLib::newNonBlockingMessageConsumer(void) {
+    return pimpl_->newNonBlockingMessageConsumer();
+}
+
+void
+CoreLib::registerRef(MessageConsumerRef *q) {
+    pimpl_->registerRef(q);
+}
+
+void
+CoreLib::deregisterRef(MessageConsumerRef *q) {
+    pimpl_->deregisterRef(q);
+}
+
+void
+CoreLib::setLogger(auto_ptr<Logger> lgr) {
+    pimpl_->setLogger(lgr);
+}
+
+void
+CoreLib::setLogger(Logger *c) {
+    setLogger(auto_ptr<Logger>(c));
+}
+
+Logger&
+CoreLib::getLogger() {
+    return pimpl_->getLogger();
+}
+
+Destination
+CoreLib::createTemporaryTopic() {
+    return pimpl_->createTemporaryTopic();
+}
+
+Destination
+CoreLib::createTemporaryQueue() {
+    return pimpl_->createTemporaryQueue();
+}
+
+Destination
+CoreLib::createTopic(const string& name) {
+    return pimpl_->createTopic(name);
+}
+
+Destination
+CoreLib::createQueue(const string& name) {
+    return pimpl_->createQueue(name);
+}
+
+void
+CoreLib::registerDest(const Destination& d) {
+    pimpl_->registerDest(d);
+}
+
+void
+CoreLib::unregisterDest(const Destination& d) {
+    pimpl_->unregisterDest(d);
+}

Propchange: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.cpp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h?rev=427057&view=auto
==============================================================================
--- incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h (added)
+++ incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h Mon Jul 31 02:36:40 2006
@@ -0,0 +1,252 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+#ifndef ACTIVEMQ_CORELIB_H
+#define ACTIVEMQ_CORELIB_H
+
+#include <string>
+#include <memory>
+
+#include "Buffer.h"
+#include "Logger.h"
+#include "CoreLibImpl_.h"
+
+namespace ActiveMQ {
+    class MessageConsumer;
+    class MessageConsumerRef;
+    class NonBlockingMessageConsumerRef;
+    class BlockingMessageConsumerRef;
+    class Destination;
+    class Message;
+    /// Low-level, single-threaded library for ActiveMQ messaging
+    /**
+       This class is a bare-bones container for ActiveMQ messaging
+       functionality.  Use this library if your application:
+         - has a restricted number of threads
+         - needs a simple interface
+         - has nonstandard transport needs
+
+       This library works on a "data in, messages out" model.  The
+       calling application is responsible for doing socket
+       communication (likely using a subclass of ActiveMQ::Transport)
+       and shuttling data in and out of this library.  This is to make
+       the core library as small and portable as possible, as well as
+       guaranteeing that it will never block.  Most API functions
+       either take a buffer that has been received or return a
+       marshalled buffer with outgoing data.
+
+       @version $Id$
+    */
+    class CoreLib {
+    public:
+        /// Creates a new handle on an ActiveMQ broker.
+        /**
+           Creates a new handle and state associated
+           with a logical ActiveMQ broker.
+
+           @param user username to use for authentication
+           @param password password to use for authentication
+        */
+        CoreLib(const std::string& user,
+                const std::string& password);
+        
+        /// Initiates OpenWire communication
+        /**
+           Gets initialization data and enables the other commands.
+
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void initialize(Buffer& toSend);
+
+        /// Disconnects from the broker
+        /**
+           Disconnects from the broker and disables the other commands.
+
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void disconnect(Buffer& toSend);
+
+        /// Publishes a message
+        /**
+           Publishes a message.  It extracts the Destination from the
+           message and calls publish(msg,dest).
+
+           @param msg message to send
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void publish(const Message& msg, Buffer& toSend);
+
+        /// Publishes a message
+        /**
+           Publishes a message on a given Destination.  This overrides
+           any destination set as part of the Message.
+
+           @param dest destination of the message
+           @param msg message to send
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void publish(const Destination& dest,
+                     const Message& msg,
+                     Buffer& toSend);
+
+        /// Subscribes
+        /**
+           Subscribes this session to a particular Destination.  When
+           data is received that forms a Message on this Destination,
+           it will be enqueued on the given MessageConsumer.
+
+           @param dest destination to receive messages on
+           @param q MessageConsumer to deliver message to
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void subscribe(const Destination& dest,
+                       MessageConsumerRef& q,
+                       Buffer& toSend);
+
+        /// Unsubscribes
+        /**
+           Stops the receipt of further messages on the given
+           Destination.  After this call no more messages will be
+           received from the MessageConsumer subscribed to this
+           Destination.
+
+           Throws ActiveMQ::Exception if this destination is not already subscribed.
+           
+           @param dest the Destination to stop listening to
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void unsubscribe(const Destination& dest,
+                         Buffer& toSend);
+
+        /// Notifies the library of data
+        /**
+           When there is data from the broker, pass it to this
+           function.  If the incoming data forms a message, it will be
+           delivered to the appropriate MessageConsumer.
+
+           @param incoming the data read from the broker
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void handleData(const Buffer& incoming, Buffer& toSend);
+
+        /// Notifies the library of data
+        /**
+           When there is data from the broker, pass it to this
+           function.  If the incoming data forms a message, it will be
+           delivered to the appropriate MessageConsumer.
+
+           @param buf the data read from the broker
+           @param len the number of bytes in buf
+           @param toSend buffer to fill in with data to send to the broker
+        */
+        void handleData(const unsigned char *buf, size_t len, Buffer& toSend);
+
+        /// Creates a new NonBlockingMessageConsumer
+        /**
+           This creates a new MessageConsumer with its own event fd
+           and nonblocking semantics.
+           
+           @returns a weak reference to the new object (which is owned by the library).
+        */
+        NonBlockingMessageConsumerRef newNonBlockingMessageConsumer();
+
+        /// Creates a new BlockingMessageConsumer
+        /**
+           This creates a new MessageConsumer with blocking semantics.
+           
+           @returns a weak reference to the new object (which is owned by the library).
+        */
+        BlockingMessageConsumerRef newBlockingMessageConsumer();
+
+        /// Sets the handler for log events.
+        /**
+           Sets the handler for log events.  This call will deallocate
+           any existing Logger set by a previous call.
+
+           Note this is passed in as an auto_ptr to demonstrate the
+           library's ownership of this memory.  If this doesn't work
+           well with your application, there is a dumb pointer overload.
+        
+           @param lgr the subclass instance of ActiveMQ::Logger to log with
+        */
+        void setLogger(std::auto_ptr<Logger> lgr);
+
+        /// Sets the handler for log events.
+        /**
+           Sets the handler for log events.  Any heap-allocated
+           pointer to an instance of a subclass of ActiveMQ::Logger
+           will be accepted.  This call will deallocate any existing
+           Logger set by a previous call.
+        
+           <b>The library will own this pointer and take care of freeing it.</b>
+
+           @param lgr the subclass instance of ActiveMQ::Logger to log with
+        */
+        void setLogger(Logger *lgr);
+
+        /// Gets the handlers for log events
+        /**
+           @returns a reference to the handler for log events
+        */
+        Logger& getLogger();
+
+        /// Creates a new topic
+        /**
+           @param name the name of the topic
+
+           @returns a new Topic
+        */
+        Destination createTopic(const std::string& name);
+
+        /// Creates a new queue
+        /**
+           @param name the name of the queue
+
+           @returns a new Queue
+        */
+        Destination createQueue(const std::string& name);
+
+        /// Creates a new temporary topic
+        /**
+           @returns a new Temporary Topic
+        */
+        Destination createTemporaryTopic();
+
+        /// Creates a new temporary queue
+        /**
+           @returns a new Temporary Queue
+        */
+        Destination createTemporaryQueue();
+
+    private:
+        std::auto_ptr<CoreLibImpl> pimpl_;
+
+        friend class BlockingMessageConsumerRef;
+        friend class NonBlockingMessageConsumerRef;
+        friend class MessageConsumerRef;
+        void registerRef(MessageConsumerRef *mc);
+        void deregisterRef(MessageConsumerRef *mc);
+
+        friend class Destination;
+        void registerDest(const Destination& d);
+        void unregisterDest(const Destination& d);
+    };
+};
+
+#endif // ACTIVEMQ_CORELIB_H

Propchange: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/amazon/amq_corelib/CoreLib.h
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message