Author: justi9
Date: 2008-09-22 13:20:08 -0400 (Mon, 22 Sep 2008)
New Revision: 2521
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/util.py
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/sql/schema.sql
Log:
Update the schema with the new acl and cluster modules.
Add UI metadata for new props and stats.
Add new tabs to broker to display module info.
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -266,10 +266,13 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.__body.add_mode(self.__tabs)
+ #self.__tabs.add_tab(BrokerStats(app, "stats"))
self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
self.__tabs.add_tab(ConnectionSet(app, "conns"))
self.__tabs.add_tab(PeerSet(app, "peers"))
+ self.__tabs.add_tab(BrokerAccessControl(app, "access"))
+ self.__tabs.add_tab(BrokerClustering(app, "cluster"))
self.__tabs.add_tab(self.BrokerDetailsTab(app, "details"))
self.__missing = self.BrokerMissing(app, "missing")
@@ -324,13 +327,6 @@
self.frame.show_queue(branch, None).show_add(branch)
return branch.marshal()
- class BrokerStatsTab(Widget):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, reg):
- return "Statistics"
-
class BrokerLogTab(Widget):
def get_args(self, session):
return self.frame.get_args(session)
@@ -379,6 +375,112 @@
return acts
+class ModuleNotEnabled(Widget):
+ def do_render(self, session):
+ return "This module is not enabled"
+
+class BrokerAccessControl(ModeSet):
+ def __init__(self, app, name):
+ super(BrokerAccessControl, self).__init__(app, name)
+
+ mode = ModuleNotEnabled(app, "notenabled")
+ self.add_mode(mode)
+
+ self.__view = BrokerAccessControlView(app, "view")
+ self.add_mode(self.__view)
+
+ def get_args(self, session):
+ broker = self.frame.get_object(session).broker
+ acl = None
+
+ try:
+ acl = Acl.selectBy(broker=broker)[0]
+ except IndexError:
+ pass
+
+ return (acl,)
+
+ def do_process(self, session, acl):
+ if acl:
+ self.show_mode(session, self.__view)
+
+ def render_title(self, session, acl):
+ return "Access Control"
+
+class BrokerAccessControlView(Widget):
+ def __init__(self, app, name):
+ super(BrokerAccessControlView, self).__init__(app, name)
+
+ props = self.Properties(app, "props")
+ self.add_child(props)
+
+ stats = self.Stats(app, "stats", "general")
+ self.add_child(stats)
+
+ class Properties(CuminProperties):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+ class Stats(StatSet):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+class BrokerClustering(ModeSet):
+ def __init__(self, app, name):
+ super(BrokerClustering, self).__init__(app, name)
+
+ mode = ModuleNotEnabled(app, "notenabled")
+ self.add_mode(mode)
+
+ self.__view = BrokerClusteringView(app, "view")
+ self.add_mode(self.__view)
+
+ def get_args(self, session):
+ broker = self.frame.get_object(session).broker
+ cluster = None
+
+ try:
+ cluster = Cluster.selectBy(broker=broker)[0]
+ except IndexError:
+ pass
+
+ return (cluster,)
+
+ def do_process(self, session, cluster):
+ if cluster:
+ self.show_mode(session, self.__view)
+
+ def render_title(self, session, cluster):
+ return "Clustering"
+
+class BrokerClusteringView(Widget):
+ def __init__(self, app, name):
+ super(BrokerClusteringView, self).__init__(app, name)
+
+ props = self.Properties(app, "props")
+ self.add_child(props)
+
+ stats = self.Stats(app, "stats", "general")
+ self.add_child(stats)
+
+ class Properties(CuminProperties):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+ class Stats(StatSet):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+class BrokerStats(Widget):
+ def __init__(self, app, name):
+ super(BrokerStats, self).__init__(app, name)
+
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, reg):
+ return "Statistics"
+
class BrokerBrowser(Widget):
def __init__(self, app, name):
super(BrokerBrowser, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2008-09-22 17:20:08 UTC (rev 2521)
@@ -102,6 +102,21 @@
</tbody>
</table>
+[BrokerStats.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Access Control</h2>
+ {acl}
+ </td>
+ <td>
+<!-- -->
+ </td>
+ </tr>
+ </tbody>
+</table>
+
[BrokerBrowser.css]
table.BrokerBrowser {
width: 100%;
@@ -238,3 +253,37 @@
<input type="checkbox" id="{id}" name="{name}"
value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
<label for="{id}">{item_content}</label>
</div>
+
+[BrokerAccessControlView.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Properties</h2>
+ {props}
+
+ <h2>Statistics</h2>
+ {stats}
+ </td>
+ <td>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+[BrokerClusteringView.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Properties</h2>
+ {props}
+
+ <h2>Statistics</h2>
+ {stats}
+ </td>
+ <td>
+ </td>
+ </tr>
+ </tbody>
+</table>
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -33,8 +33,10 @@
CuminSession(self)
CuminLink(self)
CuminRoute(self)
- CuminStore(self)
+ CuminBrokerStoreModule(self)
CuminJournal(self)
+ CuminBrokerAclModule(self)
+ CuminBrokerClusterModule(self)
CuminBrokerRegistration(self)
CuminBrokerGroup(self)
@@ -1342,9 +1344,10 @@
def do_invoke(self, link, args, completion):
link.close(self.cumin_model.data, completion)
-class CuminStore(RemoteClass):
+class CuminBrokerStoreModule(RemoteClass):
def __init__(self, model):
- super(CuminStore, self).__init__(model, "store", Store, StoreStats)
+ super(CuminBrokerStoreModule, self).__init__ \
+ (model, "store", Store, StoreStats)
prop = CuminProperty(self, "location")
prop.title = "Location"
@@ -1426,6 +1429,50 @@
stat.unit = "page"
stat.category = "io.journal"
+class CuminBrokerAclModule(RemoteClass):
+ def __init__(self, model):
+ super(CuminBrokerAclModule, self).__init__ \
+ (model, "store", Acl, AclStats)
+
+ prop = CuminProperty(self, "policyFile")
+ prop.title = "Policy File"
+
+ prop = CuminProperty(self, "enforcingAcl")
+ prop.title = "Enforcing?"
+
+ prop = CuminProperty(self, "transferAcl")
+ prop.title = "Transfer?"
+
+ prop = CuminProperty(self, "lastAclLoad")
+ prop.title = "Last Loaded"
+
+ stat = CuminStat(self, "aclDenyCount")
+ stat.title = "Denials"
+ stat.unit = "denial"
+
+class CuminBrokerClusterModule(RemoteClass):
+ def __init__(self, model):
+ super(CuminBrokerClusterModule, self).__init__ \
+ (model, "broker_cluster_module", Cluster, ClusterStats)
+
+ prop = CuminProperty(self, "clusterName")
+ prop.title = "Name"
+
+ prop = CuminProperty(self, "clusterID")
+ prop.title = "ID"
+
+ prop = CuminProperty(self, "publishedURL")
+ prop.title = "URL"
+
+ prop = CuminProperty(self, "clusterSize")
+ prop.title = "Size"
+
+ prop = CuminProperty(self, "status")
+ prop.title = "Status"
+
+ prop = CuminProperty(self, "members")
+ prop.title = "Members"
+
class CuminBrokerRegistration(LocalClass):
def __init__(self, model):
super(CuminBrokerRegistration, self).__init__ \
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -3,6 +3,7 @@
from logging import getLogger
from time import mktime, time, sleep
from random import randint
+from xml.sax.saxutils import escape as xml_escape
import sys
def short_id():
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -518,6 +518,96 @@
+class Acl(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ sourceScopeId = BigIntCol(default=None)
+ sourceObjectId = BigIntCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('AclStats', cascade='null', default=None)
+ statsPrev = ForeignKey('AclStats', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ broker = ForeignKey('Broker', cascade='null', default=None)
+ policyFile = StringCol(length=1000, default=None)
+ enforcingAcl = BoolCol(default=None)
+ transferAcl = BoolCol(default=None)
+ lastAclLoad = BigIntCol(default=None)
+
+
+ def reloadACLFile(self, model, callback):
+ """Reload the ACL file"""
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "reloadACLFile",
+ callback, args=actualArgs)
+
+class AclStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ acl = ForeignKey('Acl', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ aclDenyCount = BigIntCol(default=None)
+
+
+
+
+class Cluster(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ sourceScopeId = BigIntCol(default=None)
+ sourceObjectId = BigIntCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('ClusterStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ClusterStats', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ broker = ForeignKey('Broker', cascade='null', default=None)
+ clusterName = StringCol(length=1000, default=None)
+ clusterID = StringCol(length=1000, default=None)
+ publishedURL = StringCol(length=1000, default=None)
+ clusterSize = SmallIntCol(default=None)
+ status = StringCol(length=1000, default=None)
+ members = StringCol(length=4000, default=None)
+
+
+ def stopClusterNode(self, model, callback):
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "stopClusterNode",
+ callback, args=actualArgs)
+
+ def stopFullCluster(self, model, callback):
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "stopFullCluster",
+ callback, args=actualArgs)
+
+class ClusterStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ cluster = ForeignKey('Cluster', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+
+
+
+
class Store(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -1041,6 +1131,22 @@
Session.sqlmeta.addJoin(SQLMultipleJoin('SessionStats',
joinMethodName='stats'))
+classToSchemaNameMap['Acl'] = 'acl'
+schemaNameToClassMap['acl'] = Acl
+
+Broker.sqlmeta.addJoin(SQLMultipleJoin('Acl', joinMethodName='acls'))
+
+
+Acl.sqlmeta.addJoin(SQLMultipleJoin('AclStats', joinMethodName='stats'))
+
+classToSchemaNameMap['Cluster'] = 'cluster'
+schemaNameToClassMap['cluster'] = Cluster
+
+Broker.sqlmeta.addJoin(SQLMultipleJoin('Cluster',
joinMethodName='clusters'))
+
+
+Cluster.sqlmeta.addJoin(SQLMultipleJoin('ClusterStats',
joinMethodName='stats'))
+
classToSchemaNameMap['Store'] = 'Store'
schemaNameToClassMap['Store'] = Store
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/mint/sql/schema.sql 2008-09-22 17:20:08 UTC (rev 2521)
@@ -70,6 +70,30 @@
);
CREATE UNIQUE INDEX subject_role_mapping_unique ON subject_role_mapping (subject_id,
role_id);
+CREATE TABLE acl (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ source_scope_id BIGINT,
+ source_object_id BIGINT,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ broker_id INT,
+ policy_file VARCHAR(1000),
+ enforcing_acl BOOL,
+ transfer_acl BOOL,
+ last_acl_load BIGINT
+);
+
+CREATE TABLE acl_stats (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ acl_id INT,
+ acl_deny_count BIGINT
+);
+
CREATE TABLE agent (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
@@ -200,6 +224,31 @@
bytes_to_client BIGINT
);
+CREATE TABLE cluster (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ source_scope_id BIGINT,
+ source_object_id BIGINT,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ broker_id INT,
+ cluster_name VARCHAR(1000),
+ cluster_id VARCHAR(1000),
+ published_ur_l VARCHAR(1000),
+ cluster_size SMALLINT,
+ status VARCHAR(1000),
+ members VARCHAR(4000)
+);
+
+CREATE TABLE cluster_stats (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ cluster_id INT
+);
+
CREATE TABLE exchange (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
@@ -708,6 +757,14 @@
ALTER TABLE subject_role_mapping ADD CONSTRAINT role_id_exists FOREIGN KEY (role_id)
REFERENCES role (id) ON DELETE CASCADE;
+ALTER TABLE acl ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES acl_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE acl ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES acl_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE acl ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker
(id) ON DELETE SET NULL;
+
+ALTER TABLE acl_stats ADD CONSTRAINT acl_id_exists FOREIGN KEY (acl_id) REFERENCES acl
(id) ON DELETE SET NULL;
+
ALTER TABLE agent ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES agent_stats (id) ON DELETE SET NULL;
ALTER TABLE agent ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES agent_stats (id) ON DELETE SET NULL;
@@ -754,6 +811,14 @@
ALTER TABLE client_connection_stats ADD CONSTRAINT client_connection_id_exists FOREIGN
KEY (client_connection_id) REFERENCES client_connection (id) ON DELETE SET NULL;
+ALTER TABLE cluster ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES cluster_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES cluster_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES
broker (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster_stats ADD CONSTRAINT cluster_id_exists FOREIGN KEY (cluster_id)
REFERENCES cluster (id) ON DELETE SET NULL;
+
ALTER TABLE exchange ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES exchange_stats (id) ON DELETE SET NULL;
ALTER TABLE exchange ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES exchange_stats (id) ON DELETE SET NULL;