[rhmessaging-commits] rhmessaging commits: r2105 - mgmt/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Mon Jun 2 14:56:37 EDT 2008
Author: justi9
Date: 2008-06-02 14:56:36 -0400 (Mon, 02 Jun 2008)
New Revision: 2105
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/test.py
mgmt/cumin/python/cumin/virtualhost.py
Log:
Part 1 of the rename of Client to Connection
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/broker.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -215,11 +215,11 @@
self.__exchange = ExchangeFrame(app, "exchange")
self.add_mode(self.__exchange)
- self.__client = ClientFrame(app, "client")
- self.add_mode(self.__client)
+ self.__conn = ConnectionFrame(app, "conn")
+ self.add_mode(self.__conn)
- self.__clients_close = ClientSetClose(app, "clientsclose")
- self.add_mode(self.__clients_close)
+ self.__conns_close = ConnectionSetClose(app, "connsclose")
+ self.add_mode(self.__conns_close)
def show_queue(self, session, queue):
self.__queue.set_object(session, queue)
@@ -235,14 +235,14 @@
self.page.set_current_frame(session, self.__exchange)
return self.show_mode(session, self.__exchange)
- def show_client(self, session, client):
- self.__client.set_object(session, client)
- self.page.set_current_frame(session, self.__client)
- return self.show_mode(session, self.__client)
+ def show_connection(self, session, conn):
+ self.__conn.set_object(session, conn)
+ self.page.set_current_frame(session, self.__conn)
+ return self.show_mode(session, self.__conn)
- def show_clients_close(self, session):
- self.page.set_current_frame(session, self.__clients_close)
- return self.show_mode(session, self.__clients_close)
+ def show_connections_close(self, session):
+ self.page.set_current_frame(session, self.__conns_close)
+ return self.show_mode(session, self.__conns_close)
class BrokerStatus(CuminStatus):
pass
@@ -267,7 +267,7 @@
self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
- self.__tabs.add_tab(ClientSet(app, "clients"))
+ self.__tabs.add_tab(ConnectionSet(app, "conns"))
self.__tabs.add_tab(PeerSet(app, "peers"))
self.__tabs.add_tab(self.BrokerDetailsTab(app, "details"))
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/client.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -11,9 +11,9 @@
strings = StringCatalog(__file__)
-class ClientSet(CuminTable, Form):
+class ConnectionSet(CuminTable, Form):
def __init__(self, app, name):
- super(ClientSet, self).__init__(app, name)
+ super(ConnectionSet, self).__init__(app, name)
self.ids = CheckboxIdColumn(app, "id", self)
self.add_column(self.ids)
@@ -50,7 +50,7 @@
return self.unit.get(session) == "b" and "Bytes" or "Frames"
def render_title(self, session, vhost):
- return "Clients %s" % fmt_count(vhost.clients.count())
+ return "Connections %s" % fmt_count(vhost.connections.count())
def render_sql_where(self, session, vhost):
elems = list()
@@ -70,7 +70,7 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame.show_clients_close(branch)
+ frame = self.frame.show_connections_close(branch)
frame.ids.set(branch, ids)
self.page.set_redirect_url(session, branch.marshal())
@@ -79,10 +79,10 @@
return "Address"
def render_content(self, session, data):
- client = Identifiable(data["id"])
+ conn = Identifiable(data["id"])
branch = session.branch()
- self.frame.show_client(branch, client).show_view(branch)
- return fmt_olink(branch, client, name=data["addr"])
+ self.frame.show_connection(branch, conn).show_view(branch)
+ return fmt_olink(branch, conn, name=data["addr"])
class SentColumn(NullSortColumn, FreshDataOnlyColumn):
def render_title(self, session, data):
@@ -106,24 +106,24 @@
def render_value(self, session, value):
return fmt_rate(value, "", "sec")
-class ClientFrame(CuminFrame):
+class ConnectionFrame(CuminFrame):
def __init__(self, app, name):
- super(ClientFrame, self).__init__(app, name)
+ super(ConnectionFrame, self).__init__(app, name)
- self.object = ClientParameter(app, "id")
+ self.object = ConnectionParameter(app, "id")
self.add_parameter(self.object)
- view = ClientView(app, "view")
+ view = ConnectionView(app, "view")
self.add_mode(view)
self.set_view_mode(view)
- self.__close = ClientClose(app, "close")
+ self.__close = ConnectionClose(app, "close")
self.add_mode(self.__close)
- self.__sessions_detach = ClientSessionSetDetach(app, "sessionsdetach")
+ self.__sessions_detach = SessionSetDetach(app, "sessionsdetach")
self.add_mode(self.__sessions_detach)
- self.__sessions_close = ClientSessionSetClose(app, "sessionsclose")
+ self.__sessions_close = SessionSetClose(app, "sessionsclose")
self.add_mode(self.__sessions_close)
def show_close(self, session):
@@ -141,31 +141,31 @@
#print error, args
#print "did it!"
-class ClientClose(CuminConfirmForm):
+class ConnectionClose(CuminConfirmForm):
def get_args(self, session):
return self.frame.get_args(session)
- def process_cancel(self, session, client):
+ def process_cancel(self, session, conn):
branch = session.branch()
self.frame.show_view(branch)
self.page.set_redirect_url(session, branch.marshal())
- def process_submit(self, session, client):
- action = self.app.model.client.close
- action.invoke(client)
+ def process_submit(self, session, conn):
+ action = self.app.model.connection.close
+ action.invoke(conn)
- self.process_cancel(session, client)
+ self.process_cancel(session, conn)
- def render_title(self, session, client):
- return "Close Client '%s'" % client.address
+ def render_title(self, session, conn):
+ return "Close Connection '%s'" % conn.address
- def render_submit_content(self, session, client):
- return "Yes, Close Client '%s'" % client.address
+ def render_submit_content(self, session, conn):
+ return "Yes, Close Connection '%s'" % conn.address
- def render_cancel_content(self, session, client):
+ def render_cancel_content(self, session, conn):
return "No, Cancel"
-class ClientSetClose(CuminBulkActionForm):
+class ConnectionSetClose(CuminBulkActionForm):
def process_return(self, session):
branch = session.branch()
self.frame.show_view(branch)
@@ -173,42 +173,42 @@
self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
- client = Client.get(id)
- action = self.app.model.client.close
- action.invoke(client)
+ conn = Connection.get(id)
+ action = self.app.model.connection.close
+ action.invoke(conn)
def render_title(self, session):
- return "Close Clients"
+ return "Close Connections"
def render_item_content(self, session, id):
- return "Close Client %s" % Client.get(id).address
+ return "Close Connection %s" % Client.get(id).address
-class ClientStatus(CuminStatus):
- def render_frames_from(self, session, client):
- return self.app.model.client.framesFromClient.rate_html(client)
+class ConnectionStatus(CuminStatus):
+ def render_frames_from(self, session, conn):
+ return self.app.model.connection.framesFromClient.rate_html(conn)
- def render_frames_to(self, session, client):
- return self.app.model.client.framesToClient.rate_html(client)
+ def render_frames_to(self, session, conn):
+ return self.app.model.connection.framesToClient.rate_html(conn)
- def render_bytes_from(self, session, client):
- return self.app.model.client.bytesFromClient.rate_html(client)
+ def render_bytes_from(self, session, conn):
+ return self.app.model.connection.bytesFromClient.rate_html(conn)
- def render_bytes_to(self, session, client):
- return self.app.model.client.bytesToClient.rate_html(client)
+ def render_bytes_to(self, session, conn):
+ return self.app.model.connection.bytesToClient.rate_html(conn)
-class ClientView(CuminView):
+class ConnectionView(CuminView):
def __init__(self, app, name):
- super(ClientView, self).__init__(app, name)
+ super(ConnectionView, self).__init__(app, name)
- status = ClientStatus(app, "status")
+ status = ConnectionStatus(app, "status")
self.add_child(status)
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- self.__tabs.add_tab(ClientStats(app, "stats"))
+ self.__tabs.add_tab(ConnectionStats(app, "stats"))
- self.__sessions = ClientSessionSet(app, "sessions")
+ self.__sessions = SessionSet(app, "sessions")
self.__tabs.add_tab(self.__sessions)
self.__tabs.add_tab(CuminDetails(app, "details"))
@@ -216,13 +216,13 @@
def show_sessions(self, session):
return self.__tabs.show_mode(session, self.__sessions)
- def render_script(self, session, client):
- data = "model.xml?class=client;id=%i" % client.id
- return "wooly.setIntervalUpdate('%s', updateClient, 3000)" % data
+ def render_script(self, session, conn):
+ data = "model.xml?class=connection;id=%i" % conn.id
+ return "wooly.setIntervalUpdate('%s', updateConnection, 3000)" % data
-class ClientStats(Widget):
+class ConnectionStats(Widget):
def __init__(self, app, name):
- super(ClientStats, self).__init__(app, name)
+ super(ConnectionStats, self).__init__(app, name)
self.add_child(StatSet(app, "io", "io"))
self.add_child(StatSet(app, "general", "general"))
@@ -235,15 +235,15 @@
class SendReceiveRateChart(StatValueChart):
def __init__(self, app, name):
- super(ClientStats.SendReceiveRateChart, self).__init__(app, name)
+ super(ConnectionStats.SendReceiveRateChart, self).__init__(app, name)
self.stats = ("bytesFromClient", "bytesToClient")
self.mode = "rate"
- def render_title(self, session, client):
+ def render_title(self, session, conn):
return "Bytes Sent and Received"
-class ClientSessionSetDetach(CuminBulkActionForm, Frame):
+class SessionSetDetach(CuminBulkActionForm, Frame):
def process_return(self, session):
branch = session.branch()
self.frame.show_view(branch).show_sessions(branch)
@@ -261,7 +261,7 @@
def render_item_content(self, session, id):
return "Detach Session '%s'" % Session.get(id).name
-class ClientSessionSetClose(CuminBulkActionForm, Frame):
+class SessionSetClose(CuminBulkActionForm, Frame):
def process_return(self, session):
branch = session.branch()
self.frame.show_view(branch).show_sessions(branch)
@@ -279,9 +279,9 @@
def render_item_content(self, session, id):
return "Close Session '%s'" % Session.get(id).name
-class ClientSessionSet(CuminTable, Form):
+class SessionSet(CuminTable, Form):
def __init__(self, app, name):
- super(ClientSessionSet, self).__init__(app, name)
+ super(SessionSet, self).__init__(app, name)
self.ids = CheckboxIdColumn(app, "id", self)
self.add_column(self.ids)
@@ -309,17 +309,17 @@
def get_args(self, session):
return self.frame.get_args(session)
- def render_title(self, session, client):
- return "Sessions %s" % fmt_count(client.sessions.count())
+ def render_title(self, session, conn):
+ return "Sessions %s" % fmt_count(conn.sessions.count())
- def render_sql_where(self, session, client):
+ def render_sql_where(self, session, conn):
elems = list()
- elems.append("s.client_id = %(id)r")
- elems.append(self.__phase.get_sql_constraint(session, client))
+ elems.append("s.client_connection_id = %(id)r")
+ elems.append(self.__phase.get_sql_constraint(session, conn))
return "where %s" % " and ".join(elems)
- def get_sql_values(self, session, client):
- return {"id": client.id}
+ def get_sql_values(self, session, conn):
+ return {"id": conn.id}
class Detach(FormButton):
def render_content(self, session):
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/client.strings 2008-06-02 18:56:36 UTC (rev 2105)
@@ -1,4 +1,4 @@
-[ClientSet.sql]
+[ConnectionSet.sql]
select
l.id,
l.address as addr,
@@ -15,27 +15,27 @@
/ (extract(epoch from (c.rec_time - p.rec_time)) + 0.0001) as fr,
case when p.frames_to_client is null then true else false end as fr_is_null,
c.rec_time
-from client as l
-left outer join client_stats as c on c.id = l.stats_curr_id
-left outer join client_stats as p on p.id = l.stats_prev_id
+from connection as l
+left outer join connection_stats as c on c.id = l.stats_curr_id
+left outer join connection_stats as p on p.id = l.stats_prev_id
{sql_where}
{sql_orderby}
{sql_limit}
-[ClientSet.count_sql]
+[ConnectionSet.count_sql]
select count(*)
-from client as l
-left outer join client_stats as c on c.id = l.stats_curr_id
+from connection as l
+left outer join connection_stats as c on c.id = l.stats_curr_id
{sql_where}
-[ClientSet.html]
+[ConnectionSet.html]
<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
{unit}
<div class="sactions">
- <h2>Act on Selected Clients:</h2>
+ <h2>Act on Selected Connections:</h2>
{close}
</div>
@@ -54,11 +54,11 @@
{hidden_inputs}
</form>
-[ClientStatus.javascript]
-function updateClientStatus(id, client) {
- updateStatus(id, client);
+[ConnectionStatus.javascript]
+function updateConnectionStatus(id, conn) {
+ updateStatus(id, conn);
- var s = client.stat;
+ var s = conn.stat;
var sdata = {
"tr": [
null,
@@ -70,7 +70,7 @@
wooly.doc().elembyid(id).descendant("table.tbody").update(sdata);
}
-[ClientStatus.html]
+[ConnectionStatus.html]
<div id="{id}" class="CuminStatus {color}">
<table>
<tr>
@@ -95,21 +95,21 @@
</script>
[ClientView.javascript]
-function updateClient(data) {
+function updateConnection(data) {
var model = data.objectify();
- var clients = model.client;
- var client;
+ var conns = model.connection;
+ var conn;
- for (var key in clients) {
- client = clients[key];
+ for (var key in conns) {
+ conn = conns[key];
break;
}
cumin.runModelListeners(model);
- cumin.runObjectListeners(client);
+ cumin.runObjectListeners(conn);
}
-[ClientStats.html]
+[ConnectionStats.html]
<table class="twocol">
<tr>
<td>
@@ -125,7 +125,7 @@
</tr>
</table>
-[ClientSessionSet.sql]
+[SessionSet.sql]
select s.id, s.name, c.expire_time as expires, c.attached as status
from session as s
left outer join session_stats as c on c.id = s.stats_curr_id
@@ -134,13 +134,13 @@
{sql_orderby}
{sql_limit}
-[ClientSessionSet.count_sql]
+[SessionSet.count_sql]
select count(*)
from session as s
left outer join session_stats as c on c.id = s.stats_curr_id
{sql_where}
-[ClientSessionSet.html]
+[SessionSet.html]
<form id="{id}" method="post" action="?">
<div class="rfloat">{phase}</div>
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/demo.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -128,10 +128,10 @@
for consumer in queue.consumer_items():
self.frob(consumer)
- for client in vhost.client_items():
- self.frob(client)
+ for conn in vhost.conn_items():
+ self.frob(conn)
- for session in client.session_items():
+ for session in conn.session_items():
self.frob(session)
if __name__ == "__main__":
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/model.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -25,7 +25,7 @@
CuminQueue(self)
CuminExchange(self)
CuminBinding(self)
- CuminClient(self)
+ CuminConnection(self)
CuminSession(self)
CuminLink(self)
@@ -808,9 +808,10 @@
def get_object_name(self, binding):
return ""
-class CuminClient(RemoteClass):
+class CuminConnection(RemoteClass):
def __init__(self, model):
- super(CuminClient, self).__init__(model, "client", Client, ClientStats)
+ super(CuminConnection, self).__init__(model, "connection", Connection,
+ ConnectionStats)
prop = CuminProperty(self, "address")
prop.title = "Address"
@@ -842,40 +843,40 @@
action = self.Close(self, "close")
action.summary = True
- def show_object(self, session, client):
+ def show_object(self, session, conn):
frame = self.cumin_model.show_main(session)
- frame = frame.show_broker(session, client.vhost.broker.registration)
- return frame.show_client(session, client)
+ frame = frame.show_broker(session, conn.vhost.broker.registration)
+ return frame.show_connection(session, conn)
def get_title(self, session):
- return "Client"
+ return "Connection"
def get_icon_href(self, session):
return "resource?name=client-36.png"
- def get_object_name(self, client):
- return client.address
+ def get_object_name(self, conn):
+ return conn.address
class Close(CuminAction):
- def show(self, session, client):
- frame = self.cumin_class.show_object(session, client)
+ def show(self, session, conn):
+ frame = self.cumin_class.show_object(session, conn)
return frame.show_close(session)
def get_title(self, session):
return "Close"
- def do_invoke(self, client, args, completion):
- reg = client.vhost.broker.registration
- conn = self.cumin_model.data.getConnectionByRegistration(reg)
-
+ def do_invoke(self, conn, args, completion):
+ reg = conn.vhost.broker.registration
+ mconn = self.cumin_model.data.getConnectionByRegistration(reg)
+
# Does it contain a mgmt session?
- for session in client.sessions:
- if session.name == conn.getSessionId():
+ for session in conn.sessions:
+ if session.name == mconn.getSessionId():
raise Exception \
- ("Cannot close management client %s", client.address)
+ ("Cannot close management connection %s", conn.address)
- client.close(self.cumin_model.data, completion)
+ conn.close(self.cumin_model.data, completion)
class CuminSession(RemoteClass):
def __init__(self, model):
@@ -916,29 +917,29 @@
def get_title(self, session):
return "Close"
- def do_invoke(self, object, args, completion):
- reg = object.client.vhost.broker.registration
+ def do_invoke(self, sess, args, completion):
+ reg = sess.conn.vhost.broker.registration
conn = self.cumin_model.data.getConnectionByRegistration(reg)
- if object.name == conn.getSessionId():
+ if sess.name == conn.getSessionId():
raise Exception \
- ("Cannot close management session %s" % object.name)
+ ("Cannot close management session %s" % sess.name)
- object.close(self.cumin_model.data, completion)
+ sess.close(self.cumin_model.data, completion)
class Detach(CuminAction):
def get_title(self, session):
return "Detach"
- def do_invoke(self, object, args, completion):
- reg = object.client.vhost.broker.registration
+ def do_invoke(self, sess, args, completion):
+ reg = sess.clientConnection.vhost.broker.registration
conn = self.cumin_model.data.getConnectionByRegistration(reg)
- if object.name == conn.getSessionId():
+ if sess.name == conn.getSessionId():
raise Exception \
- ("Cannot detach management session %s" % object.name)
+ ("Cannot detach management session %s" % sess.name)
- object.detach(self.cumin_model.data, completion)
+ sess.detach(self.cumin_model.data, completion)
class ResetLifespan(CuminAction):
def get_title(self, session):
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/parameters.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -44,12 +44,12 @@
def do_marshal(self, profile):
return str(profile.id)
-class ClientParameter(Parameter):
+class ConnectionParameter(Parameter):
def do_unmarshal(self, string):
- return Client.get(int(string))
+ return Connection.get(int(string))
- def do_marshal(self, client):
- return str(client.id)
+ def do_marshal(self, conn):
+ return str(conn.id)
class ConfigPropertyParameter(Parameter):
def do_unmarshal(self, string):
Modified: mgmt/cumin/python/cumin/test.py
===================================================================
--- mgmt/cumin/python/cumin/test.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/test.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -336,7 +336,7 @@
QueueTest(env, self)
ExchangeTest(env, self)
- ClientTest(env, self)
+ ConnectionTest(env, self)
def do_run(self, session):
def predicate():
@@ -383,7 +383,7 @@
self.run_children(session)
-class ClientTest(Test):
+class ConnectionTest(Test):
def do_run(self, session):
raise Exception("Not implemented")
@@ -392,9 +392,10 @@
str(self.env.broker_conn.port)
try:
- self.env.client = Client.selectBy(vhost=vhost, address=address)[0]
+ self.env.conn = Connection.selectBy \
+ (vhost=vhost, address=address)[0]
except IndexError:
- raise Exception("Client not found")
+ raise Exception("Connection not found")
self.run_children(session)
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2008-06-02 16:11:13 UTC (rev 2104)
+++ mgmt/cumin/python/cumin/virtualhost.py 2008-06-02 18:56:36 UTC (rev 2105)
@@ -41,8 +41,8 @@
self.__exchange = ExchangeFrame(app, "exchange")
self.add_mode(self.__exchange)
- self.__client = ClientFrame(app, "client")
- self.add_mode(self.__client)
+ self.__conn = ConnectionFrame(app, "conn")
+ self.add_mode(self.__conn)
def show_queue(self, session, queue):
self.__queue.set_object(session, queue)
@@ -52,9 +52,9 @@
self.__exchange.set_object(session, exchange)
return self.show_mode(session, self.__exchange)
- def show_client(self, session, client):
- self.__client.set_object(session, client)
- return self.show_mode(session, self.__client)
+ def show_connection(self, session, conn):
+ self.__conn.set_object(session, conn)
+ return self.show_mode(session, self.__conn)
class VirtualHostView(CuminView):
def __init__(self, app, name):
@@ -65,7 +65,7 @@
self.tabs.add_tab(QueueSet(app, "queues"))
self.tabs.add_tab(ExchangeSet(app, "exchanges"))
- self.tabs.add_tab(ClientSet(app, "clients"))
+ self.tabs.add_tab(ConnectionSet(app, "conns"))
def render_broker_link(self, session, vhost):
broker = vhost.get_broker()
More information about the rhmessaging-commits
mailing list