You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/10/01 22:04:53 UTC

svn commit: r1628825 - /qpid/proton/branches/examples/tutorial/

Author: gsim
Date: Wed Oct  1 20:04:52 2014
New Revision: 1628825

URL: http://svn.apache.org/r1628825
Log:
change local- and remote- endpoint event handler method names

Modified:
    qpid/proton/branches/examples/tutorial/client.py
    qpid/proton/branches/examples/tutorial/client_http.py
    qpid/proton/branches/examples/tutorial/helloworld.py
    qpid/proton/branches/examples/tutorial/helloworld_alt.py
    qpid/proton/branches/examples/tutorial/helloworld_direct.py
    qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py
    qpid/proton/branches/examples/tutorial/helloworld_direct_tornado.py
    qpid/proton/branches/examples/tutorial/helloworld_tornado.py
    qpid/proton/branches/examples/tutorial/proton_events.py
    qpid/proton/branches/examples/tutorial/proton_server.py
    qpid/proton/branches/examples/tutorial/server.py

Modified: qpid/proton/branches/examples/tutorial/client.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/client.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/client.py (original)
+++ qpid/proton/branches/examples/tutorial/client.py Wed Oct  1 20:04:52 2014
@@ -33,7 +33,7 @@ class Client(IncomingMessageHandler):
         req = Message(reply_to=self.receiver.remote_source.address, body=self.requests[0])
         self.sender.send_msg(req)
 
-    def on_link_remote_open(self, event):
+    def on_link_open(self, event):
         self.next_request()
 
     def on_message(self, event):

Modified: qpid/proton/branches/examples/tutorial/client_http.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/client_http.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/client_http.py (original)
+++ qpid/proton/branches/examples/tutorial/client_http.py Wed Oct  1 20:04:52 2014
@@ -39,7 +39,7 @@ class ExampleHandler(tornado.web.Request
         self.sender = self.conn.sender("examples")
         self.conn.receiver(None, dynamic=True, handler=self)
 
-    def on_link_remote_open(self, event):
+    def on_link_open(self, event):
         req = Message(reply_to=event.link.remote_source.address, body=self.get_body_argument("message"))
         self.sender.send_msg(req)
 

Modified: qpid/proton/branches/examples/tutorial/helloworld.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld.py Wed Oct  1 20:04:52 2014
@@ -26,7 +26,7 @@ class HelloWorld(proton_events.BaseHandl
         self.conn = conn
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.receiver(self.address)
         self.conn.sender(self.address)
 

Modified: qpid/proton/branches/examples/tutorial/helloworld_alt.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_alt.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld_alt.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld_alt.py Wed Oct  1 20:04:52 2014
@@ -37,7 +37,7 @@ class HelloWorld(ErrorHandler):
         self.conn = self.eventloop.connect(url, handler=self)
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.receiver(self.address, handler=HelloWorldReceiver())
         self.conn.sender(self.address, handler=HelloWorldSender())
 

Modified: qpid/proton/branches/examples/tutorial/helloworld_direct.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_direct.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld_direct.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld_direct.py Wed Oct  1 20:04:52 2014
@@ -33,14 +33,14 @@ class HelloWorld(BaseHandler):
         self.conn = eventloop.connect(url, handler=self)
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.sender(self.address)
 
     def on_link_flow(self, event):
         event.link.send_msg(Message(body=u"Hello World!"))
         event.link.close()
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         self.conn.close()
         self.acceptor.close()
 

Modified: qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py Wed Oct  1 20:04:52 2014
@@ -38,10 +38,10 @@ class HelloWorld(ErrorHandler):
         self.conn = eventloop.connect(url, handler=self)
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.sender(self.address, handler=HelloWorldSender())
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         self.conn.close()
         self.acceptor.close()
 

Modified: qpid/proton/branches/examples/tutorial/helloworld_direct_tornado.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_direct_tornado.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld_direct_tornado.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld_direct_tornado.py Wed Oct  1 20:04:52 2014
@@ -39,13 +39,13 @@ class HelloWorld(object):
         self.conn = eventloop.connect(url, handler=self)
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.sender(self.address, handler=HelloWorldSender())
 
-    def on_link_remote_close(self, event):
+    def on_link_close(self, event):
         self.closed(event.link.remote_condition)
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         self.closed(event.connection.remote_condition)
         self.eventloop.stop()
 

Modified: qpid/proton/branches/examples/tutorial/helloworld_tornado.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_tornado.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/helloworld_tornado.py (original)
+++ qpid/proton/branches/examples/tutorial/helloworld_tornado.py Wed Oct  1 20:04:52 2014
@@ -38,17 +38,17 @@ class HelloWorld(object):
         self.conn = eventloop.connect(url, handler=self)
         self.address = address
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         self.conn.receiver(self.address, handler=HelloWorldReceiver())
 
-    def on_link_remote_open(self, event):
+    def on_link_open(self, event):
         if event.link.is_receiver:
             self.conn.sender(self.address, handler=HelloWorldSender())
 
-    def on_link_remote_close(self, event):
+    def on_link_close(self, event):
         self.closed(event.link.remote_condition)
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         self.closed(event.connection.remote_condition)
         self.eventloop.stop()
 

Modified: qpid/proton/branches/examples/tutorial/proton_events.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/proton_events.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/proton_events.py (original)
+++ qpid/proton/branches/examples/tutorial/proton_events.py Wed Oct  1 20:04:52 2014
@@ -25,24 +25,24 @@ class EventDispatcher(object):
 
     methods = {
         Event.CONNECTION_INIT: "on_connection_init",
-        Event.CONNECTION_OPEN: "on_connection_open",
-        Event.CONNECTION_REMOTE_OPEN: "on_connection_remote_open",
-        Event.CONNECTION_CLOSE: "on_connection_close",
-        Event.CONNECTION_REMOTE_CLOSE: "on_connection_remote_close",
+        Event.CONNECTION_OPEN: "on_connection_local_open",
+        Event.CONNECTION_REMOTE_OPEN: "on_connection_open",
+        Event.CONNECTION_CLOSE: "on_connection_local_close",
+        Event.CONNECTION_REMOTE_CLOSE: "on_connection_close",
         Event.CONNECTION_FINAL: "on_connection_final",
 
         Event.SESSION_INIT: "on_session_init",
         Event.SESSION_OPEN: "on_session_open",
-        Event.SESSION_REMOTE_OPEN: "on_session_remote_open",
-        Event.SESSION_CLOSE: "on_session_close",
-        Event.SESSION_REMOTE_CLOSE: "on_session_remote_close",
+        Event.SESSION_REMOTE_OPEN: "on_session_open",
+        Event.SESSION_CLOSE: "on_session_local_close",
+        Event.SESSION_REMOTE_CLOSE: "on_session_close",
         Event.SESSION_FINAL: "on_session_final",
 
         Event.LINK_INIT: "on_link_init",
-        Event.LINK_OPEN: "on_link_open",
-        Event.LINK_REMOTE_OPEN: "on_link_remote_open",
-        Event.LINK_CLOSE: "on_link_close",
-        Event.LINK_REMOTE_CLOSE: "on_link_remote_close",
+        Event.LINK_OPEN: "on_link_local_open",
+        Event.LINK_REMOTE_OPEN: "on_link_open",
+        Event.LINK_CLOSE: "on_link_local_close",
+        Event.LINK_REMOTE_CLOSE: "on_link_close",
         Event.LINK_FLOW: "on_link_flow",
         Event.LINK_FINAL: "on_link_final",
 
@@ -419,34 +419,34 @@ class SelectLoop(object):
 
 class Handshaker(EventDispatcher):
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         conn = event.connection
         if conn.state & Endpoint.LOCAL_UNINIT:
             conn.open()
 
-    def on_session_remote_open(self, event):
+    def on_session_open(self, event):
         ssn = event.session
         if ssn.state & Endpoint.LOCAL_UNINIT:
             ssn.open()
 
-    def on_link_remote_open(self, event):
+    def on_link_open(self, event):
         link = event.link
         if link.state & Endpoint.LOCAL_UNINIT:
             link.source.copy(link.remote_source)
             link.target.copy(link.remote_target)
             link.open()
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         conn = event.connection
         if not (conn.state & Endpoint.LOCAL_CLOSED):
             conn.close()
 
-    def on_session_remote_close(self, event):
+    def on_session_close(self, event):
         ssn = event.session
         if not (ssn.state & Endpoint.LOCAL_CLOSED):
             ssn.close()
 
-    def on_link_remote_close(self, event):
+    def on_link_close(self, event):
         link = event.link
         if not (link.state & Endpoint.LOCAL_CLOSED):
             link.close()
@@ -460,11 +460,11 @@ class FlowController(EventDispatcher):
         delta = self.window - link.credit
         link.flow(delta)
 
-    def on_link_open(self, event):
+    def on_link_local_open(self, event):
         if event.link.is_receiver:
             self.top_up(event.link)
 
-    def on_link_remote_open(self, event):
+    def on_link_open(self, event):
         if event.link.is_receiver:
             self.top_up(event.link)
 
@@ -509,15 +509,15 @@ class ErrorHandler(EventDispatcher):
         elif self.was_closed_by_peer(endpoint):
             print "%s closed by peer" % endpoint_type
 
-    def on_link_remote_close(self, event):
+    def on_link_close(self, event):
         if self.treat_as_error(event.link, event.connection):
             self.on_link_error(event)
 
-    def on_session_remote_close(self, event):
+    def on_session_close(self, event):
         if self.treat_as_error(event.session, event.connection):
             self.on_session_error(event)
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         if self.treat_as_error(event.connection):
             self.on_connection_error(event)
 
@@ -706,7 +706,7 @@ class MessagingContext(object):
         ssn.open()
         return ssn
 
-    def on_session_remote_close(self, event):
+    def on_session_close(self, event):
         if self.conn:
             self.conn.close()
 
@@ -719,11 +719,11 @@ class Connector(EventDispatcher):
         print "connecting to %s:%i" % (host, port)
         self.loop.add(AmqpConnection(connection, socket.socket(), self.loop.events).connect(host, port))
 
-    def on_connection_open(self, event):
+    def on_connection_local_open(self, event):
         if hasattr(event.connection, "address"):
             self._connect(event.connection)
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         if hasattr(event.connection, "reconnect"):
             event.connection.reconnect.reset()
 
@@ -968,11 +968,11 @@ class BlockingConnection(EventDispatcher
                     if msg: txt += ": " + msg
                     raise Timeout(txt)
 
-    def on_link_remote_close(self, event):
+    def on_link_close(self, event):
         if event.link.state & Endpoint.LOCAL_ACTIVE:
             self.closed(event.link.remote_condition)
 
-    def on_connection_remote_close(self, event):
+    def on_connection_close(self, event):
         if event.connection.state & Endpoint.LOCAL_ACTIVE:
             self.closed(event.connection.remote_condition)
 

Modified: qpid/proton/branches/examples/tutorial/proton_server.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/proton_server.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/proton_server.py (original)
+++ qpid/proton/branches/examples/tutorial/proton_server.py Wed Oct  1 20:04:52 2014
@@ -31,11 +31,11 @@ class Server(IncomingMessageHandler):
     def on_message(self, event):
         self.on_request(event.message.body, event.message.reply_to)
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         if "ANONYMOUS-RELAY" in event.connection.remote_offered_capabilities:
             self.relay = self.conn.sender(None)
 
-    def on_connection_remote_close(self, endpoint, error):
+    def on_connection_close(self, endpoint, error):
         if error: print "Closed due to %s" % error
         self.conn.close()
 

Modified: qpid/proton/branches/examples/tutorial/server.py
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/server.py?rev=1628825&r1=1628824&r2=1628825&view=diff
==============================================================================
--- qpid/proton/branches/examples/tutorial/server.py (original)
+++ qpid/proton/branches/examples/tutorial/server.py Wed Oct  1 20:04:52 2014
@@ -38,11 +38,11 @@ class Server(IncomingMessageHandler):
             self.senders[event.message.reply_to] = sender
         sender.send_msg(Message(address=event.message.reply_to, body=event.message.body.upper()))
 
-    def on_connection_remote_open(self, event):
+    def on_connection_open(self, event):
         if event.connection.remote_offered_capabilities and 'ANONYMOUS-RELAY' in event.connection.remote_offered_capabilities:
             self.relay = self.conn.sender(None)
 
-    def on_connection_remote_close(self, endpoint, error):
+    def on_connection_close(self, endpoint, error):
         if error: print "Closed due to %s" % error
         self.conn.close()
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org