activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r426431 [3/14] - in /incubator/activemq/branches/activemq-4.0: activemq-core/src/gram/script/ activemq-core/src/main/java/org/apache/activemq/kaha/impl/ activemq-core/src/main/java/org/apache/activemq/openwire/v1/ activemq-core/src/test/jav...
Date Fri, 28 Jul 2006 08:22:55 GMT
Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.cpp Fri Jul 28 01:22:48 2006
@@ -1,382 +1,382 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/Connection.hpp"
-#include "activemq/Session.hpp"
-
-using namespace apache::activemq;
-
-
-// --- Constructors -------------------------------------------------
-
-/*
- *
- */
-Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
-{
-    this->transport               = transport ;
-    this->connectionInfo          = connectionInfo ;
-    this->acknowledgementMode     = AutoAckMode ;
-    this->connected               = false ;
-    this->closed                  = false ;
-    this->brokerInfo              = NULL ;
-    this->brokerWireFormat        = NULL ;
-    this->sessionCounter          = 0 ;
-    this->tempDestinationCounter  = 0 ;
-    this->localTransactionCounter = 0 ;
-
-    // Hook up as a command listener and start dispatching
-    transport->setCommandListener(smartify(this)) ;
-    transport->start() ;
-}
-
-/*
- *
- */
-Connection::~Connection()
-{
-    // Make sure connection is closed
-    close() ;
-}
-
-
-// --- Attribute methods --------------------------------------------
-
-/*
- *
- */
-void Connection::setExceptionListener(p<IExceptionListener> listener)
-{
-    this->listener = listener ;
-}
-
-/*
- *
- */
-p<IExceptionListener> Connection::getExceptionListener()
-{
-    return listener ;
-}
-
-/*
- *
- */
-p<ITransport> Connection::getTransport()
-{
-    return transport ;
-}
-
-/*
- *
- */
-void Connection::setTransport(p<ITransport> transport)
-{
-    this->transport = transport ;
-}
-
-/*
- *
- */
-p<string> Connection::getClientId()
-{
-    return connectionInfo->getClientId() ;
-}
-
-/*
- *
- */
-void Connection::setClientId(const char* value) throw (CmsException)
-{
-    if( connected )
-        throw CmsException("You cannot change the client id once a connection is established") ; 
-
-    p<string> clientId = new string(value) ;
-    connectionInfo->setClientId( clientId ) ;
-}
-
-
-/*
- *
- */
-p<BrokerInfo> Connection::getBrokerInfo()
-{
-    return brokerInfo ;
-}
-
-/*
- *
- */
-p<WireFormatInfo> Connection::getBrokerWireFormat()
-{
-    return brokerWireFormat ;
-}
-
-/*
- *
- */
-AcknowledgementMode Connection::getAcknowledgementMode()
-{
-    return acknowledgementMode ;
-}
-
-/*
- *
- */
-void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
-{
-    acknowledgementMode = ackMode ;
-}
-
-/*
- *
- */
-p<ConnectionId> Connection::getConnectionId()
-{
-    return connectionInfo->getConnectionId() ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- *
- */
-void Connection::close()
-{
-    if( !closed )
-    {
-        list< p<ISession> >::iterator sessionIter ;
-
-        // Iterate through all sessions and close them down
-        for( sessionIter = sessions.begin() ;
-             sessionIter != sessions.end() ;
-             sessionIter++ )
-        {
-            (*sessionIter)->close() ;
-        }
-        // Empty session list
-        sessions.clear() ;
-
-        // Remove connection from broker
-        disposeOf( getConnectionId() ) ;
-
-        // Finally, transmit a shutdown command to broker
-        transport->oneway( new ShutdownInfo() ) ;
-        closed = true ;
-    }
-}
-
-/*
- *
- */
-p<ISession> Connection::createSession() throw(CmsException)
-{
-    return createSession(acknowledgementMode) ;
-}
-
-/*
- *
- */
-p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
-{
-    p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
-
-    // Send session info to broker
-    syncRequest(sessionInfo) ;
-
-    p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
-    sessions.push_back(session) ;
-
-    return session ;
-}
-
-/*
- * Performs a synchronous request-response with the broker.
- */
-p<Response> Connection::syncRequest(p<ICommand> command) throw(CmsException) 
-{
-    checkConnected() ;
-    
-    p<Response> response = transport->request(command) ;
-
-    if( response->getDataStructureType() == ExceptionResponse::TYPE )
-    {
-        p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
-        p<BrokerError>       brokerError = exceptionResponse->getException() ;
-        string               message ;
-
-        // Build error message
-        message.assign("Request failed: ") ;
-        message.append( brokerError->getExceptionClass()->c_str() ) ;
-        message.append(", ") ;
-        message.append( brokerError->getStackTrace()->c_str() ) ;
-
-        // TODO: Change to CMSException()
-        throw CmsException( message.c_str() ) ; 
-    }
-    return response ;
-}
-
-/*
- *
- */
-void Connection::oneway(p<ICommand> command) throw(CmsException)
-{
-    checkConnected() ;
-    transport->oneway(command) ;
-}
-
-/*
- *
- */
-void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
-{
-    p<RemoveInfo> command = new RemoveInfo() ;
-    command->setObjectId( dataStructure ) ;
-    syncRequest(command) ;
-}
-
-/*
- * Creates a new temporary destination name.
- */
-p<string> Connection::createTemporaryDestinationName()
-{
-    p<string> name = new string() ;
-    char*     buffer = new char[15] ;
-
-    {
-        LOCKED_SCOPE( mutex );
-
-        name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
-        name->append( ":" ) ;
-#ifdef unix
-        sprintf(buffer, "%lld", ++tempDestinationCounter) ;
-#else
-        sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
-#endif
-        name->append( buffer ) ;
-    }
-
-    return name ;
-}
-
-/*
- * Creates a new local transaction ID.
- */
-p<LocalTransactionId> Connection::createLocalTransactionId()
-{
-    p<LocalTransactionId> id = new LocalTransactionId() ;
-
-    id->setConnectionId( getConnectionId() ) ;
-
-    {
-        LOCKED_SCOPE (mutex);
-        id->setValue( ++localTransactionCounter ) ;
-    }
-
-    return id ;
-}
-
-
-// --- Implementation methods ---------------------------------------
-
-/*
- *
- */
-p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
-{
-    p<SessionInfo> sessionInfo = new SessionInfo() ;
-    p<SessionId>   sessionId   = new SessionId() ;
-    
-    sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
-
-    {
-        LOCKED_SCOPE( mutex );
-        sessionId->setValue( ++sessionCounter ) ; 
-    }
-
-    sessionInfo->setSessionId( sessionId ) ;
-    return sessionInfo ; 
-}
-
-/*
- *
- */
-void Connection::checkConnected() throw(CmsException) 
-{
-    if( closed )
-        throw ConnectionClosedException("Oops! Connection already closed.") ;
-
-    if( !connected )
-    {
-        connected = true ;
-
-        // Send the connection info and see if we get an ack/nak
-        syncRequest( connectionInfo ) ;
-    } 
-}
-
-/*
- * Handle incoming commands.
- */
-void Connection::onCommand(p<ITransport> transport, p<ICommand> command)
-{
-    if( command->getDataStructureType() == MessageDispatch::TYPE )
-    {
-        p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
-        p<ConsumerId> consumerId = dispatch->getConsumerId() ;
-        p<MessageConsumer> consumer = NULL ;
-        list< p<ISession> >::const_iterator tempIter ;
-
-        // Iterate through all sessions and check if one has the consumer
-        for( tempIter = sessions.begin() ;
-             tempIter != sessions.end() ;
-             tempIter++ )
-        {
-            consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
-
-            // Found a match?
-            if( consumer != NULL )
-                break ;
-        }
-        if( consumer == NULL )
-            cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
-        else
-        {
-            p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
-            consumer->dispatch(message) ;
-        }
-    }
-    else if( command->getDataStructureType() == WireFormatInfo::TYPE )
-        this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
-
-    else if( command->getDataStructureType() == BrokerInfo::TYPE )
-        this->brokerInfo = p_cast<BrokerInfo> (command) ;
-
-    else
-        cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
-}
-
-/*
- * Handle incoming broker errors.
- */
-void Connection::onError(p<ITransport> transport, exception& error)
-{
-    if( listener != NULL )
-        this->listener->onException(error) ;
-    else
-        cout << "ERROR: Received a broker exception: " << error.what() << endl ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/Connection.hpp"
+#include "activemq/Session.hpp"
+
+using namespace apache::activemq;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
+{
+    this->transport               = transport ;
+    this->connectionInfo          = connectionInfo ;
+    this->acknowledgementMode     = AutoAckMode ;
+    this->connected               = false ;
+    this->closed                  = false ;
+    this->brokerInfo              = NULL ;
+    this->brokerWireFormat        = NULL ;
+    this->sessionCounter          = 0 ;
+    this->tempDestinationCounter  = 0 ;
+    this->localTransactionCounter = 0 ;
+
+    // Hook up as a command listener and start dispatching
+    transport->setCommandListener(smartify(this)) ;
+    transport->start() ;
+}
+
+/*
+ *
+ */
+Connection::~Connection()
+{
+    // Make sure connection is closed
+    close() ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void Connection::setExceptionListener(p<IExceptionListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<IExceptionListener> Connection::getExceptionListener()
+{
+    return listener ;
+}
+
+/*
+ *
+ */
+p<ITransport> Connection::getTransport()
+{
+    return transport ;
+}
+
+/*
+ *
+ */
+void Connection::setTransport(p<ITransport> transport)
+{
+    this->transport = transport ;
+}
+
+/*
+ *
+ */
+p<string> Connection::getClientId()
+{
+    return connectionInfo->getClientId() ;
+}
+
+/*
+ *
+ */
+void Connection::setClientId(const char* value) throw (CmsException)
+{
+    if( connected )
+        throw CmsException("You cannot change the client id once a connection is established") ; 
+
+    p<string> clientId = new string(value) ;
+    connectionInfo->setClientId( clientId ) ;
+}
+
+
+/*
+ *
+ */
+p<BrokerInfo> Connection::getBrokerInfo()
+{
+    return brokerInfo ;
+}
+
+/*
+ *
+ */
+p<WireFormatInfo> Connection::getBrokerWireFormat()
+{
+    return brokerWireFormat ;
+}
+
+/*
+ *
+ */
+AcknowledgementMode Connection::getAcknowledgementMode()
+{
+    return acknowledgementMode ;
+}
+
+/*
+ *
+ */
+void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
+{
+    acknowledgementMode = ackMode ;
+}
+
+/*
+ *
+ */
+p<ConnectionId> Connection::getConnectionId()
+{
+    return connectionInfo->getConnectionId() ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+void Connection::close()
+{
+    if( !closed )
+    {
+        list< p<ISession> >::iterator sessionIter ;
+
+        // Iterate through all sessions and close them down
+        for( sessionIter = sessions.begin() ;
+             sessionIter != sessions.end() ;
+             sessionIter++ )
+        {
+            (*sessionIter)->close() ;
+        }
+        // Empty session list
+        sessions.clear() ;
+
+        // Remove connection from broker
+        disposeOf( getConnectionId() ) ;
+
+        // Finally, transmit a shutdown command to broker
+        transport->oneway( new ShutdownInfo() ) ;
+        closed = true ;
+    }
+}
+
+/*
+ *
+ */
+p<ISession> Connection::createSession() throw(CmsException)
+{
+    return createSession(acknowledgementMode) ;
+}
+
+/*
+ *
+ */
+p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
+{
+    p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
+
+    // Send session info to broker
+    syncRequest(sessionInfo) ;
+
+    p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
+    sessions.push_back(session) ;
+
+    return session ;
+}
+
+/*
+ * Performs a synchronous request-response with the broker.
+ */
+p<Response> Connection::syncRequest(p<ICommand> command) throw(CmsException) 
+{
+    checkConnected() ;
+    
+    p<Response> response = transport->request(command) ;
+
+    if( response->getDataStructureType() == ExceptionResponse::TYPE )
+    {
+        p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
+        p<BrokerError>       brokerError = exceptionResponse->getException() ;
+        string               message ;
+
+        // Build error message
+        message.assign("Request failed: ") ;
+        message.append( brokerError->getExceptionClass()->c_str() ) ;
+        message.append(", ") ;
+        message.append( brokerError->getStackTrace()->c_str() ) ;
+
+        // TODO: Change to CMSException()
+        throw CmsException( message.c_str() ) ; 
+    }
+    return response ;
+}
+
+/*
+ *
+ */
+void Connection::oneway(p<ICommand> command) throw(CmsException)
+{
+    checkConnected() ;
+    transport->oneway(command) ;
+}
+
+/*
+ *
+ */
+void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
+{
+    p<RemoveInfo> command = new RemoveInfo() ;
+    command->setObjectId( dataStructure ) ;
+    syncRequest(command) ;
+}
+
+/*
+ * Creates a new temporary destination name.
+ */
+p<string> Connection::createTemporaryDestinationName()
+{
+    p<string> name = new string() ;
+    char*     buffer = new char[15] ;
+
+    {
+        LOCKED_SCOPE( mutex );
+
+        name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
+        name->append( ":" ) ;
+#ifdef unix
+        sprintf(buffer, "%lld", ++tempDestinationCounter) ;
+#else
+        sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
+#endif
+        name->append( buffer ) ;
+    }
+
+    return name ;
+}
+
+/*
+ * Creates a new local transaction ID.
+ */
+p<LocalTransactionId> Connection::createLocalTransactionId()
+{
+    p<LocalTransactionId> id = new LocalTransactionId() ;
+
+    id->setConnectionId( getConnectionId() ) ;
+
+    {
+        LOCKED_SCOPE (mutex);
+        id->setValue( ++localTransactionCounter ) ;
+    }
+
+    return id ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
+{
+    p<SessionInfo> sessionInfo = new SessionInfo() ;
+    p<SessionId>   sessionId   = new SessionId() ;
+    
+    sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
+
+    {
+        LOCKED_SCOPE( mutex );
+        sessionId->setValue( ++sessionCounter ) ; 
+    }
+
+    sessionInfo->setSessionId( sessionId ) ;
+    return sessionInfo ; 
+}
+
+/*
+ *
+ */
+void Connection::checkConnected() throw(CmsException) 
+{
+    if( closed )
+        throw ConnectionClosedException("Oops! Connection already closed.") ;
+
+    if( !connected )
+    {
+        connected = true ;
+
+        // Send the connection info and see if we get an ack/nak
+        syncRequest( connectionInfo ) ;
+    } 
+}
+
+/*
+ * Handle incoming commands.
+ */
+void Connection::onCommand(p<ITransport> transport, p<ICommand> command)
+{
+    if( command->getDataStructureType() == MessageDispatch::TYPE )
+    {
+        p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
+        p<ConsumerId> consumerId = dispatch->getConsumerId() ;
+        p<MessageConsumer> consumer = NULL ;
+        list< p<ISession> >::const_iterator tempIter ;
+
+        // Iterate through all sessions and check if one has the consumer
+        for( tempIter = sessions.begin() ;
+             tempIter != sessions.end() ;
+             tempIter++ )
+        {
+            consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
+
+            // Found a match?
+            if( consumer != NULL )
+                break ;
+        }
+        if( consumer == NULL )
+            cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
+        else
+        {
+            p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
+            consumer->dispatch(message) ;
+        }
+    }
+    else if( command->getDataStructureType() == WireFormatInfo::TYPE )
+        this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
+
+    else if( command->getDataStructureType() == BrokerInfo::TYPE )
+        this->brokerInfo = p_cast<BrokerInfo> (command) ;
+
+    else
+        cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
+}
+
+/*
+ * Handle incoming broker errors.
+ */
+void Connection::onError(p<ITransport> transport, exception& error)
+{
+    if( listener != NULL )
+        this->listener->onException(error) ;
+    else
+        cout << "ERROR: Received a broker exception: " << error.what() << endl ;
+}

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.hpp Fri Jul 28 01:22:48 2006
@@ -1,124 +1,124 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_Connection_hpp_
-#define ActiveMQ_Connection_hpp_
-
-#include <iostream>
-#include <list>
-#include <string>
-#include <map>
-
-#include "cms/ISession.hpp"
-#include "cms/IConnection.hpp"
-#include "cms/IExceptionListener.hpp"
-#include "cms/CmsException.hpp"
-#include "activemq/ConnectionClosedException.hpp"
-#include "activemq/MessageConsumer.hpp"
-#include "activemq/command/BrokerInfo.hpp"
-#include "activemq/command/WireFormatInfo.hpp"
-#include "activemq/command/ExceptionResponse.hpp"
-#include "activemq/command/ConnectionInfo.hpp"
-#include "activemq/command/LocalTransactionId.hpp"
-#include "activemq/command/MessageDispatch.hpp"
-#include "activemq/command/SessionInfo.hpp"
-#include "activemq/command/SessionId.hpp"
-#include "activemq/command/ShutdownInfo.hpp"
-#include "activemq/transport/ITransport.hpp"
-#include "activemq/transport/ICommandListener.hpp"
-#include "ppr/thread/SimpleMutex.hpp"
-#include "ppr/util/ifr/p"
-
-// Turn off warning message for ignored exception specification
-#ifdef _MSC_VER
-#pragma warning( disable : 4290 )
-#endif
-
-namespace apache
-{
-  namespace activemq
-  {
-    using namespace std;
-    using namespace ifr;
-    using namespace apache::cms;
-    using namespace apache::activemq::command;
-    using namespace apache::activemq::transport;
-    using namespace apache::ppr::thread;
-    using namespace apache::ppr::util;
-
-/*
- * 
- */
-class Connection : public IConnection, public ICommandListener
-{
-private:
-    p<ConnectionInfo>     connectionInfo ;
-    p<ITransport>         transport ;
-    p<BrokerInfo>         brokerInfo ;        // from MQ broker
-    p<WireFormatInfo>     brokerWireFormat ;  // from MQ broker
-    p<IExceptionListener> listener ;
-    list< p<ISession> >   sessions ;
-    bool                  connected,
-                          closed ;
-    AcknowledgementMode   acknowledgementMode ;
-    long long             sessionCounter,
-                          tempDestinationCounter,
-                          localTransactionCounter ;
-    SimpleMutex           mutex ;
-
-public:
-    // Constructors
-    Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
-    virtual ~Connection() ;
-
-    // Attribute methods
-    virtual void setExceptionListener(p<IExceptionListener> listener) ;
-    virtual p<IExceptionListener> getExceptionListener() ;
-    virtual p<ITransport> getTransport() ;
-    virtual void setTransport(p<ITransport> transport) ;
-    virtual p<string> getClientId() ;
-    virtual void setClientId(const char* value) throw (CmsException) ;
-    virtual p<BrokerInfo> getBrokerInfo() ;
-    virtual p<WireFormatInfo> getBrokerWireFormat() ;
-    virtual AcknowledgementMode getAcknowledgementMode() ;
-    virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
-//    virtual void addConsumer(p<ConsumerId> consumerId, p<MessageConsumer> messageConsumer) ;
-//    virtual void removeConsumer(p<ConsumerId> consumerId) ;
-    virtual p<ConnectionId> getConnectionId() ;
-
-    // Operation methods
-    virtual p<ISession> createSession() throw(CmsException) ;
-    virtual p<ISession> createSession(AcknowledgementMode mode) throw(CmsException) ;
-    virtual p<Response> syncRequest(p<ICommand> command) throw(CmsException) ;
-    virtual void oneway(p<ICommand> command) throw(CmsException) ;
-    virtual void disposeOf(p<IDataStructure> dataStructure) throw(CmsException) ;
-    virtual p<string> createTemporaryDestinationName() ;
-    virtual p<LocalTransactionId> createLocalTransactionId() ;
-    virtual void close() ;
-
-protected:
-    // Implementation methods
-    p<SessionInfo> createSessionInfo(AcknowledgementMode mode) ;
-    void checkConnected() throw(CmsException) ;
-    void onCommand(p<ITransport> transport, p<ICommand> command) ;
-    void onError(p<ITransport> transport, exception& error) ;
-} ;
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_Connection_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_Connection_hpp_
+#define ActiveMQ_Connection_hpp_
+
+#include <iostream>
+#include <list>
+#include <string>
+#include <map>
+
+#include "cms/ISession.hpp"
+#include "cms/IConnection.hpp"
+#include "cms/IExceptionListener.hpp"
+#include "cms/CmsException.hpp"
+#include "activemq/ConnectionClosedException.hpp"
+#include "activemq/MessageConsumer.hpp"
+#include "activemq/command/BrokerInfo.hpp"
+#include "activemq/command/WireFormatInfo.hpp"
+#include "activemq/command/ExceptionResponse.hpp"
+#include "activemq/command/ConnectionInfo.hpp"
+#include "activemq/command/LocalTransactionId.hpp"
+#include "activemq/command/MessageDispatch.hpp"
+#include "activemq/command/SessionInfo.hpp"
+#include "activemq/command/SessionId.hpp"
+#include "activemq/command/ShutdownInfo.hpp"
+#include "activemq/transport/ITransport.hpp"
+#include "activemq/transport/ICommandListener.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/util/ifr/p"
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+namespace apache
+{
+  namespace activemq
+  {
+    using namespace std;
+    using namespace ifr;
+    using namespace apache::cms;
+    using namespace apache::activemq::command;
+    using namespace apache::activemq::transport;
+    using namespace apache::ppr::thread;
+    using namespace apache::ppr::util;
+
+/*
+ * 
+ */
+class Connection : public IConnection, public ICommandListener
+{
+private:
+    p<ConnectionInfo>     connectionInfo ;
+    p<ITransport>         transport ;
+    p<BrokerInfo>         brokerInfo ;        // from MQ broker
+    p<WireFormatInfo>     brokerWireFormat ;  // from MQ broker
+    p<IExceptionListener> listener ;
+    list< p<ISession> >   sessions ;
+    bool                  connected,
+                          closed ;
+    AcknowledgementMode   acknowledgementMode ;
+    long long             sessionCounter,
+                          tempDestinationCounter,
+                          localTransactionCounter ;
+    SimpleMutex           mutex ;
+
+public:
+    // Constructors
+    Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
+    virtual ~Connection() ;
+
+    // Attribute methods
+    virtual void setExceptionListener(p<IExceptionListener> listener) ;
+    virtual p<IExceptionListener> getExceptionListener() ;
+    virtual p<ITransport> getTransport() ;
+    virtual void setTransport(p<ITransport> transport) ;
+    virtual p<string> getClientId() ;
+    virtual void setClientId(const char* value) throw (CmsException) ;
+    virtual p<BrokerInfo> getBrokerInfo() ;
+    virtual p<WireFormatInfo> getBrokerWireFormat() ;
+    virtual AcknowledgementMode getAcknowledgementMode() ;
+    virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
+//    virtual void addConsumer(p<ConsumerId> consumerId, p<MessageConsumer> messageConsumer) ;
+//    virtual void removeConsumer(p<ConsumerId> consumerId) ;
+    virtual p<ConnectionId> getConnectionId() ;
+
+    // Operation methods
+    virtual p<ISession> createSession() throw(CmsException) ;
+    virtual p<ISession> createSession(AcknowledgementMode mode) throw(CmsException) ;
+    virtual p<Response> syncRequest(p<ICommand> command) throw(CmsException) ;
+    virtual void oneway(p<ICommand> command) throw(CmsException) ;
+    virtual void disposeOf(p<IDataStructure> dataStructure) throw(CmsException) ;
+    virtual p<string> createTemporaryDestinationName() ;
+    virtual p<LocalTransactionId> createLocalTransactionId() ;
+    virtual void close() ;
+
+protected:
+    // Implementation methods
+    p<SessionInfo> createSessionInfo(AcknowledgementMode mode) ;
+    void checkConnected() throw(CmsException) ;
+    void onCommand(p<ITransport> transport, p<ICommand> command) ;
+    void onError(p<ITransport> transport, exception& error) ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_Connection_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Connection.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.cpp Fri Jul 28 01:22:48 2006
@@ -1,29 +1,29 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/ConnectionClosedException.hpp"
-
-using namespace apache::activemq;
-
-/*
- * 
- */
-ConnectionClosedException::ConnectionClosedException(const char* message)
-    : CmsException(message)
-{
-    // no-op
-}
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/ConnectionClosedException.hpp"
+
+using namespace apache::activemq;
+
+/*
+ * 
+ */
+ConnectionClosedException::ConnectionClosedException(const char* message)
+    : CmsException(message)
+{
+    // no-op
+}
+

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.hpp Fri Jul 28 01:22:48 2006
@@ -1,41 +1,41 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_ConnectionClosedException_hpp_
-#define ActiveMQ_ConnectionClosedException_hpp_
-
-#include "cms/CmsException.hpp"
-
-namespace apache
-{
-  namespace activemq
-  {
-    using namespace apache::cms;
-
-/*
- * Signals that a connection is being used when it is already closed.
- */
-class ConnectionClosedException : public CmsException
-{
-public:
-    ConnectionClosedException(const char* message) ;
-};
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_ConnectionClosedException_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_ConnectionClosedException_hpp_
+#define ActiveMQ_ConnectionClosedException_hpp_
+
+#include "cms/CmsException.hpp"
+
+namespace apache
+{
+  namespace activemq
+  {
+    using namespace apache::cms;
+
+/*
+ * Signals that a connection is being used when it is already closed.
+ */
+class ConnectionClosedException : public CmsException
+{
+public:
+    ConnectionClosedException(const char* message) ;
+};
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_ConnectionClosedException_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionClosedException.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionException.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionException.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionException.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionException.hpp Fri Jul 28 01:22:48 2006
@@ -1,47 +1,47 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_ConnectionException_hpp_
-#define ActiveMQ_ConnectionException_hpp_
-
-#include "ppr/TraceException.hpp"
-
-namespace apache
-{
-  namespace activemq
-  {
-    using namespace std ;
-    using namespace apache::ppr;
-
-/*
- * Signals that a connection error has occured.
- */
-class ConnectionException : public TraceException
-{
-public:
-    ConnectionException() : TraceException()
-       { /* no-op */ } ;
-    ConnectionException(const char *const& msg) : TraceException(msg)
-       { /* no-op */ } ;
-    ConnectionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
-       { /* no-op */ } ;
-} ;
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_ConnectionException_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_ConnectionException_hpp_
+#define ActiveMQ_ConnectionException_hpp_
+
+#include "ppr/TraceException.hpp"
+
+namespace apache
+{
+  namespace activemq
+  {
+    using namespace std ;
+    using namespace apache::ppr;
+
+/*
+ * Signals that a connection error has occured.
+ */
+class ConnectionException : public TraceException
+{
+public:
+    ConnectionException() : TraceException()
+       { /* no-op */ } ;
+    ConnectionException(const char *const& msg) : TraceException(msg)
+       { /* no-op */ } ;
+    ConnectionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+       { /* no-op */ } ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_ConnectionException_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionException.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.cpp Fri Jul 28 01:22:48 2006
@@ -1,184 +1,184 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/ConnectionFactory.hpp"
-#include "activemq/Connection.hpp"
-#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
-#include "activemq/transport/tcp/TcpTransport.hpp"
-
-using namespace apache::activemq;
-
-/*
- *
- */
-ConnectionFactory::ConnectionFactory()
-{
-    // Use default URI
-    brokerUri        = new Uri ("tcp://localhost:61616?wireFormat=openwire") ;
-    username         = NULL ;
-    password         = NULL ;
-    clientId         = Guid::getGuidString() ;
-    transportFactory = new TransportFactory() ;
-}
-
-/*
- *
- */
-ConnectionFactory::ConnectionFactory(p<Uri> brokerUri)
-{
-    this->brokerUri  = brokerUri;
-    username         = NULL ;
-    password         = NULL ;
-    clientId         = Guid::getGuidString() ;
-    transportFactory = new TransportFactory() ;
-}
-
-
-// --- Attribute methods --------------------------------------------
-
-/*
- *
- */
-p<Uri> ConnectionFactory::getBrokerUri()
-{
-     return brokerUri ;
-}
-
-/*
- *
- */
-void ConnectionFactory::setBrokerUri(p<Uri> brokerUri)
-{
-    this->brokerUri = brokerUri ;
-}
-
-/*
- *
- */
-p<string> ConnectionFactory::getUsername()
-{
-    return username ;
-}
-
-/*
- *
- */
-void ConnectionFactory::setUsername(const char* username)
-{
-    this->username = new string(username) ;
-}
-
-/*
- *
- */
-p<string> ConnectionFactory::getPassword()
-{
-    return password ;
-}
-
-/*
- *
- */
-void ConnectionFactory::setPassword(const char* password)
-{
-    this->password = new string(password);
-
-}
-
-/*
- *
- */
-p<string> ConnectionFactory::getClientId()
-{
-    return clientId ;
-}
-
-/*
- *
- */
-void ConnectionFactory::setClientId(const char* clientId)
-{
-    this->clientId = new string(clientId) ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- *
- */
-p<IConnection> ConnectionFactory::createConnection() throw (ConnectionException)
-{
-    return createConnection( (username != NULL) ? username->c_str() : NULL,
-                             (password != NULL) ? password->c_str() : NULL ) ;
-}
-
-/*
- *
- */
-p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) throw (ConnectionException)
-{
-    p<ConnectionInfo> connectionInfo ;
-    p<ITransport>     transport ;
-    p<Connection>     connection ;
-
-
-    // Set up a new connection object
-    connectionInfo = createConnectionInfo(username, password) ;
-    transport      = createTransport() ;
-    connection     = new Connection(transport, connectionInfo) ;
-    connection->setClientId( clientId->c_str() ) ;
-
-    return connection ;
-}
-
-
-// --- Implementation methods ---------------------------------------
-
-/*
- *
- */
-p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password)
-{
-    p<ConnectionInfo> connectionInfo = new ConnectionInfo() ;
-    p<ConnectionId>   connectionId   = new ConnectionId() ;
-    p<string>         uid = (username != NULL) ? new string(username) : NULL ;
-    p<string>         pwd = (password != NULL) ? new string(password) : NULL ;
-
-    connectionId->setValue( Guid::getGuidString() ) ;
-    connectionInfo->setConnectionId( connectionId ) ;
-    connectionInfo->setUserName( uid ) ;
-    connectionInfo->setPassword( pwd ) ;
-    connectionInfo->setClientId( clientId ) ;
-
-    return connectionInfo ;
-}
-
-/*
- *
- */
-p<ITransport> ConnectionFactory::createTransport() throw (ConnectionException)
-{
-    try
-    {
-    	// Create a transport for given URI
-        return transportFactory->createTransport( brokerUri ) ;
-    }
-    catch( SocketException se )
-    {
-        throw ConnectionException(__FILE__, __LINE__, "Failed to connect socket") ;
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/ConnectionFactory.hpp"
+#include "activemq/Connection.hpp"
+#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
+#include "activemq/transport/tcp/TcpTransport.hpp"
+
+using namespace apache::activemq;
+
+/*
+ *
+ */
+ConnectionFactory::ConnectionFactory()
+{
+    // Use default URI
+    brokerUri        = new Uri ("tcp://localhost:61616?wireFormat=openwire") ;
+    username         = NULL ;
+    password         = NULL ;
+    clientId         = Guid::getGuidString() ;
+    transportFactory = new TransportFactory() ;
+}
+
+/*
+ *
+ */
+ConnectionFactory::ConnectionFactory(p<Uri> brokerUri)
+{
+    this->brokerUri  = brokerUri;
+    username         = NULL ;
+    password         = NULL ;
+    clientId         = Guid::getGuidString() ;
+    transportFactory = new TransportFactory() ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+p<Uri> ConnectionFactory::getBrokerUri()
+{
+     return brokerUri ;
+}
+
+/*
+ *
+ */
+void ConnectionFactory::setBrokerUri(p<Uri> brokerUri)
+{
+    this->brokerUri = brokerUri ;
+}
+
+/*
+ *
+ */
+p<string> ConnectionFactory::getUsername()
+{
+    return username ;
+}
+
+/*
+ *
+ */
+void ConnectionFactory::setUsername(const char* username)
+{
+    this->username = new string(username) ;
+}
+
+/*
+ *
+ */
+p<string> ConnectionFactory::getPassword()
+{
+    return password ;
+}
+
+/*
+ *
+ */
+void ConnectionFactory::setPassword(const char* password)
+{
+    this->password = new string(password);
+
+}
+
+/*
+ *
+ */
+p<string> ConnectionFactory::getClientId()
+{
+    return clientId ;
+}
+
+/*
+ *
+ */
+void ConnectionFactory::setClientId(const char* clientId)
+{
+    this->clientId = new string(clientId) ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+p<IConnection> ConnectionFactory::createConnection() throw (ConnectionException)
+{
+    return createConnection( (username != NULL) ? username->c_str() : NULL,
+                             (password != NULL) ? password->c_str() : NULL ) ;
+}
+
+/*
+ *
+ */
+p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) throw (ConnectionException)
+{
+    p<ConnectionInfo> connectionInfo ;
+    p<ITransport>     transport ;
+    p<Connection>     connection ;
+
+
+    // Set up a new connection object
+    connectionInfo = createConnectionInfo(username, password) ;
+    transport      = createTransport() ;
+    connection     = new Connection(transport, connectionInfo) ;
+    connection->setClientId( clientId->c_str() ) ;
+
+    return connection ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password)
+{
+    p<ConnectionInfo> connectionInfo = new ConnectionInfo() ;
+    p<ConnectionId>   connectionId   = new ConnectionId() ;
+    p<string>         uid = (username != NULL) ? new string(username) : NULL ;
+    p<string>         pwd = (password != NULL) ? new string(password) : NULL ;
+
+    connectionId->setValue( Guid::getGuidString() ) ;
+    connectionInfo->setConnectionId( connectionId ) ;
+    connectionInfo->setUserName( uid ) ;
+    connectionInfo->setPassword( pwd ) ;
+    connectionInfo->setClientId( clientId ) ;
+
+    return connectionInfo ;
+}
+
+/*
+ *
+ */
+p<ITransport> ConnectionFactory::createTransport() throw (ConnectionException)
+{
+    try
+    {
+    	// Create a transport for given URI
+        return transportFactory->createTransport( brokerUri ) ;
+    }
+    catch( SocketException se )
+    {
+        throw ConnectionException(__FILE__, __LINE__, "Failed to connect socket") ;
+    }
+}

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.hpp Fri Jul 28 01:22:48 2006
@@ -1,88 +1,88 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_ConnectionFactory_hpp_
-#define ActiveMQ_ConnectionFactory_hpp_
-
-// Must be included before any STL includes
-#include "ppr/util/Guid.hpp"
-
-#include <string>
-#include "cms/IConnection.hpp"
-#include "cms/IConnectionFactory.hpp"
-#include "activemq/ConnectionException.hpp"
-#include "activemq/command/ConnectionInfo.hpp"
-#include "activemq/command/ConnectionId.hpp"
-#include "activemq/protocol/IProtocol.hpp"
-#include "activemq/transport/ITransport.hpp"
-#include "activemq/transport/ITransportFactory.hpp"
-#include "activemq/transport/TransportFactory.hpp"
-#include "ppr/net/Uri.hpp"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
-  namespace activemq
-  {
-      using namespace apache::activemq::command;
-      using namespace apache::activemq::protocol;
-      using namespace apache::activemq::transport;
-      using namespace apache::ppr::net;
-      using namespace ifr;
-
-/*
- * 
- */
-class ConnectionFactory : public IConnectionFactory
-{
-private:
-    p<Uri>               brokerUri ;
-    p<string>            username ;
-    p<string>            password ;
-    p<string>            clientId ;
-    p<IProtocol>         protocol ;
-    p<ITransportFactory> transportFactory ;
-
-public:
-    // Constructors
-    ConnectionFactory() ;
-    ConnectionFactory(p<Uri> uri) ;
-
-    // Attribute methods
-    virtual p<Uri> getBrokerUri() ;
-    virtual void setBrokerUri(p<Uri> brokerUri) ;
-    virtual p<string> getUsername() ;
-    virtual void setUsername(const char* username) ;
-    virtual p<string> getPassword() ;
-    virtual void setPassword(const char* password) ;
-    virtual p<string> getClientId() ;
-    virtual void setClientId(const char* clientId) ;
-
-    // Operation methods
-    virtual p<IConnection> createConnection() throw (ConnectionException) ;
-    virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) ;
-
-protected:
-    // Implementation methods
-    virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
-    virtual p<ITransport> createTransport() throw (ConnectionException) ;
-} ;
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_ConnectionFactory_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_ConnectionFactory_hpp_
+#define ActiveMQ_ConnectionFactory_hpp_
+
+// Must be included before any STL includes
+#include "ppr/util/Guid.hpp"
+
+#include <string>
+#include "cms/IConnection.hpp"
+#include "cms/IConnectionFactory.hpp"
+#include "activemq/ConnectionException.hpp"
+#include "activemq/command/ConnectionInfo.hpp"
+#include "activemq/command/ConnectionId.hpp"
+#include "activemq/protocol/IProtocol.hpp"
+#include "activemq/transport/ITransport.hpp"
+#include "activemq/transport/ITransportFactory.hpp"
+#include "activemq/transport/TransportFactory.hpp"
+#include "ppr/net/Uri.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+      using namespace apache::activemq::command;
+      using namespace apache::activemq::protocol;
+      using namespace apache::activemq::transport;
+      using namespace apache::ppr::net;
+      using namespace ifr;
+
+/*
+ * 
+ */
+class ConnectionFactory : public IConnectionFactory
+{
+private:
+    p<Uri>               brokerUri ;
+    p<string>            username ;
+    p<string>            password ;
+    p<string>            clientId ;
+    p<IProtocol>         protocol ;
+    p<ITransportFactory> transportFactory ;
+
+public:
+    // Constructors
+    ConnectionFactory() ;
+    ConnectionFactory(p<Uri> uri) ;
+
+    // Attribute methods
+    virtual p<Uri> getBrokerUri() ;
+    virtual void setBrokerUri(p<Uri> brokerUri) ;
+    virtual p<string> getUsername() ;
+    virtual void setUsername(const char* username) ;
+    virtual p<string> getPassword() ;
+    virtual void setPassword(const char* password) ;
+    virtual p<string> getClientId() ;
+    virtual void setClientId(const char* clientId) ;
+
+    // Operation methods
+    virtual p<IConnection> createConnection() throw (ConnectionException) ;
+    virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) ;
+
+protected:
+    // Implementation methods
+    virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
+    virtual p<ITransport> createTransport() throw (ConnectionException) ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_ConnectionFactory_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConnectionFactory.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.cpp Fri Jul 28 01:22:48 2006
@@ -1,29 +1,29 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/ConsumerClosedException.hpp"
-
-using namespace apache::activemq;
-
-/*
- * 
- */
-ConsumerClosedException::ConsumerClosedException(const char* message)
-    : CmsException(message)
-{
-    // no-op
-}
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/ConsumerClosedException.hpp"
+
+using namespace apache::activemq;
+
+/*
+ * 
+ */
+ConsumerClosedException::ConsumerClosedException(const char* message)
+    : CmsException(message)
+{
+    // no-op
+}
+

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.hpp Fri Jul 28 01:22:48 2006
@@ -1,41 +1,41 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_ConsumerClosedException_hpp_
-#define ActiveMQ_ConsumerClosedException_hpp_
-
-#include "cms/CmsException.hpp"
-
-namespace apache
-{
-  namespace activemq
-  {
-      using namespace apache::cms;
-
-/*
- * Signals that a consumer is being used when it is already closed.
- */
-class ConsumerClosedException : public CmsException
-{
-public:
-    ConsumerClosedException(const char* message) ;
-};
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_ConsumerClosedException_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_ConsumerClosedException_hpp_
+#define ActiveMQ_ConsumerClosedException_hpp_
+
+#include "cms/CmsException.hpp"
+
+namespace apache
+{
+  namespace activemq
+  {
+      using namespace apache::cms;
+
+/*
+ * Signals that a consumer is being used when it is already closed.
+ */
+class ConsumerClosedException : public CmsException
+{
+public:
+    ConsumerClosedException(const char* message) ;
+};
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_ConsumerClosedException_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ConsumerClosedException.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.cpp Fri Jul 28 01:22:48 2006
@@ -1,47 +1,47 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/DestinationFilter.hpp"
-
-using namespace apache::activemq;
-
-// Init static constants
-const char* DestinationFilter::ANY_DESCENDENT = ">" ;
-const char* DestinationFilter::ANY_CHILD      = "*" ;
-
-/*
- * 
- */
-DestinationFilter::DestinationFilter()
-{
-    // no-op
-}
-
-/*
- * 
- */
-DestinationFilter::~DestinationFilter()
-{
-    // no-op
-}
-
-/*
- * 
- */
-bool DestinationFilter::matches(p<ActiveMQMessage> message)
-{
-    return matches( message->getDestination() ) ; 
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/DestinationFilter.hpp"
+
+using namespace apache::activemq;
+
+// Init static constants
+const char* DestinationFilter::ANY_DESCENDENT = ">" ;
+const char* DestinationFilter::ANY_CHILD      = "*" ;
+
+/*
+ * 
+ */
+DestinationFilter::DestinationFilter()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+DestinationFilter::~DestinationFilter()
+{
+    // no-op
+}
+
+/*
+ * 
+ */
+bool DestinationFilter::matches(p<ActiveMQMessage> message)
+{
+    return matches( message->getDestination() ) ; 
+}

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.hpp Fri Jul 28 01:22:48 2006
@@ -1,52 +1,52 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_DestinationFilter_hpp_
-#define ActiveMQ_DestinationFilter_hpp_
-
-#include "activemq/command/ActiveMQMessage.hpp"
-#include "activemq/command/ActiveMQDestination.hpp"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
-  namespace activemq
-  {
-    using namespace ifr;
-    using namespace apache::activemq::command;
-
-/*
- * 
- */
-class DestinationFilter
-{
-public:
-    const static char* ANY_DESCENDENT ;
-    const static char* ANY_CHILD ;
-
-public:
-    DestinationFilter() ;
-    virtual ~DestinationFilter() ;
-
-    virtual bool matches(p<ActiveMQMessage> message) ;
-    virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
-};
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_DestinationFilter_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_DestinationFilter_hpp_
+#define ActiveMQ_DestinationFilter_hpp_
+
+#include "activemq/command/ActiveMQMessage.hpp"
+#include "activemq/command/ActiveMQDestination.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    using namespace ifr;
+    using namespace apache::activemq::command;
+
+/*
+ * 
+ */
+class DestinationFilter
+{
+public:
+    const static char* ANY_DESCENDENT ;
+    const static char* ANY_CHILD ;
+
+public:
+    DestinationFilter() ;
+    virtual ~DestinationFilter() ;
+
+    virtual bool matches(p<ActiveMQMessage> message) ;
+    virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
+};
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_DestinationFilter_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/DestinationFilter.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.cpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.cpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.cpp Fri Jul 28 01:22:48 2006
@@ -1,140 +1,140 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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 "activemq/Dispatcher.hpp"
-
-using namespace apache::activemq;
-
-/*
- * 
- */
-Dispatcher::Dispatcher()
-{
-    dispatchQueue = new queue< p<IMessage> > ;
-    redeliverList = new list< p<IMessage> > ;
-}
-
-/*
- * 
- */
-void Dispatcher::redeliverRolledBackMessages()
-{
-    LOCKED_SCOPE (mutex);
-
-    p<queue< p<IMessage> > > replacementQueue = new queue< p<IMessage> > ;
-    //(dispatchQueue->size() + redeliverList->size() ) ;
-
-    // Copy all messages to be redelivered to the new queue
-    while( !redeliverList->empty() )
-    {
-        replacementQueue->push( redeliverList->front() ) ;
-        redeliverList->pop_front() ;
-    }
-
-    // Copy all messages to be dispatched to the new queue
-    while( dispatchQueue->size() > 0 )
-    {
-        // Get first element in queue
-        p<IMessage> element = p_cast<IMessage> (dispatchQueue->front()) ;
-
-        // Remove first element from queue
-        dispatchQueue->pop() ;
-
-        // Add element to the new queue
-        replacementQueue->push(element) ;
-    }
-    // Switch to the new queue
-    dispatchQueue = replacementQueue ;
-
-    semaphore.notify() ;
-}
-
-/*
- * 
- */
-void Dispatcher::redeliver(p<IMessage> message)
-{
-    LOCKED_SCOPE (mutex);
-    redeliverList->push_back(message) ;
-}
-
-/*
- * 
- */
-void Dispatcher::enqueue(p<IMessage> message)
-{
-    LOCKED_SCOPE (mutex);
-    dispatchQueue->push(message) ;
-    semaphore.notify() ;
-}
-
-/*
- * 
- */
-p<IMessage> Dispatcher::dequeueNoWait()
-{
-    p<IMessage> msg = NULL ;
-
-    {
-        LOCKED_SCOPE (mutex);
-
-        if( dispatchQueue->size() > 0 )
-        {
-            msg = p_cast<IMessage> (dispatchQueue->front()) ;
-            dispatchQueue->pop() ;
-        }
-    }        
-    return msg ;
-}
-
-/*
- * 
- */
-p<IMessage> Dispatcher::dequeue(int timeout)
-{
-    p<IMessage> msg = NULL ;
-
-    {
-        LOCKED_SCOPE (mutex);
-
-        if( dispatchQueue->size() == 0 )
-            semaphore.wait(timeout) ;
-
-        if( dispatchQueue->size() > 0 )
-        {
-            msg = p_cast<IMessage> (dispatchQueue->front()) ;
-            dispatchQueue->pop() ;
-        }
-    }
-    return msg ;
-}
-
-/*
- * 
- */
-p<IMessage> Dispatcher::dequeue()
-{
-    p<IMessage> msg = NULL ;
-
-    {
-        LOCKED_SCOPE (mutex);
-
-        msg = p_cast<IMessage> (dispatchQueue->front()) ;
-        dispatchQueue->pop() ;
-    }
-
-    return msg ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 "activemq/Dispatcher.hpp"
+
+using namespace apache::activemq;
+
+/*
+ * 
+ */
+Dispatcher::Dispatcher()
+{
+    dispatchQueue = new queue< p<IMessage> > ;
+    redeliverList = new list< p<IMessage> > ;
+}
+
+/*
+ * 
+ */
+void Dispatcher::redeliverRolledBackMessages()
+{
+    LOCKED_SCOPE (mutex);
+
+    p<queue< p<IMessage> > > replacementQueue = new queue< p<IMessage> > ;
+    //(dispatchQueue->size() + redeliverList->size() ) ;
+
+    // Copy all messages to be redelivered to the new queue
+    while( !redeliverList->empty() )
+    {
+        replacementQueue->push( redeliverList->front() ) ;
+        redeliverList->pop_front() ;
+    }
+
+    // Copy all messages to be dispatched to the new queue
+    while( dispatchQueue->size() > 0 )
+    {
+        // Get first element in queue
+        p<IMessage> element = p_cast<IMessage> (dispatchQueue->front()) ;
+
+        // Remove first element from queue
+        dispatchQueue->pop() ;
+
+        // Add element to the new queue
+        replacementQueue->push(element) ;
+    }
+    // Switch to the new queue
+    dispatchQueue = replacementQueue ;
+
+    semaphore.notify() ;
+}
+
+/*
+ * 
+ */
+void Dispatcher::redeliver(p<IMessage> message)
+{
+    LOCKED_SCOPE (mutex);
+    redeliverList->push_back(message) ;
+}
+
+/*
+ * 
+ */
+void Dispatcher::enqueue(p<IMessage> message)
+{
+    LOCKED_SCOPE (mutex);
+    dispatchQueue->push(message) ;
+    semaphore.notify() ;
+}
+
+/*
+ * 
+ */
+p<IMessage> Dispatcher::dequeueNoWait()
+{
+    p<IMessage> msg = NULL ;
+
+    {
+        LOCKED_SCOPE (mutex);
+
+        if( dispatchQueue->size() > 0 )
+        {
+            msg = p_cast<IMessage> (dispatchQueue->front()) ;
+            dispatchQueue->pop() ;
+        }
+    }        
+    return msg ;
+}
+
+/*
+ * 
+ */
+p<IMessage> Dispatcher::dequeue(int timeout)
+{
+    p<IMessage> msg = NULL ;
+
+    {
+        LOCKED_SCOPE (mutex);
+
+        if( dispatchQueue->size() == 0 )
+            semaphore.wait(timeout) ;
+
+        if( dispatchQueue->size() > 0 )
+        {
+            msg = p_cast<IMessage> (dispatchQueue->front()) ;
+            dispatchQueue->pop() ;
+        }
+    }
+    return msg ;
+}
+
+/*
+ * 
+ */
+p<IMessage> Dispatcher::dequeue()
+{
+    p<IMessage> msg = NULL ;
+
+    {
+        LOCKED_SCOPE (mutex);
+
+        msg = p_cast<IMessage> (dispatchQueue->front()) ;
+        dispatchQueue->pop() ;
+    }
+
+    return msg ;
+}

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.hpp Fri Jul 28 01:22:48 2006
@@ -1,65 +1,65 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_Dispatcher_hpp_
-#define ActiveMQ_Dispatcher_hpp_
-
-#include <string>
-#include <list>
-#include <queue>
-#include "cms/IMessage.hpp"
-#include "activemq/command/Response.hpp"
-#include "ppr/thread/SimpleMutex.hpp"
-#include "ppr/thread/Semaphore.hpp"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
-  namespace activemq
-  {
-    using namespace ifr;
-    using namespace apache::activemq::command;
-    using namespace apache::cms;
-    using namespace apache::ppr::thread;
-
-/*
- * Handles the multi-threaded dispatching between transport and consumers.
- */
-class Dispatcher
-{
-private:
-    p<queue< p<IMessage> > > dispatchQueue ;
-    p<list< p<IMessage> > >  redeliverList ;
-    SimpleMutex              mutex ;
-    Semaphore                semaphore ;
-
-public:
-    Dispatcher() ;
-    virtual ~Dispatcher() {}
-
-    virtual void redeliverRolledBackMessages() ;
-    virtual void redeliver(p<IMessage> message) ;
-    virtual void enqueue(p<IMessage> message) ;
-    virtual p<IMessage> dequeueNoWait() ;
-    virtual p<IMessage> dequeue(int timeout) ;
-    virtual p<IMessage> dequeue() ;
-} ;
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_Dispatcher_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_Dispatcher_hpp_
+#define ActiveMQ_Dispatcher_hpp_
+
+#include <string>
+#include <list>
+#include <queue>
+#include "cms/IMessage.hpp"
+#include "activemq/command/Response.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    using namespace ifr;
+    using namespace apache::activemq::command;
+    using namespace apache::cms;
+    using namespace apache::ppr::thread;
+
+/*
+ * Handles the multi-threaded dispatching between transport and consumers.
+ */
+class Dispatcher
+{
+private:
+    p<queue< p<IMessage> > > dispatchQueue ;
+    p<list< p<IMessage> > >  redeliverList ;
+    SimpleMutex              mutex ;
+    Semaphore                semaphore ;
+
+public:
+    Dispatcher() ;
+    virtual ~Dispatcher() {}
+
+    virtual void redeliverRolledBackMessages() ;
+    virtual void redeliver(p<IMessage> message) ;
+    virtual void enqueue(p<IMessage> message) ;
+    virtual p<IMessage> dequeueNoWait() ;
+    virtual p<IMessage> dequeue(int timeout) ;
+    virtual p<IMessage> dequeue() ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_Dispatcher_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/Dispatcher.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/IAcknowledger.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/IAcknowledger.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/IAcknowledger.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/IAcknowledger.hpp Fri Jul 28 01:22:48 2006
@@ -1,45 +1,45 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_IAcknowledger_hpp_
-#define ActiveMQ_IAcknowledger_hpp_
-
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
-  namespace activemq
-  {
-    namespace command
-    {
-        class ActiveMQMessage ;
-    }
-    using namespace ifr;
-    using namespace apache::activemq::command;
-
-/*
- * Interface for message acknowledgers.
- */
-struct IAcknowledger : Interface
-{
-    virtual void acknowledge(p<ActiveMQMessage> message) = 0 ;
-} ;
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_IAcknowledger_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_IAcknowledger_hpp_
+#define ActiveMQ_IAcknowledger_hpp_
+
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace command
+    {
+        class ActiveMQMessage ;
+    }
+    using namespace ifr;
+    using namespace apache::activemq::command;
+
+/*
+ * Interface for message acknowledgers.
+ */
+struct IAcknowledger : Interface
+{
+    virtual void acknowledge(p<ActiveMQMessage> message) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_IAcknowledger_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/IAcknowledger.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ICommand.hpp
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ICommand.hpp?rev=426431&r1=426430&r2=426431&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ICommand.hpp (original)
+++ incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ICommand.hpp Fri Jul 28 01:22:48 2006
@@ -1,42 +1,42 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed 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_ICommand_hpp_
-#define ActiveMQ_ICommand_hpp_
-
-#include "activemq/IDataStructure.hpp"
-
-namespace apache
-{
-  namespace activemq
-  {
-
-/*
- * An OpenWire command
- */
-struct ICommand : IDataStructure
-{
-    virtual int getCommandId() = 0;
-    virtual void setCommandId(int value) = 0;
-    virtual bool getResponseRequired() = 0;
-    virtual void setResponseRequired(bool value) = 0;
-};
-
-/* namespace */
-  }
-}
-
-#endif /*ActiveMQ_ICommand_hpp_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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_ICommand_hpp_
+#define ActiveMQ_ICommand_hpp_
+
+#include "activemq/IDataStructure.hpp"
+
+namespace apache
+{
+  namespace activemq
+  {
+
+/*
+ * An OpenWire command
+ */
+struct ICommand : IDataStructure
+{
+    virtual int getCommandId() = 0;
+    virtual void setCommandId(int value) = 0;
+    virtual bool getResponseRequired() = 0;
+    virtual void setResponseRequired(bool value) = 0;
+};
+
+/* namespace */
+  }
+}
+
+#endif /*ActiveMQ_ICommand_hpp_*/

Propchange: incubator/activemq/branches/activemq-4.0/openwire-cpp/src/main/cpp/activemq/ICommand.hpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message