You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/04/27 23:59:44 UTC

svn commit: r397654 [8/12] - in /incubator/activemq/trunk/openwire-cpp: ./ src/ src/command/ src/gram/ src/gram/java/ src/gram/java/org/ src/gram/java/org/apache/ src/gram/java/org/apache/activemq/ src/gram/java/org/apache/activemq/openwire/ src/gram/j...

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,80 @@
+/*
+ * 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_OpenWireFormat_hpp_
+#define ActiveMQ_OpenWireFormat_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include "activemq/IDataStructure.hpp"
+#include "activemq/command/WireFormatInfo.hpp"
+#include "activemq/protocol/IProtocol.hpp"
+#include "ppr/io/IOutputStream.hpp"
+#include "ppr/io/IInputStream.hpp"
+#include "ppr/io/IOException.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace protocol
+    {
+      namespace openwire
+      {
+          class OpenWireMarshaller ;
+      }
+      using namespace ifr;
+      using namespace apache::activemq;
+      using namespace apache::activemq::command;
+      using namespace apache::activemq::protocol::openwire;
+      using namespace apache::ppr::io;
+
+/*
+ * Represents the wire format.
+ */
+class OpenWireProtocol : public IProtocol
+{
+private:
+    p<OpenWireMarshaller> wireMarshaller ;
+    p<WireFormatInfo>     wireFormatInfo ;
+
+    static const char NULL_TYPE ;
+    static const int  PROTOCOL_VERSION ;
+
+    static const char MAGIC[8] ;
+
+public:
+    OpenWireProtocol() ;
+
+	virtual p<WireFormatInfo> getWireFormatInfo() ;
+	virtual bool getStackTraceEnabled() ;
+
+    virtual void handshake(p<ITransport> transport) ;
+	virtual void marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException) ;
+	virtual p<IDataStructure> unmarshal(p<IInputStream> reader) throw(IOException) ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_OpenWireFormat_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,142 @@
+/*
+ * 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/transport/CorrelatorFilter.hpp"
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ * 
+ */
+CorrelatorFilter::CorrelatorFilter(p<ITransport> next) :
+   TransportFilter(next)
+{
+    this->next          = next ;
+    this->nextCommandId = 0 ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ * 
+ */
+void CorrelatorFilter::oneway(p<ICommand> command)
+{
+    // Set command id and that no response is required
+    command->setCommandId( getNextCommandId() ) ;
+    command->setResponseRequired(false) ;
+
+    this->next->oneway(command) ;
+}
+
+/*
+ * 
+ */
+p<FutureResponse> CorrelatorFilter::asyncRequest(p<ICommand> command)
+{
+    // Set command id and that a response is required
+    command->setCommandId( getNextCommandId() ) ;
+    command->setResponseRequired(true) ;
+
+    // Register a future response holder with the command id
+    p<FutureResponse> future = new FutureResponse() ;
+    requestMap[command->getCommandId()] = future ;
+
+    // Transmit command
+    this->next->oneway(command) ;
+
+    return future ;
+}
+
+/*
+ * 
+ */
+p<Response> CorrelatorFilter::request(p<ICommand> command)
+{
+    p<FutureResponse> future = asyncRequest(command) ;
+    p<Response> response = future->getResponse() ;
+
+    if( response == NULL )
+    {
+        p<BrokerError> brokerError = new BrokerError() ;
+        brokerError->setMessage("Timed out waiting for response from broker") ;
+        throw BrokerException(brokerError) ;
+    }
+    else if ( response->getDataStructureType() == ExceptionResponse::TYPE )
+    {
+        p<ExceptionResponse> er = p_cast<ExceptionResponse> (response) ;
+        p<BrokerError> brokerError = er->getException() ;
+        throw BrokerException(brokerError) ;
+    }
+    return response ;
+}
+
+
+// --- Event methods ------------------------------------------------
+
+/*
+ * 
+ */
+void CorrelatorFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+{
+    if( command->getDataStructureType() == Response::TYPE )
+    {
+        p<Response>       response = p_cast<Response>(command) ;
+        p<FutureResponse> future = requestMap[response->getCorrelationId()] ;
+
+        if( future != NULL )
+        {
+            if( response->getDataStructureType() == ExceptionResponse::TYPE )
+            {
+                p<ExceptionResponse> er    = p_cast<ExceptionResponse> (response) ;
+                p<BrokerError> brokerError = er->getException() ;
+                
+                if( listener != NULL )
+                {
+                    BrokerException brokerException = BrokerException(brokerError) ;
+                    listener->onError(smartify(this), brokerException) ;
+                }
+            }
+            future->setResponse(response) ;
+        }
+        else
+            cout << "Unknown response ID: " << response->getCorrelationId() << endl ;
+    }
+    else
+    {
+        if( listener != NULL )
+            listener->onCommand(smartify(this), command) ;
+        else
+            cout << "ERROR: No handler available to process command: " << command->getDataStructureType() << endl ;
+    }
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ * 
+ */
+int CorrelatorFilter::getNextCommandId()
+{
+    // Wait for lock and then fetch next command id
+    LOCKED_SCOPE (mutex);
+    return (short) ++nextCommandId ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,66 @@
+/*
+ * 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_CorrelatorFilter_hpp_
+#define ActiveMQ_CorrelatorFilter_hpp_
+
+#include <iostream>
+#include "activemq/BrokerException.hpp"
+#include "activemq/command/Response.hpp"
+#include "activemq/command/ExceptionResponse.hpp"
+#include "activemq/transport/TransportFilter.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace apache::activemq;
+      using namespace apache::activemq::command;
+
+/*
+ * Interface for commands.
+ */
+class CorrelatorFilter : public TransportFilter
+{
+protected:
+    SimpleMutex                  mutex ;
+    map<int, p<FutureResponse> > requestMap ;
+    int                          nextCommandId ;
+
+public:
+    CorrelatorFilter(p<ITransport> next) ;
+    virtual ~CorrelatorFilter() {}
+
+	virtual void oneway(p<ICommand> command) ;
+	virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
+	virtual p<Response> request(p<ICommand> command) ;
+
+    virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+
+protected:
+    virtual int getNextCommandId() ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_CorrelatorFilter_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,80 @@
+/*
+ * 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/transport/FutureResponse.hpp"
+
+using namespace apache::activemq::transport;
+
+/*
+ * 
+ */
+FutureResponse::FutureResponse()
+{
+    complete  = false ;
+    response  = NULL ;
+    maxWait   = 3 ;
+    mutex     = new SimpleMutex() ;
+    semaphore = new Semaphore() ;
+}
+
+p<Response> FutureResponse::getResponse()
+{
+    // Wait for response to arrive
+    LOCKED_SCOPE (mutex);
+    while ( response == NULL )
+    {
+        LOCKED_SCOPE_UNLOCK;
+        semaphore->wait(maxWait); // BUG: Why have a max wait when what you do is just to wait again and again? //dafah
+        LOCKED_SCOPE_RELOCK;
+    }
+    return response ;
+}
+
+void FutureResponse::setResponse(p<Response> response)
+{
+    {
+        LOCKED_SCOPE (mutex);
+        this->response = response ;
+        complete       = true ;
+    }
+    // Signal that response has arrived
+    semaphore->notify() ;
+}
+
+bool FutureResponse::isCompleted()
+{
+    return complete ;
+}
+
+bool FutureResponse::getCompletedSynchronously()
+{
+    return false ;
+}
+
+p<SimpleMutex> FutureResponse::getAsyncWaitHandle()
+{
+    return mutex ;
+}
+
+p<Response> FutureResponse::getAsyncState()
+{
+    return response ;
+}
+
+void FutureResponse::setAsyncState(p<Response> response)
+{
+    setResponse( response ) ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/FutureResponse.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,66 @@
+/*
+ * 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_FutureResponse_hpp_
+#define ActiveMQ_FutureResponse_hpp_
+
+#include <string>
+#include "activemq/command/Response.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/thread/Semaphore.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace apache::activemq::command;
+      using namespace apache::ppr::thread;
+
+/*
+ * Interface for commands.
+ */
+class FutureResponse
+{
+private:
+    p<Response>    response ;
+    p<SimpleMutex> mutex ;
+    p<Semaphore>   semaphore ;
+    int            maxWait ;
+    bool           complete ;
+
+public:
+    FutureResponse() ;
+    virtual ~FutureResponse() {}
+
+    virtual p<Response> getResponse() ;
+    virtual void setResponse(p<Response> response) ;
+    virtual p<Response> getAsyncState() ;
+    virtual void setAsyncState(p<Response> response) ;
+    virtual p<SimpleMutex> getAsyncWaitHandle() ; // BUG: Shouldn't we return the semaphore here? What is it needed for? SHouldn't we require to use getResponse() instead? //dafah
+    virtual bool isCompleted() ;
+    virtual bool getCompletedSynchronously() ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_FutureResponse_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,51 @@
+/*
+ * 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_ICommandListener_hpp_
+#define ActiveMQ_ICommandListener_hpp_
+
+#include <exception>
+#include "activemq/ICommand.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace std;
+      using namespace apache::activemq;
+      using namespace apache::activemq::command;
+      using namespace apache::cms;
+      struct ITransport;
+
+/*
+ * 
+ */
+struct ICommandListener : Interface
+{
+    virtual void onCommand(p<ITransport> transport, p<ICommand> command) = 0 ;
+    virtual void onError(p<ITransport> transport, exception& error) = 0 ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_ICommandListener_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,56 @@
+/*
+ * 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_ITransport_hpp_
+#define ActiveMQ_ITransport_hpp_
+
+#include "cms/IStartable.hpp"
+#include "activemq/ICommand.hpp"
+#include "activemq/command/Response.hpp"
+#include "activemq/transport/FutureResponse.hpp"
+#include "activemq/transport/ICommandListener.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr ;
+      using namespace apache::cms;
+      using namespace apache::activemq;
+      using namespace apache::activemq::command;
+
+/*
+ * Represents the logical networking transport layer.
+ */
+struct ITransport : IStartable
+{
+    virtual void setCommandListener(p<ICommandListener> listener) = 0 ;
+    virtual p<ICommandListener> getCommandListener() = 0 ;
+
+    virtual void oneway(p<ICommand> command) = 0 ;
+	virtual p<FutureResponse> asyncRequest(p<ICommand> command) = 0 ;
+	virtual p<Response> request(p<ICommand> command) = 0 ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_ITransport_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransportFactory.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransportFactory.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransportFactory.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransportFactory.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,49 @@
+/*
+ * 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_ITransportFactory_hpp_
+#define ActiveMQ_ITransportFactory_hpp_
+
+#include "activemq/transport/ITransport.hpp"
+#include "ppr/IllegalArgumentException.hpp"
+#include "ppr/net/SocketException.hpp"
+#include "ppr/net/Uri.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr ;
+      using namespace apache::ppr;
+      using namespace apache::ppr::net;
+
+/*
+ * 
+ */
+struct ITransportFactory : Interface
+{
+	virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) = 0 ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_ITransportFactory_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,106 @@
+/*
+ * 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/transport/LoggingFilter.hpp"
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ * 
+ */
+LoggingFilter::LoggingFilter(p<ITransport> next) :
+    TransportFilter(next)
+{
+    this->next = next ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ * 
+ */
+void LoggingFilter::oneway(p<ICommand> command)
+{
+    int cmdid  = command->getCommandId(),
+        corrid = -1 ;
+
+    // Get correlation id if a response
+    if( command->getDataStructureType() == Response::TYPE )
+        corrid = p_cast<Response>(command)->getCorrelationId() ;
+
+    // Dump log entry
+    printf("Sending command: cmd.id = %d, corr.id = %d, type = %s\n",
+           cmdid, corrid, 
+           AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
+
+/*    cout << "Sending command: id = " <<
+            command->getCommandId() <<
+            ", type = " <<
+            AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
+            endl ;*/
+
+    this->next->oneway(command) ;
+}
+
+
+// --- Event methods ------------------------------------------------
+
+/*
+ * 
+ */
+void LoggingFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+{
+    if( command == NULL )
+        cout << "Received NULL command" << endl ;
+    else
+    {
+        int cmdid  = command->getCommandId(),
+            corrid = -1 ;
+
+        // Get correlation id if a response
+        if( command->getDataStructureType() == Response::TYPE )
+            corrid = p_cast<Response>(command)->getCorrelationId() ;
+
+        // Dump log entry
+        printf("Received command: cmd.id = %d, corr.id = %d, type = %s\n",
+               cmdid, corrid, 
+               AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
+
+/*        cout << "Recived command: id = " <<
+                command->getCommandId() <<
+                ", type = " <<
+                AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
+                endl ;*/
+    }
+
+    // Forward incoming command to "real" listener
+    this->listener->onCommand(transport, command) ;
+}
+
+/*
+ * 
+ */
+void LoggingFilter::onError(p<ITransport> transport, exception& error)
+{
+    cout << "Received exception = '" << error.what() << "'" << endl ;
+
+    // Forward incoming exception to "real" listener
+    this->listener->onError(transport, error) ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,57 @@
+/*
+ * 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_LoggingFilter_hpp_
+#define ActiveMQ_LoggingFilter_hpp_
+
+#include <iostream>
+#include <exception>
+#include "activemq/transport/TransportFilter.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace std;
+
+/*
+ * 
+ */
+class LoggingFilter : public TransportFilter
+{
+protected:
+    p<ITransport> next ;
+
+public:
+    LoggingFilter(p<ITransport> next) ;
+    virtual ~LoggingFilter() {}
+
+	virtual void oneway(p<ICommand> command) ;
+
+    virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+    virtual void onError(p<ITransport> transport, exception& error) ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_LoggingFilter_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,72 @@
+/*
+ * 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/transport/MutexFilter.hpp"
+
+using namespace apache::activemq::transport;
+
+// --- Constructors -------------------------------------------------
+
+/*
+ * 
+ */
+MutexFilter::MutexFilter(p<ITransport> next) :
+   TransportFilter(next)
+{
+    this->next = next ;
+}
+
+/*
+ * 
+ */
+MutexFilter::~MutexFilter()
+{
+    // Wait for transmission lock before disposal
+    LOCKED_SCOPE (mutex) ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ * 
+ */
+void MutexFilter::oneway(p<ICommand> command)
+{
+    // Wait for transmission lock and then transmit command
+    LOCKED_SCOPE (mutex) ;
+    this->next->oneway(command) ;
+}
+
+/*
+ * 
+ */
+p<FutureResponse> MutexFilter::asyncRequest(p<ICommand> command)
+{
+    // Wait for transmission lock and then transmit command
+    LOCKED_SCOPE (mutex) ;
+    return this->next->asyncRequest(command) ;
+}
+
+/*
+ * 
+ */
+p<Response> MutexFilter::request(p<ICommand> command)
+{
+    // Wait for transmission lock and then transmit command
+    LOCKED_SCOPE (mutex) ;
+    return this->next->request(command) ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,56 @@
+/*
+ * 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_MutexFilter_hpp_
+#define ActiveMQ_MutexFilter_hpp_
+
+#include "activemq/transport/TransportFilter.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace apache::ppr::thread;
+
+/*
+ * A filter transport which gaurds access to the next transport
+ * using a mutex.
+ */
+class MutexFilter : public TransportFilter
+{
+protected:
+    SimpleMutex mutex ;
+
+public:
+    MutexFilter(p<ITransport> next) ;
+    virtual ~MutexFilter() ;
+
+	virtual void oneway(p<ICommand> command) ;
+	virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
+	virtual p<Response> request(p<ICommand> command) ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_MutexFilter_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,91 @@
+/*
+ * 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/transport/TransportFactory.hpp"
+#include <cctype>
+#include <algorithm>
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+TransportFactory::TransportFactory()
+{
+    socketFactory = new SocketFactory() ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+p<ITransport> TransportFactory::createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException)
+{
+    p<ISocket>    socket ;
+    p<ITransport> transport ;
+    p<IProtocol>  protocol ;
+    string        uriString ;
+
+    // Make an URI all lower case string
+    uriString = location->toString() ;
+    std::transform(uriString.begin(), uriString.end(), uriString.begin(), (int(*)(int))tolower) ;  // The explicit cast is needed to compile on Linux
+
+    // Create and open socket
+    cout << "Opening socket to: " << location->host() << " on port " << location->port() << endl ;
+    socket = connect(location->host().c_str(), location->port()) ;
+
+    // Create wire protocol depending on specified query parameter
+    if( uriString.find("protocol=openwire") != string::npos )
+        protocol = new OpenWireProtocol() ;
+    else
+        throw IllegalArgumentException("Unknown or unspecified wire protocol") ;
+
+    // Create transport depending on specified URI scheme
+    if( uriString.find("tcp://") != string::npos )
+	    transport = new TcpTransport(socket, protocol) ;
+    else
+        throw IllegalArgumentException("Cannot create transport for unknown URI scheme") ;
+
+    // Chain logging filter is requested in URI query
+    if( uriString.find("trace=true") != string::npos )
+        transport = new LoggingFilter(transport) ;
+
+    // Chain correlator and mutext filters
+	transport = new CorrelatorFilter(transport) ;
+	transport = new MutexFilter(transport) ;
+
+	return transport ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+p<ISocket> TransportFactory::connect(const char* host, int port) throw (SocketException)
+{
+    p<ISocket> socket = socketFactory->createSocket() ;
+
+ 	// Try to connect socket to given address and port
+    socket->connect(host, port) ;
+    return socket ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,79 @@
+/*
+ * 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_TransportFactory_hpp_
+#define ActiveMQ_TransportFactory_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <string>
+#include "activemq/protocol/IProtocol.hpp"
+#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
+#include "activemq/transport/ITransport.hpp"
+#include "activemq/transport/ITransportFactory.hpp"
+#include "activemq/transport/LoggingFilter.hpp"
+#include "activemq/transport/MutexFilter.hpp"
+#include "activemq/transport/CorrelatorFilter.hpp"
+#include "activemq/transport/tcp/TcpTransport.hpp"
+#include "ppr/IllegalArgumentException.hpp"
+#include "ppr/net/ISocket.hpp"
+#include "ppr/net/Socket.hpp"
+#include "ppr/net/SocketException.hpp"
+#include "ppr/net/ISocketFactory.hpp"
+#include "ppr/net/SocketFactory.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr ;
+      using namespace std;
+      using namespace apache::activemq::protocol;
+      using namespace apache::activemq::protocol::openwire;
+      using namespace apache::activemq::transport::tcp;
+      using namespace apache::ppr::net;
+
+/*
+ * An implementation of ITransport that uses sockets to communicate with
+ * the broker.
+ */
+class TransportFactory : public ITransportFactory
+{
+private:
+    p<ISocketFactory> socketFactory ;
+
+public:
+    TransportFactory() ;
+    virtual ~TransportFactory() {}
+
+	virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) ;
+
+protected:
+    virtual p<ISocket> connect(const char* host, int port) throw (SocketException) ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_TransportFactory_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,112 @@
+/*
+ * 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/transport/TransportFilter.hpp"
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ * 
+ */
+TransportFilter::TransportFilter(p<ITransport> next)
+{
+    this->next     = next ;
+    this->listener = NULL ;
+
+    // Set us up as the command listener for next link in chain
+    next->setCommandListener( smartify(this) ) ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void TransportFilter::setCommandListener(p<ICommandListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<ICommandListener> TransportFilter::getCommandListener()
+{
+    return this->listener ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ * 
+ */
+void TransportFilter::start()
+{
+    if( listener == NULL )
+	    throw InvalidOperationException ("Command listener cannot be null when Start is called.") ;
+
+    // Start next link in chain
+    this->next->start() ;
+}
+
+/*
+ * 
+ */
+void TransportFilter::oneway(p<ICommand> command)
+{
+    this->next->oneway(command) ;
+}
+
+/*
+ * 
+ */
+p<FutureResponse> TransportFilter::asyncRequest(p<ICommand> command)
+{
+    return this->next->asyncRequest(command) ;
+}
+
+/*
+ * 
+ */
+p<Response> TransportFilter::request(p<ICommand> command)
+{
+    return this->next->request(command) ;
+}
+
+// --- Event methods ------------------------------------------------
+
+/*
+ * 
+ */
+void TransportFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+{
+    // Forward incoming command to "real" listener
+    this->listener->onCommand(transport, command) ;
+}
+
+/*
+ * 
+ */
+void TransportFilter::onError(p<ITransport> transport, exception& error)
+{
+    // Forward incoming exception to "real" listener
+    this->listener->onError(transport, error) ;
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,66 @@
+/*
+ * 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_TransportFilter_hpp_
+#define ActiveMQ_TransportFilter_hpp_
+
+#include <string>
+#include "activemq/command/Response.hpp"
+#include "activemq/transport/ITransport.hpp"
+#include "ppr/InvalidOperationException.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      using namespace ifr;
+      using namespace apache::activemq::command;
+      using namespace apache::ppr;
+
+/*
+ * 
+ */
+class TransportFilter : public ITransport, public ICommandListener
+{
+protected:
+    p<ITransport>       next ;
+    p<ICommandListener> listener ;
+
+public:
+    TransportFilter(p<ITransport> next) ;
+    virtual ~TransportFilter() {}
+
+    virtual void setCommandListener(p<ICommandListener> listener) ;
+    virtual p<ICommandListener> getCommandListener() ;
+
+	virtual void start() ;
+	virtual void oneway(p<ICommand> command) ;
+	virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
+	virtual p<Response> request(p<ICommand> command) ;
+
+    virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+    virtual void onError(p<ITransport> transport, exception& error) ;
+} ;
+
+/* namespace */
+    }
+  }
+}
+
+#endif /*ActiveMQ_TransportFilter_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,157 @@
+/*
+ * 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/transport/tcp/TcpTransport.hpp"
+
+using namespace std;
+using namespace apache::activemq::transport::tcp;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+TcpTransport::TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol)
+{
+    // Initialize members
+    this->socket     = socket ;
+    this->protocol   = wireProtocol ;
+    this->reader     = NULL ;
+    this->writer     = NULL ;
+    this->listener   = NULL ;
+    this->readThread = NULL ;
+    this->started    = false ;
+    this->closed     = false ;
+}
+
+/*
+ *
+ */
+TcpTransport::~TcpTransport()
+{
+    closed = true ;
+    readThread->join() ;
+    reader->close() ;
+    socket->close() ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::setCommandListener(p<ICommandListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<ICommandListener> TcpTransport::getCommandListener()
+{
+    return this->listener ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::start()
+{
+    if( !started )
+    {
+        // Must have a command listener
+        if( listener == NULL )
+			throw InvalidOperationException("Command listener cannot be null when TCP transport start is called.") ;
+
+        started = true ;
+
+        // Create the I/O streams
+        writer = new SocketOutputStream(socket) ;
+        reader = new SocketInputStream(socket) ;
+        
+        // Create and start the background read thread
+        readThread = new ReadThread(this) ;
+        readThread->start() ;
+
+        // Ask protocol handler to handshake
+        protocol->handshake( smartify(this) ) ;
+    }
+}
+
+/*
+ *
+ */
+void TcpTransport::oneway(p<ICommand> command)
+{
+    protocol->marshal(command, writer) ;
+    writer->flush() ;
+}
+
+/*
+ *
+ */
+p<FutureResponse> TcpTransport::asyncRequest(p<ICommand> command)
+{
+    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
+}
+
+/*
+ *
+ */
+p<Response> TcpTransport::request(p<ICommand> command)
+{
+    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::readLoop()
+{
+    // Continue loop until closed or aborted
+    while( !closed )
+    {
+        p<ICommand> command = NULL ;
+
+        try
+        {
+            // Read next command
+            command = p_cast<ICommand> (protocol->unmarshal(reader)) ;
+
+            // Forward to command listener
+
+            listener->onCommand(smartify(this), command) ;
+        }
+        catch( exception& e )
+        {
+            // Socket closed or error
+            if( !closed )
+                listener->onError(smartify(this), e) ;
+
+            cout << "Exiting read loop due to exception: " << e.what() << endl ;
+            break ;
+        }
+    }
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,128 @@
+/*
+ * 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_TcpTransport_hpp_
+#define ActiveMQ_TcpTransport_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <iostream>
+#include <map>
+#include "cms/CmsException.hpp"
+#include "activemq/BrokerException.hpp"
+#include "activemq/ICommand.hpp"
+#include "activemq/command/BaseCommand.hpp"
+#include "activemq/command/Response.hpp"
+#include "activemq/command/ExceptionResponse.hpp"
+#include "activemq/protocol/IProtocol.hpp"
+#include "activemq/transport/FutureResponse.hpp"
+#include "activemq/transport/ITransport.hpp"
+#include "activemq/transport/ICommandListener.hpp"
+#include "ppr/InvalidOperationException.hpp"
+#include "ppr/io/SocketInputStream.hpp"
+#include "ppr/io/SocketOutputStream.hpp"
+#include "ppr/net/ISocket.hpp"
+#include "ppr/net/Socket.hpp"
+#include "ppr/net/SocketException.hpp"
+#include "ppr/net/ISocketFactory.hpp"
+#include "ppr/net/SocketFactory.hpp"
+#include "ppr/thread/SimpleMutex.hpp"
+#include "ppr/thread/Thread.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace activemq
+  {
+    namespace transport
+    {
+      namespace tcp
+      {
+        using namespace ifr ;
+        using namespace std;
+        using namespace apache::activemq;
+        using namespace apache::activemq::command;
+        using namespace apache::activemq::protocol;
+        using namespace apache::ppr;
+        using namespace apache::ppr::io;
+        using namespace apache::ppr::net;
+        using namespace apache::ppr::thread;
+        using namespace apache::ppr::util;
+        class ReadThread ;
+
+/*
+ * An implementation of ITransport that uses TCP to communicate with
+ * the broker.
+ */
+class TcpTransport : public ITransport
+{
+private:
+    p<IProtocol>                 protocol ;
+    p<SocketInputStream>         reader ;
+    p<SocketOutputStream>        writer ;
+    p<ICommandListener>          listener ;
+    p<ReadThread>                readThread ;
+    p<ISocket>                   socket ;
+    bool                         closed,
+                                 started ;
+
+public:
+    TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol) ;
+    virtual ~TcpTransport() ;
+
+    virtual void setCommandListener(p<ICommandListener> listener) ;
+    virtual p<ICommandListener> getCommandListener() ;
+
+    virtual void start() ;
+    virtual void oneway(p<ICommand> command) ;
+    virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
+    virtual p<Response> request(p<ICommand> command) ;
+
+public:
+    void readLoop() ;
+} ;
+
+/*
+ * 
+ */
+class ReadThread : public Thread
+{
+private:
+    TcpTransport* transport ;
+
+public:
+    ReadThread(TcpTransport* transport)
+    {
+        this->transport = transport ;
+    }
+
+protected:
+    virtual void run() throw(p<exception>)
+    {
+        transport->readLoop() ;
+    }
+} ;
+
+/* namespace */
+      }
+    }
+  }
+}
+
+#endif /*ActiveMQ_TcpTransport_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,46 @@
+/*
+ * 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 "cms/CmsException.hpp"
+
+using namespace apache::cms;
+
+
+/*
+ *
+ */
+CmsException::CmsException()
+     : msg("")
+{
+    // no-op
+}
+
+/*
+ *
+ */
+CmsException::CmsException(const char* message)
+     : msg(message)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+CmsException::~CmsException () throw ()
+{
+    // no-op
+}

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,51 @@
+/*
+ * 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 Cms_CmsException_hpp_
+#define Cms_CmsException_hpp_
+
+#include <exception>
+#include <string>
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace std;
+
+/*
+ * 
+ */
+class CmsException : public exception
+{
+protected:
+    string msg;
+
+public:
+    CmsException() ;
+    CmsException(const char* message) ;
+    virtual ~CmsException() throw();
+
+    virtual const char* what() const throw () {
+      return msg.c_str();
+    }
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_CmsException_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IBytesMessage.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IBytesMessage.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IBytesMessage.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IBytesMessage.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,70 @@
+/*
+ * 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 Cms_IBytesMessage_hpp_
+#define Cms_IBytesMessage_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <string>
+#include "cms/IMessage.hpp"
+#include "cms/MessageEOFException.hpp"
+#include "cms/MessageNotReadableException.hpp"
+#include "cms/MessageNotWritableException.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace std;
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct IBytesMessage : IMessage
+{
+    //virtual int getBodyLength() = 0;
+    virtual void reset() = 0 ;
+    virtual char readByte() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual int readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual int readInt() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual short readShort() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+    virtual void writeBoolean(bool value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeByte(char value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeBytes(char* value, int index, int length) throw (MessageNotWritableException) = 0 ;
+    virtual void writeDouble(double value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeFloat(float value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeInt(int value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeLong(long long value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeShort(short value) throw (MessageNotWritableException) = 0 ;
+    virtual void writeUTF(const char* value) throw (MessageNotWritableException) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IBytesMessage_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnection.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnection.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnection.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnection.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,55 @@
+/*
+ * 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 Cms_IConnection_hpp_
+#define Cms_IConnection_hpp_
+
+#include "cms/ISession.hpp"
+#include "cms/CmsException.hpp"
+#include "activemq/AcknowledgementMode.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 cms
+  {
+    using namespace ifr;
+    using namespace apache::activemq;
+
+/*
+ * 
+ */
+struct IConnection : Interface
+{
+    virtual p<ISession> createSession() throw(CmsException) = 0 ;
+    virtual p<ISession> createSession(AcknowledgementMode ackMode) throw(CmsException) = 0 ;
+    virtual p<string> getClientId() = 0 ;
+    virtual void setClientId(const char* value) throw (CmsException) = 0 ;
+    virtual AcknowledgementMode getAcknowledgementMode() = 0 ;
+    virtual void setAcknowledgementMode(AcknowledgementMode mode) = 0 ;
+    virtual void close() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IConnection_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnectionFactory.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnectionFactory.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnectionFactory.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IConnectionFactory.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,44 @@
+/*
+ * 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 Cms_IConnectionFactory_hpp_
+#define Cms_IConnectionFactory_hpp_
+
+#include <string>
+#include "cms/IConnection.hpp"
+#include "activemq/ConnectionException.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct IConnectionFactory : Interface
+{
+    virtual p<IConnection> createConnection() throw (ConnectionException) = 0 ;
+    virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IConnectionFactory_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IDestination.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IDestination.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IDestination.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IDestination.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,39 @@
+/*
+ * 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 Cms_IDestination_hpp_
+#define Cms_IDestination_hpp_
+
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * Top interface for all message destinations.
+ */
+struct IDestination : Interface
+{
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IDestination_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IExceptionListener.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IExceptionListener.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IExceptionListener.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IExceptionListener.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +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 Cms_IExceptionListener_hpp_
+#define Cms_IExceptionListener_hpp_
+
+#include <exception>
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+    using namespace std;
+
+/*
+ * 
+ */
+struct IExceptionListener : Interface
+{
+    virtual void onException(exception& error) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IExceptionListener_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMapMessage.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMapMessage.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMapMessage.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMapMessage.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,48 @@
+/*
+ * 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 Cms_IMapMessage_hpp_
+#define Cms_IMapMessage_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include "cms/IMessage.hpp"
+#include "ppr/util/MapItemHolder.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace apache::ppr::util;
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct IMapMessage : IMessage
+{
+    virtual p<PropertyMap> getBody() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IMapMessage_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessage.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessage.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessage.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessage.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,111 @@
+/*
+ * 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 Cms_IMessage_hpp_
+#define Cms_IMessage_hpp_
+
+#include <string>
+#include "cms/IDestination.hpp"
+#include "ppr/util/MapItemHolder.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace apache::ppr::util;
+    using namespace ifr;
+    using namespace std;
+
+/*
+ * Represents a message either to be sent to a message broker
+ * or received from a message broker.
+ */
+struct IMessage : Interface
+{
+    // If using client acknowledgement mode on the session then
+    // this method will acknowledge that the message has been
+    // processed correctly.
+    virtual void acknowledge() = 0 ;
+
+    // Provides access to the message properties (headers).
+    virtual p<PropertyMap> getProperties() = 0 ;
+
+    // The correlation ID used to correlate messages from
+    // conversations or long running business processes.
+    virtual p<string> getJMSCorrelationID() = 0 ;
+    virtual void setJMSCorrelationID(const char* correlationId) = 0 ;
+
+    // The destination of the message.
+    virtual p<IDestination> getJMSDestination() = 0 ;
+
+    // The time in milliseconds that this message should expire.
+    virtual long long getJMSExpiration() = 0 ;
+    virtual void setJMSExpiration(long long time) = 0 ;
+
+    // The message ID which is set by the provider.
+    virtual p<string> getJMSMessageID() = 0 ;
+
+    // Whether or not this message is persistent.
+    virtual bool getJMSPersistent() = 0 ;
+    virtual void setJMSPersistent(bool persistent) = 0 ;
+
+    // The priority on this message.
+    virtual unsigned char getJMSPriority() = 0 ;
+    virtual void setJMSPriority(unsigned char priority) = 0 ;
+
+    // Returns true if this message has been redelivered to this
+    // or another consumer before being acknowledged successfully.
+    virtual bool getJMSRedelivered() = 0 ;
+
+    // The destination that the consumer of this message should
+    // send replies to.
+    virtual p<IDestination> getJMSReplyTo() = 0 ;
+    virtual void setJMSReplyTo(p<IDestination> destination) = 0 ;
+
+    // The timestamp the broker added to the message.
+    virtual long long getJMSTimestamp() = 0 ;
+
+    // The type name of this message.
+    virtual p<string> getJMSType() = 0 ;
+    virtual void setJMSType(const char* type) = 0 ;
+
+    //
+    // JMS Extension Headers
+
+    // Returns the number of times this message has been redelivered
+    // to other consumers without being acknowledged successfully.
+    virtual int getJMSXDeliveryCount() = 0 ;
+
+    // The message group ID is used to group messages together to the
+    // same consumer for the same group ID value.
+    virtual p<string> getJMSXGroupID() = 0 ;
+    virtual void setJMSXGroupID(const char* groupId) = 0 ;
+
+    // The message group sequence counter to indicate the position
+    // in a group.
+    virtual int getJMSXGroupSeq() = 0 ;
+    virtual void setJMSXGroupSeq(int sequence) = 0 ;
+
+    // Returns the ID of the producers transaction.
+    virtual p<string> getJMSXProducerTxID() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IMessage_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageConsumer.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageConsumer.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageConsumer.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageConsumer.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,49 @@
+/*
+ * 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 Cms_IMessageConsumer_hpp_
+#define Cms_IMessageConsumer_hpp_
+
+#include <string>
+#include "cms/IMessage.hpp"
+#include "cms/IMessageListener.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct IMessageConsumer : Interface
+{
+    virtual void setMessageListener(p<IMessageListener> listener) = 0 ;
+    virtual p<IMessageListener> getMessageListener() = 0 ;
+    virtual p<IMessage> receive() = 0 ;
+    virtual p<IMessage> receive(int timeout) = 0 ;
+    virtual p<IMessage> receiveNoWait() = 0 ;
+
+    virtual void close() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IMessageConsumer_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageListener.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageListener.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageListener.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageListener.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +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 Cms_IMessageListener_hpp_
+#define Cms_IMessageListener_hpp_
+
+#include "cms/IMessage.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct IMessageListener : Interface
+{
+    virtual void onMessage(p<IMessage> message) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IMessageListener_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageProducer.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageProducer.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageProducer.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IMessageProducer.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,60 @@
+/*
+ * 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 Cms_IMessageProducer_hpp_
+#define Cms_IMessageProducer_hpp_
+
+#include <string>
+#include "cms/IDestination.hpp"
+#include "cms/IMessage.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * An object capable of sending messages to some destination.
+ */
+struct IMessageProducer : Interface
+{
+    // Sends the message to the default destination for this producer.
+    virtual void send(p<IMessage> message) = 0 ;
+
+    // Sends the message to the given destination.
+    virtual void send(p<IDestination> destination, p<IMessage> message) = 0 ;
+
+    virtual void close() = 0 ;
+
+	virtual bool getPersistent() = 0 ;
+	virtual void setPersistent(bool persistent) = 0 ;
+    virtual long long getTimeToLive() = 0 ;
+    virtual void getTimeToLive(long long ttl) = 0 ;
+    virtual int getPriority() = 0 ;
+    virtual void getPriority(int priority) = 0 ;
+    virtual bool getDisableMessageID() = 0 ;
+    virtual void getDisableMessageID(bool disable) = 0 ;
+    virtual bool getDisableMessageTimestamp() = 0 ;
+    virtual void getDisableMessageTimestamp(bool disable) = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IMessageProducer_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IQueue.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IQueue.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IQueue.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IQueue.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,43 @@
+/*
+ * 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 Cms_IQueue_hpp_
+#define Cms_IQueue_hpp_
+
+#include <string>
+#include "cms/IDestination.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+    using namespace std;
+
+/*
+ * 
+ */
+struct IQueue : IDestination
+{
+    virtual p<string> getQueueName() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IQueue_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ISession.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ISession.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ISession.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ISession.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,68 @@
+/*
+ * 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 Cms_ISession_hpp_
+#define Cms_ISession_hpp_
+
+#include "cms/IDestination.hpp"
+#include "cms/IMessageProducer.hpp"
+#include "cms/IMessageConsumer.hpp"
+#include "cms/IQueue.hpp"
+#include "cms/ITopic.hpp"
+#include "cms/ITemporaryQueue.hpp"
+#include "cms/ITemporaryTopic.hpp"
+#include "cms/ITextMessage.hpp"
+#include "cms/IBytesMessage.hpp"
+#include "cms/IMapMessage.hpp"
+#include "cms/CmsException.hpp"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+
+/*
+ * 
+ */
+struct ISession : Interface
+{
+    virtual void commit() throw(CmsException) = 0 ;
+    virtual void rollback() throw(CmsException) = 0 ;
+    virtual p<IQueue> getQueue(const char* name) = 0 ;
+    virtual p<ITopic> getTopic(const char* name) = 0 ;
+    virtual p<IMessageProducer> createProducer() = 0 ;
+    virtual p<IMessageProducer> createProducer(p<IDestination> destination) = 0 ;
+    virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) = 0 ;
+    virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) = 0 ;
+    virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) = 0 ;
+    virtual p<ITemporaryQueue> createTemporaryQueue() = 0 ;
+    virtual p<ITemporaryTopic> createTemporaryTopic() = 0 ;
+    virtual p<IMessage> createMessage() = 0 ;
+    virtual p<IBytesMessage> createBytesMessage() = 0 ;
+    virtual p<IBytesMessage> createBytesMessage(char* body, int size) = 0 ;
+    virtual p<IMapMessage> createMapMessage() = 0 ;
+    virtual p<ITextMessage> createTextMessage() = 0 ;
+    virtual p<ITextMessage> createTextMessage(const char* text) = 0 ;
+    virtual void close() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_ISession_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IStartable.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IStartable.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IStartable.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/IStartable.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,39 @@
+/*
+ * 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 Cms_IStartable_hpp_
+#define Cms_IStartable_hpp_
+
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+  namespace cms
+  {
+    using namespace ifr;
+/*
+ * 
+ */
+struct IStartable : Interface
+{
+	virtual void start() = 0 ;
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_IStartable_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryQueue.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryQueue.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryQueue.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryQueue.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,38 @@
+/*
+ * 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 Cms_ITemporaryQueue_hpp_
+#define Cms_ITemporaryQueue_hpp_
+
+#include "cms/IDestination.hpp"
+
+namespace apache
+{
+  namespace cms
+  {
+
+/*
+ * 
+ */
+struct ITemporaryQueue : IDestination
+{
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_ITemporaryQueue_hpp_*/

Added: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryTopic.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryTopic.hpp?rev=397654&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryTopic.hpp (added)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/ITemporaryTopic.hpp Thu Apr 27 14:59:28 2006
@@ -0,0 +1,38 @@
+/*
+ * 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 Cms_ITemporaryTopic_hpp_
+#define Cms_ITemporaryTopic_hpp_
+
+#include "cms/IDestination.hpp"
+
+namespace apache
+{
+  namespace cms
+  {
+
+/*
+ * 
+ */
+struct ITemporaryTopic : IDestination
+{
+} ;
+
+/* namespace */
+  }
+}
+
+#endif /*Cms_ITemporaryTopic_hpp_*/