[rhmessaging-commits] rhmessaging commits: r2042 - in mgmt/mint: python/mint and 1 other directories.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Tue May 13 15:04:03 EDT 2008
Author: nunofsantos
Date: 2008-05-13 15:04:03 -0400 (Tue, 13 May 2008)
New Revision: 2042
Modified:
mgmt/mint/Makefile
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schemaparser.py
mgmt/mint/sql/schema.sql
Log:
handle close callback from broker
Modified: mgmt/mint/Makefile
===================================================================
--- mgmt/mint/Makefile 2008-05-13 17:08:09 UTC (rev 2041)
+++ mgmt/mint/Makefile 2008-05-13 19:04:03 UTC (rev 2042)
@@ -1,4 +1,4 @@
-.PHONY: build install schema schema-sql schema-python
+.PHONY: build install schema schema-sql schema-python clean
include ../etc/Makefile.common
@@ -13,6 +13,9 @@
build:
../bin/python-compile python
+clean:
+ rm -f python/mint/schema-store.py python/mint/schema.py python/mint/schema.sql
+
install: build
install -d ${lib}
install python/mint/*.py python/mint/*.pyc ${lib}
@@ -28,7 +31,8 @@
schema-python:
@if [ -z "$$MINT_SCHEMA_XML" ]; then echo "MINT_SCHEMA_XML is not set"; exit 1; fi
python python/mint/schemaparser.py ${MINT_SCHEMA_XML} python/mint/schema.py ${dsn}
- @if [ -z "$$STORE_SCHEMA_XML" ]; then echo "Warning: STORE_SCHEMA_XML is not set, skipping store schema generation"; else python python/mint/schemaparser.py ${STORE_SCHEMA_XML} python/mint/schema-store.py ${dsn}; cat python/mint/schema-store.py >> python/mint/schema.py; fi
+# ignore the store schema for now
+# @if [ -z "$$STORE_SCHEMA_XML" ]; then echo "Warning: STORE_SCHEMA_XML is not set, skipping store schema generation"; else python python/mint/schemaparser.py ${STORE_SCHEMA_XML} python/mint/schema-store.py ${dsn}; cat python/mint/schema-store.py >> python/mint/schema.py; rm python/mint/schema-store.py; fi
schema-sql:
sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > sql/schema.sql
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-05-13 17:08:09 UTC (rev 2041)
+++ mgmt/mint/python/mint/__init__.py 2008-05-13 19:04:03 UTC (rev 2042)
@@ -210,10 +210,12 @@
return
self.conn = Connection(sock, spec)
- self.mclient = managementClient(spec, None,
+ self.mclient = managementClient(spec,
+ self.model.controlCallback,
self.model.configCallback,
self.model.instCallback,
- self.model.methodCallback)
+ self.model.methodCallback,
+ self.model.closeCallback)
self.mclient.schemaListener(self.model.schemaCallback)
self.model.lock.acquire()
@@ -299,7 +301,7 @@
self.currentMethodId = 1
self.outstandingMethodCalls = dict()
self.connections = dict()
-
+ self.connCloseListener = None
self.lock = Lock()
assert MintModel.staticInstance is None
@@ -350,6 +352,9 @@
keys.append(key)
return keys
+ def setCloseListener(self, connCloseListener):
+ self.connCloseListener = connCloseListener
+
def schemaCallback(self, brokerId, classInfo,
configs, metric, methods, events):
cls = schema.schemaNameToClassMap.get(classInfo[1])
@@ -426,7 +431,7 @@
self.log("END INST---------------------------------------------------\n")
return objStats
- def methodCallback(self, broker, methodId, errorNo, errorText, args):
+ def methodCallback(self, brokerId, methodId, errorNo, errorText, args):
self.log("\nMETHOD---------------------------------------------------")
self.log("MethodId=%d" % (methodId))
self.log("Error: %d %s" % (errorNo, errorText))
@@ -437,6 +442,23 @@
self.log("END METHOD---------------------------------------------------\n")
return result
+ def closeCallback(self, brokerId, data):
+ self.log("\nCLOSE---------------------------------------------------")
+ self.log("BrokerId=%s , Data=%s" % (brokerId, data))
+ conn = self.connections[brokerId]
+ if (conn and conn.isOpen()):
+ conn.close()
+ if (self.connCloseListener != None):
+ self.connCloseListener(brokerId, data)
+ self.log("END CLOSE---------------------------------------------------\n")
+ return
+
+ def controlCallback(self, brokerId, type, data):
+ self.log("\nCONTROL---------------------------------------------------")
+ self.log("BrokerId=%s , Type=%s, Data=%s" % (brokerId, type, data))
+ self.log("END CONTROL---------------------------------------------------\n")
+ return
+
def registerCallback(self, callback):
self.currentMethodId += 1
methodId = self.currentMethodId
Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py 2008-05-13 17:08:09 UTC (rev 2041)
+++ mgmt/mint/python/mint/schemaparser.py 2008-05-13 19:04:03 UTC (rev 2042)
@@ -16,8 +16,6 @@
self.currentClass = ""
self.finalPythonOutput = "\nclassToSchemaNameMap = dict()\n"
self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
- #self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (self.dsn)
- #self.pythonOutput += "sqlhub.processConnection = conn\n\n"
# mapping between xml schema types and database column types
# see xml/MintTypes.xml
self.dataTypesMap = dict()
@@ -74,13 +72,19 @@
def generateClassAttribs(self, schemaName, elements):
for elem in elements:
- if (elem["@name"].endswith("Ref")):
- reference = self.style.dbTableToPythonClass(elem["@name"]).replace("Ref", "")
- if (reference != "Store"):
- #FIX
+ # XXX FIX: properly handle a store ref
+ if (elem["@name"] == "storeRef"):
+ continue
+ # XXX FIX: properly handle a store ref
+ if (elem["@type"] == "objId"):
+ if (elem["@name"].endswith("Ref")):
+ reference = self.style.dbTableToPythonClass(elem["@name"]).replace("Ref", "")
attrib = reference[0].lower() + reference[1:]
self.generateForeignKeyAttrib(attrib, reference)
self.generateMultipleJoin(reference, self.currentClass)
+ else:
+ # if reference doesn't have a "Ref" prefix, handle as a large uint
+ self.generateAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap["uint64"])
elif (elem["@type"].startswith("hilo")):
self.generateHiLoAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap[elem["@type"]])
elif (elem["@type"].startswith("mma")):
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-05-13 17:08:09 UTC (rev 2041)
+++ mgmt/mint/sql/schema.sql 2008-05-13 19:04:03 UTC (rev 2042)
@@ -60,7 +60,10 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
- id_ BYTEA
+ session_id BYTEA,
+ label VARCHAR(1000),
+ registered_to BIGINT,
+ sys_id BYTEA
);
CREATE TABLE agent_stats (
@@ -158,7 +161,8 @@
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
- address VARCHAR(1000)
+ address VARCHAR(1000),
+ incoming BOOL
);
CREATE TABLE client_stats (
@@ -235,7 +239,8 @@
stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
- type VARCHAR(1000)
+ type VARCHAR(1000),
+ durable BOOL
);
CREATE TABLE exchange_stats (
@@ -267,8 +272,10 @@
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
- address VARCHAR(1000),
- auth_identity VARCHAR(1000)
+ host VARCHAR(1000),
+ port SMALLINT,
+ use_ssl BOOL,
+ durable BOOL
);
CREATE TABLE link_stats (
@@ -276,11 +283,8 @@
id_original BIGINT,
rec_time TIMESTAMP,
link_id INT,
- closing BOOL,
- frames_from_peer BIGINT,
- frames_to_peer BIGINT,
- bytes_from_peer BIGINT,
- bytes_to_peer BIGINT
+ state VARCHAR(1000),
+ last_error VARCHAR(1000)
);
CREATE TABLE producer (
More information about the rhmessaging-commits
mailing list