You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/06/17 23:06:44 UTC

svn commit: r548111 - in /activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire: OpenWireResponseBuilder.cpp OpenWireResponseBuilder.h

Author: tabish
Date: Sun Jun 17 14:06:42 2007
New Revision: 548111

URL: http://svn.apache.org/viewvc?view=rev&rev=548111
Log:
http://issues.apache.org/activemq/browse/AMQCPP-130

Adding start of OpenWireResponseBuilder

Added:
    activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.h

Added: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.cpp?view=auto&rev=548111
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.cpp Sun Jun 17 14:06:42 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "OpenWireResponseBuilder.h"
+
+//#include <activemq/connector/stomp/commands/ConnectCommand.h>
+//#include <activemq/connector/stomp/commands/ConnectedCommand.h>
+
+using namespace activemq;
+using namespace activemq::connector;
+using namespace activemq::connector::openwire;
+using namespace activemq::transport;
+
+////////////////////////////////////////////////////////////////////////////////
+Response* OpenWireResponseBuilder::buildResponse( const transport::Command* cmd ){
+
+    // If this command requires a response we don't know what it is
+    // so we throw an exception.
+    if( cmd->isResponseRequired() ) {
+
+        throw transport::CommandIOException( __FILE__, __LINE__,
+            "OpenWireResponseBuilder - unrecognized command" );
+    }
+
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Command* OpenWireResponseBuilder::buildIncomingCommand(
+    const transport::Command* cmd ){
+
+//    const commands::ConnectCommand* connectCommand =
+//        dynamic_cast<const commands::ConnectCommand*>(cmd);
+//
+//    if( connectCommand != NULL ){
+//        commands::ConnectedCommand* resp = new commands::ConnectedCommand();
+//        resp->setCorrelationId( connectCommand->getCommandId() );
+//
+//        if( connectCommand->getClientId() == NULL )
+//        {
+//            resp->setSessionId( sessionId );
+//        }
+//        else
+//        {
+//            resp->setSessionId( connectCommand->getClientId() );
+//        }
+//
+//        return resp;
+//    }
+
+    return NULL;
+}

Added: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.h?view=auto&rev=548111
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireResponseBuilder.h Sun Jun 17 14:06:42 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ACTIVEMQ_CONNECTOR_OPENWIRE_OPENWIRERESPONSEBUILDER_H_
+#define ACTIVEMQ_CONNECTOR_OPENWIRE_OPENWIRERESPONSEBUILDER_H_
+
+#include <activemq/transport/MockTransport.h>
+
+namespace activemq{
+namespace connector{
+namespace stomp{
+
+    class OpenWireResponseBuilder : public transport::MockTransport::ResponseBuilder{
+
+    private:
+
+        std::string sessionId;
+
+    public:
+
+        OpenWireResponseBuilder( const std::string& sessionId ){
+            this->sessionId = sessionId;
+        }
+
+        virtual ~OpenWireResponseBuilder(){}
+
+        virtual transport::Response* buildResponse( const transport::Command* cmd );
+        virtual transport::Command* buildIncomingCommand( const transport::Command* cmd );
+
+    };
+
+}}}
+
+#endif /*ACTIVEMQ_CONNECTOR_OPENWIRE_OPENWIRERESPONSEBUILDER_H_*/