You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2015/11/09 16:33:30 UTC
qpid-dispatch git commit: NO-JIRA - Added __str__() functions to
Entity classes in agent so the exact type is visible when printing the
entities
Repository: qpid-dispatch
Updated Branches:
refs/heads/master c0af6e3df -> c5333462f
NO-JIRA - Added __str__() functions to Entity classes in agent so the exact type is visible when printing the entities
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c5333462
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c5333462
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c5333462
Branch: refs/heads/master
Commit: c5333462fc5d0831082a69d37b79dd4c021dda90
Parents: c0af6e3
Author: ganeshmurthy <gm...@redhat.com>
Authored: Fri Nov 6 16:54:51 2015 -0500
Committer: ganeshmurthy <gm...@redhat.com>
Committed: Fri Nov 6 16:54:51 2015 -0500
----------------------------------------------------------------------
.../qpid_dispatch_internal/management/agent.py | 49 ++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c5333462/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py
index 1436024..1c1b876 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -233,6 +233,9 @@ class ContainerEntity(EntityAdapter):
self.attributes.setdefault("containerName", "00000000-0000-0000-0000-000000000000")
return self.attributes["containerName"]
+ def __str__(self):
+ return super(ContainerEntity, self).__str__().replace("Entity(", "ContainerEntity(")
+
class RouterEntity(EntityAdapter):
def __init__(self, agent, entity_type, attributes=None):
@@ -247,6 +250,9 @@ class RouterEntity(EntityAdapter):
def create(self):
self._qd.qd_dispatch_configure_router(self._dispatch, self)
+ def __str__(self):
+ return super(RouterEntity, self).__str__().replace("Entity(", "RouterEntity(")
+
class LogEntity(EntityAdapter):
@@ -269,6 +275,9 @@ class LogEntity(EntityAdapter):
"""Can't actually delete a log source but return it to the default state"""
self._qd.qd_log_source_reset(self.attributes['module'])
+ def __str__(self):
+ return super(LogEntity, self).__str__().replace("Entity(", "LogEntity(")
+
def _addr_port_identifier(entity):
for attr in ['addr', 'port']: # Set default values if need be
entity.attributes.setdefault(
@@ -281,7 +290,11 @@ class ListenerEntity(EntityAdapter):
self._qd.qd_dispatch_configure_listener(self._dispatch, self)
self._qd.qd_connection_manager_start(self._dispatch)
- def _identifier(self): return _addr_port_identifier(self)
+ def _identifier(self):
+ return _addr_port_identifier(self)
+
+ def __str__(self):
+ return super(ListenerEntity, self).__str__().replace("Entity(", "ListenerEntity(")
class ConnectorEntity(EntityAdapter):
@@ -289,23 +302,39 @@ class ConnectorEntity(EntityAdapter):
self._qd.qd_dispatch_configure_connector(self._dispatch, self)
self._qd.qd_connection_manager_start(self._dispatch)
- def _identifier(self): return _addr_port_identifier(self)
+ def _identifier(self):
+ return _addr_port_identifier(self)
+
+ def __str__(self):
+ return super(ConnectorEntity, self).__str__().replace("Entity(", "ConnectorEntity(")
class FixedAddressEntity(EntityAdapter):
def create(self):
self._qd.qd_dispatch_configure_address(self._dispatch, self)
+ def __str__(self):
+ return super(FixedAddressEntity, self).__str__().replace("Entity(", "FixedAddressEntity(")
+
class WaypointEntity(EntityAdapter):
def create(self):
self._qd.qd_dispatch_configure_waypoint(self._dispatch, self)
self._qd.qd_waypoint_activate_all(self._dispatch)
+ def __str__(self):
+ return super(WaypointEntity, self).__str__().replace("Entity(", "WaypointEntity(")
+
class LinkRoutePatternEntity(EntityAdapter):
def create(self):
self._qd.qd_dispatch_configure_lrp(self._dispatch, self)
+ def __str__(self):
+ return super(LinkRoutePatternEntity, self).__str__().replace("Entity(", "LinkRoutePatternEntity(")
+
class ConsoleEntity(EntityAdapter):
+ def __str__(self):
+ return super(ConsoleEntity, self).__str__().replace("Entity(", "ConsoleEntity(")
+
def create(self):
# if a named listener is present, use its addr:port
name = self.attributes.get('listener')
@@ -343,28 +372,42 @@ class DummyEntity(EntityAdapter):
return (OK, dict(**request.properties))
-class RouterLinkEntity(EntityAdapter): pass
+class RouterLinkEntity(EntityAdapter):
+ def __str__(self):
+ return super(RouterLinkEntity, self).__str__().replace("Entity(", "RouterLinkEntity(")
class RouterNodeEntity(EntityAdapter):
def _identifier(self):
return self.attributes.get('routerId')
+ def __str__(self):
+ return super(RouterNodeEntity, self).__str__().replace("Entity(", "RouterNodeEntity(")
+
class RouterAddressEntity(EntityAdapter):
def _identifier(self):
return self.attributes.get('key')
+ def __str__(self):
+ return super(RouterAddressEntity, self).__str__().replace("Entity(", "RouterAddressEntity(")
+
class ConnectionEntity(EntityAdapter):
def _identifier(self):
return self.attributes.get('host')
+ def __str__(self):
+ return super(ConnectionEntity, self).__str__().replace("Entity(", "ConnectionEntity(")
+
class AllocatorEntity(EntityAdapter):
def _identifier(self):
return self.attributes.get('typeName')
+ def __str__(self):
+ return super(AllocatorEntity, self).__str__().replace("Entity(", "AllocatorEntity(")
+
class EntityCache(object):
"""
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org