qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r577048 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/broker: Connection.h ConnectionAdapter.cpp ConnectionAdapter.h
Date Tue, 18 Sep 2007 20:42:37 GMT
Author: aconway
Date: Tue Sep 18 13:42:36 2007
New Revision: 577048

URL: http://svn.apache.org/viewvc?rev=577048&view=rev
Log:

Eliminate ChannelAdapter from broker code.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.h

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h?rev=577048&r1=577047&r2=577048&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h Tue Sep 18 13:42:36 2007
@@ -29,7 +29,6 @@
 #include "qpid/framing/AMQFrame.h"
 #include "qpid/framing/AMQP_ServerOperations.h"
 #include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/ChannelAdapter.h"
 #include "qpid/sys/ConnectionOutputHandler.h"
 #include "qpid/sys/ConnectionInputHandler.h"
 #include "qpid/sys/TimeoutHandler.h"

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.cpp?rev=577048&r1=577047&r2=577048&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.cpp Tue Sep 18 13:42:36
2007
@@ -22,17 +22,13 @@
 
 #include "ConnectionAdapter.h"
 #include "Connection.h"
-#include "qpid/framing/ChannelAdapter.h"
+#include "qpid/framing/ConnectionStartBody.h"
 
 using namespace qpid;
 using namespace qpid::broker;
-using qpid::framing::ReplyCode;
-using qpid::framing::ClassId;
-using qpid::framing::MethodId;
-using qpid::framing::FieldTable;
+using namespace qpid::framing;
 
 void ConnectionAdapter::init(const framing::ProtocolInitiation& header) {
-    ChannelAdapter::init(0, handler->connection.getOutput(), handler->connection.getVersion());
     FieldTable properties;
     string mechanisms("PLAIN");
     string locales("en_US");
@@ -44,16 +40,6 @@
     handler->client.close(code, text, classId, methodId);
 }
 
-void ConnectionAdapter::handleMethod(framing::AMQMethodBody* method)
-{
-    try{
-        method->invoke(*this);
-    }catch(ConnectionException& e){
-        handler->client.close(e.code, e.toString(), method->amqpClassId(), method->amqpMethodId());
-    }catch(std::exception& e){
-        handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(),
method->amqpMethodId());
-    }
-}
 
 framing::AMQP_ServerOperations::ConnectionHandler* ConnectionAdapter::getConnectionHandler()

 { 
@@ -67,17 +53,19 @@
 
 void ConnectionAdapter::handle(framing::AMQFrame& frame)
 {
-    getHandlers().in(frame);
-}
-
-ConnectionAdapter::ConnectionAdapter(Connection& connection) 
-{
-    handler = std::auto_ptr<Handler>(new Handler(connection, *this));
+    AMQMethodBody* method=frame.getBody()->getMethod();
+    try{
+        method->invoke(*this);
+    }catch(ConnectionException& e){
+        handler->client.close(e.code, e.toString(), method->amqpClassId(), method->amqpMethodId());
+    }catch(std::exception& e){
+        handler->client.close(541/*internal error*/, e.what(), method->amqpClassId(),
method->amqpMethodId());
+    }
 }
 
-ConnectionAdapter::Handler:: Handler(Connection& c, ConnectionAdapter& a) : 
-    proxy(a.getHandlers().out), client(proxy.getConnection()), connection(c) {}
+ConnectionAdapter::ConnectionAdapter(Connection& connection)  : handler(new Handler(connection))
{}
 
+ConnectionAdapter::Handler:: Handler(Connection& c) : client(c.getOutput()), connection(c)
{}
 
 void ConnectionAdapter::Handler::startOk(const FieldTable& /*clientProperties*/,
     const string& /*mechanism*/, 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.h?rev=577048&r1=577047&r2=577048&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionAdapter.h Tue Sep 18 13:42:36
2007
@@ -26,7 +26,7 @@
 #include "qpid/framing/AMQFrame.h"
 #include "qpid/framing/AMQP_ServerOperations.h"
 #include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/ChannelAdapter.h"
+#include "qpid/framing/FrameHandler.h"
 #include "qpid/framing/ProtocolInitiation.h"
 #include "qpid/framing/ProtocolVersion.h"
 #include "qpid/Exception.h"
@@ -36,15 +36,15 @@
 
 class Connection;
 
-class ConnectionAdapter : public framing::ChannelAdapter, public framing::AMQP_ServerOperations
+// TODO aconway 2007-09-18: Rename to ConnectionHandler
+class ConnectionAdapter : public framing::FrameHandler, public framing::AMQP_ServerOperations
 {
     struct Handler : public framing::AMQP_ServerOperations::ConnectionHandler
     {
-        framing::AMQP_ClientProxy proxy;
         framing::AMQP_ClientProxy::Connection client;
         Connection& connection;
     
-        Handler(Connection& connection, ConnectionAdapter& adapter);
+        Handler(Connection& connection);
         void startOk(const qpid::framing::FieldTable& clientProperties,
                      const std::string& mechanism, const std::string& response,
                      const std::string& locale); 
@@ -62,14 +62,6 @@
     void init(const framing::ProtocolInitiation& header);
     void close(framing::ReplyCode code, const std::string& text, framing::ClassId classId,
framing::MethodId methodId);
     void handle(framing::AMQFrame& frame);
-
-    //ChannelAdapter virtual methods:
-    void handleMethod(framing::AMQMethodBody* method);
-    bool isOpen() const { return true; } //channel 0 is always open
-    //never needed:
-    void handleHeader(framing::AMQHeaderBody*) {}
-    void handleContent(framing::AMQContentBody*) {}
-    void handleHeartbeat(framing::AMQHeartbeatBody*) {}
 
     //AMQP_ServerOperations:
     ConnectionHandler* getConnectionHandler();



Mime
View raw message