Author: nunofsantos
Date: 2008-06-04 17:20:00 -0400 (Wed, 04 Jun 2008)
New Revision: 2129
Modified:
mgmt/mint/python/mint/schema.py
mgmt/mint/python/mint/schemaparser.py
mgmt/mint/sql/schema.sql
Log:
parser now handles references to a class in a different namespace
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2008-06-04 18:18:39 UTC (rev 2128)
+++ mgmt/mint/python/mint/schema.py 2008-06-04 21:20:00 UTC (rev 2129)
@@ -604,9 +604,17 @@
managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('StoreStats', cascade='null', default=None)
statsPrev = ForeignKey('StoreStats', cascade='null', default=None)
+ broker = ForeignKey('Broker', cascade='null', default=None)
+ location = StringCol(length=1000, default=None)
+ async = BoolCol(default=None)
+ defaultInitialFileCount = SmallIntCol(default=None)
+ defaultDataFileSize = IntCol(default=None)
classInfos = dict() # brokerId => classInfo
+Broker.sqlmeta.addJoin(SQLMultipleJoin('Store',
joinMethodName='stores'))
+
+
class StoreStats(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -631,6 +639,14 @@
managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('JournalStats', cascade='null', default=None)
statsPrev = ForeignKey('JournalStats', cascade='null', default=None)
+ name = StringCol(length=1000, default=None)
+ queue = ForeignKey('Queue', cascade='null', default=None)
+ journalDirectory = StringCol(length=1000, default=None)
+ journalBaseFileName = StringCol(length=1000, default=None)
+ journalWritePageSize = IntCol(default=None)
+ journalWritePages = IntCol(default=None)
+ journalReadPageSize = IntCol(default=None)
+ journalReadPages = IntCol(default=None)
classInfos = dict() # brokerId => classInfo
@@ -643,6 +659,9 @@
conn.callMethod(self.idOriginal, classInfo, "expand",
callback, args=actualArgs)
+Queue.sqlmeta.addJoin(SQLMultipleJoin('Journal',
joinMethodName='journals'))
+
+
class JournalStats(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -650,12 +669,39 @@
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
journal = ForeignKey('Journal', cascade='null', default=None)
+ initialFileCount = SmallIntCol(default=None)
+ dataFileSize = IntCol(default=None)
+ journalCurrentFileCount = IntCol(default=None)
+ journalRecordDepth = IntCol(default=None)
+ journalRecordDepthLow = IntCol(default=None)
+ journalRecordDepthHigh = IntCol(default=None)
+ journalRecordEnqueues = BigIntCol(default=None)
+ journalRecordDequeues = BigIntCol(default=None)
+ journalOutstandingAIOs = IntCol(default=None)
+ journalOutstandingAIOsLow = IntCol(default=None)
+ journalOutstandingAIOsHigh = IntCol(default=None)
+ journalFreeFileCount = IntCol(default=None)
+ journalFreeFileCountLow = IntCol(default=None)
+ journalFreeFileCountHigh = IntCol(default=None)
+ journalAvailableFileCount = IntCol(default=None)
+ journalAvailableFileCountLow = IntCol(default=None)
+ journalAvailableFileCountHigh = IntCol(default=None)
+ journalWriteWaitFailures = BigIntCol(default=None)
+ journalWriteBusyFailures = BigIntCol(default=None)
+ journalReadRecordCount = BigIntCol(default=None)
+ journalReadBusyFailures = BigIntCol(default=None)
+ journalWritePageCacheDepth = IntCol(default=None)
+ journalWritePageCacheDepthLow = IntCol(default=None)
+ journalWritePageCacheDepthHigh = IntCol(default=None)
+ journalReadPageCacheDepth = IntCol(default=None)
+ journalReadPageCacheDepthLow = IntCol(default=None)
+ journalReadPageCacheDepthHigh = IntCol(default=None)
classInfos = dict() # brokerId => classInfo
Journal.sqlmeta.addJoin(SQLMultipleJoin('JournalStats',
joinMethodName='stats'))
-classToSchemaNameMap['Store'] = 'store'
-schemaNameToClassMap['store'] = Store
-classToSchemaNameMap['Journal'] = 'journal'
-schemaNameToClassMap['journal'] = Journal
+classToSchemaNameMap['Store'] = 'Store'
+schemaNameToClassMap['Store'] = Store
+classToSchemaNameMap['Journal'] = 'Journal'
+schemaNameToClassMap['Journal'] = Journal
Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py 2008-06-04 18:18:39 UTC (rev 2128)
+++ mgmt/mint/python/mint/schemaparser.py 2008-06-04 21:20:00 UTC (rev 2129)
@@ -80,13 +80,20 @@
self.pythonOutput += " lazyUpdate = %s\n\n" % (lazyUpdate)
def generateClassAttribs(self, schemaName, elements):
+ if (schemaName == "JournalStats"):
+ print schemaName
for elem in elements:
# special handling due to name conflict with SqlObject.connection
if (elem["@name"] == "connection"):
elem["@name"] = "clientConnection"
if (elem["@type"] == "objId"):
if (elem["(a)name"].endswith("Ref")):
- reference = self.style.dbTableToPythonClass(elem["@references"])
+ reference = elem["@references"]
+ # handle cases where the referenced class is in a different namespace (ie,
contains a ".")
+ namespaceIndex = reference.find(".")
+ if (namespaceIndex > 0):
+ reference = reference[namespaceIndex + 1:]
+ reference = self.style.dbTableToPythonClass(reference)
if (reference == "Connection"):
reference = "ClientConnection"
attrib = reference[0].lower() + reference[1:]
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-06-04 18:18:39 UTC (rev 2128)
+++ mgmt/mint/sql/schema.sql 2008-06-04 21:20:00 UTC (rev 2129)
@@ -223,14 +223,49 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_curr_id INT,
- stats_prev_id INT
+ stats_prev_id INT,
+ name VARCHAR(1000),
+ queue_id INT,
+ journal_directory VARCHAR(1000),
+ journal_base_file_name VARCHAR(1000),
+ journal_write_page_size INT,
+ journal_write_pages INT,
+ journal_read_page_size INT,
+ journal_read_pages INT
);
CREATE TABLE journal_stats (
id SERIAL PRIMARY KEY,
id_original BIGINT,
rec_time TIMESTAMP,
- journal_id INT
+ journal_id INT,
+ initial_file_count SMALLINT,
+ data_file_size INT,
+ journal_current_file_count INT,
+ journal_record_depth INT,
+ journal_record_depth_low INT,
+ journal_record_depth_high INT,
+ journal_record_enqueues BIGINT,
+ journal_record_dequeues BIGINT,
+ journal_outstanding_ai_os INT,
+ journal_outstanding_ai_os_low INT,
+ journal_outstanding_ai_os_high INT,
+ journal_free_file_count INT,
+ journal_free_file_count_low INT,
+ journal_free_file_count_high INT,
+ journal_available_file_count INT,
+ journal_available_file_count_low INT,
+ journal_available_file_count_high INT,
+ journal_write_wait_failures BIGINT,
+ journal_write_busy_failures BIGINT,
+ journal_read_record_count BIGINT,
+ journal_read_busy_failures BIGINT,
+ journal_write_page_cache_depth INT,
+ journal_write_page_cache_depth_low INT,
+ journal_write_page_cache_depth_high INT,
+ journal_read_page_cache_depth INT,
+ journal_read_page_cache_depth_low INT,
+ journal_read_page_cache_depth_high INT
);
CREATE TABLE link (
@@ -355,7 +390,12 @@
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
stats_curr_id INT,
- stats_prev_id INT
+ stats_prev_id INT,
+ broker_id INT,
+ location VARCHAR(1000),
+ async BOOL,
+ default_initial_file_count SMALLINT,
+ default_data_file_size INT
);
CREATE TABLE store_stats (
@@ -473,6 +513,8 @@
ALTER TABLE journal ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES journal_stats (id) ON DELETE SET NULL;
+ALTER TABLE journal ADD CONSTRAINT queue_id_exists FOREIGN KEY (queue_id) REFERENCES
queue (id) ON DELETE SET NULL;
+
ALTER TABLE journal_stats ADD CONSTRAINT journal_id_exists FOREIGN KEY (journal_id)
REFERENCES journal (id) ON DELETE SET NULL;
ALTER TABLE link ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES link_stats (id) ON DELETE SET NULL;
@@ -505,6 +547,8 @@
ALTER TABLE store ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id)
REFERENCES store_stats (id) ON DELETE SET NULL;
+ALTER TABLE store ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES
broker (id) ON DELETE SET NULL;
+
ALTER TABLE store_stats ADD CONSTRAINT store_id_exists FOREIGN KEY (store_id) REFERENCES
store (id) ON DELETE SET NULL;
ALTER TABLE system ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES system_stats (id) ON DELETE SET NULL;