Author: justi9
Date: 2010-05-13 14:28:33 -0400 (Thu, 13 May 2010)
New Revision: 3970
Added:
mgmt/newdata/rosemary/bin/rosemary-model
mgmt/newdata/rosemary/instance/model
Removed:
mgmt/newdata/rosemary/bin/rosemary-test
mgmt/newdata/rosemary/instance/xml
Log:
Rename rosemary-test to rosemary-model; fix ddl functionality and model path
Copied: mgmt/newdata/rosemary/bin/rosemary-model (from rev 3969,
mgmt/newdata/rosemary/bin/rosemary-test)
===================================================================
--- mgmt/newdata/rosemary/bin/rosemary-model (rev 0)
+++ mgmt/newdata/rosemary/bin/rosemary-model 2010-05-13 18:28:33 UTC (rev 3970)
@@ -0,0 +1,87 @@
+#!/usr/bin/python
+
+from rosemary.model import *
+from rosemary.sqloperation import *
+
+def do_model(args):
+ for pkg in model._packages:
+ print "package %s" % pkg._name
+
+ for cls in pkg._classes:
+ print " class %s" % cls._name
+
+ for hdr in cls._headers:
+ print " hdr %s %s" % (hdr.name, hdr.title or "")
+
+ for ref in cls._references:
+ print " ref %s %s" % (ref.name, ref.title or "")
+
+ for prop in cls._properties:
+ print " prop %s %s" % (prop.name, prop.title or
"")
+
+ for stat in cls._statistics:
+ print " stat %s %s" % (stat.name, stat.title or
"")
+
+ for meth in cls._methods:
+ print " meth %s" % meth.name
+
+ for arg in meth.arguments:
+ print " arg %s" % arg.name
+
+def do_ddl(args):
+ model.sql_model.write_drop_ddl(sys.stdout)
+ model.sql_model.write_create_ddl(sys.stdout)
+
+def do_dml(args):
+ for schema in model.sql_model._schemas:
+ for table in schema._tables:
+ select = SqlSelectItem(table)
+ insert = SqlInsertItem(table)
+ update = SqlUpdateItem(table)
+ delete = SqlDeleteItem(table)
+
+ print "---", table._name, "---"
+ print
+ print insert.emit(table._columns)
+ print
+ print select.emit(table._columns)
+ print
+ print update.emit(table._columns)
+ print
+ print delete.emit(table._columns)
+ print
+
+def do_query(args):
+ schema = model.sql_model.schemas_by_name["org.apache.qpid.broker"]
+ table = schema.tables_by_name["Queue"]
+ stats_table = schema.tables_by_name["QueueStats"]
+ vhost_table = schema.tables_by_name["Vhost"]
+ broker_table = schema.tables_by_name["Broker"]
+
+ query = SqlQuery(table)
+
+ stats_col = stats_table.columns_by_name["_parent_id"]
+
+ SqlOuterJoin(query, table.key_column, stats_col)
+ SqlInnerJoin(query, table.key_column, vhost_table.key_column)
+
+ broker_col = vhost_table.columns_by_name["_brokerRef_id"]
+
+ SqlInnerJoin(query, broker_col, broker_table.key_column)
+
+ cols = table.columns + vhost_table.columns + broker_table.columns + \
+ stats_table.columns
+
+ print query.emit(cols)
+
+if __name__ == "__main__":
+ model = RosemaryModel()
+
+ model.load_model_dir(os.path.join(os.environ["ROSEMARY_HOME"],
"model"))
+ model.init()
+
+ if len(sys.argv) == 1:
+ print "model, ddl, dml"
+ sys.exit(1)
+
+ globals()["do_%s" % sys.argv[1]](sys.argv[2:])
Deleted: mgmt/newdata/rosemary/bin/rosemary-test
===================================================================
--- mgmt/newdata/rosemary/bin/rosemary-test 2010-05-13 14:58:53 UTC (rev 3969)
+++ mgmt/newdata/rosemary/bin/rosemary-test 2010-05-13 18:28:33 UTC (rev 3970)
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-from rosemary.model import *
-from rosemary.sqloperation import *
-
-def do_model(args):
- for pkg in model._packages:
- print "package %s" % pkg._name
-
- for cls in pkg._classes:
- print " class %s" % cls._name
-
- for hdr in cls._headers:
- print " hdr %s %s" % (hdr.name, hdr.title or "")
-
- for ref in cls._references:
- print " ref %s %s" % (ref.name, ref.title or "")
-
- for prop in cls._properties:
- print " prop %s %s" % (prop.name, prop.title or
"")
-
- for stat in cls._statistics:
- print " stat %s %s" % (stat.name, stat.title or
"")
-
- for meth in cls._methods:
- print " meth %s" % meth.name
-
- for arg in meth.arguments:
- print " arg %s" % arg.name
-
-def do_ddl(args):
- model.sql_model.write_drop_ddl(sys.stdout)
- model.sql_model.write_create_ddl(sys.stdout)
-
-def do_dml(args):
- for schema in model.sql_model.schemas:
- for table in schema.tables:
- select = SqlSelectItem(table)
- insert = SqlInsertItem(table)
- update = SqlUpdateItem(table)
- delete = SqlDeleteItem(table)
-
- print "---", table.name, "---"
- print
- print insert.emit(table.columns)
- print
- print select.emit(table.columns)
- print
- print update.emit(table.columns)
- print
- print delete.emit(table.columns)
- print
-
-def do_query(args):
- schema = model.sql_model.schemas_by_name["org.apache.qpid.broker"]
- table = schema.tables_by_name["Queue"]
- stats_table = schema.tables_by_name["QueueStats"]
- vhost_table = schema.tables_by_name["Vhost"]
- broker_table = schema.tables_by_name["Broker"]
-
- query = SqlQuery(table)
-
- stats_col = stats_table.columns_by_name["_parent_id"]
-
- SqlOuterJoin(query, table.key_column, stats_col)
- SqlInnerJoin(query, table.key_column, vhost_table.key_column)
-
- broker_col = vhost_table.columns_by_name["_brokerRef_id"]
-
- SqlInnerJoin(query, broker_col, broker_table.key_column)
-
- cols = table.columns + vhost_table.columns + broker_table.columns + \
- stats_table.columns
-
- print query.emit(cols)
-
-if __name__ == "__main__":
- model = RosemaryModel()
-
- model.load_xml_dir(os.path.join(os.environ["ROSEMARY_HOME"],
"xml"))
- model.init()
-
- if len(sys.argv) == 1:
- print "model, ddl, dml"
- sys.exit(1)
-
- globals()["do_%s" % sys.argv[1]](sys.argv[2:])
Added: mgmt/newdata/rosemary/instance/model
===================================================================
--- mgmt/newdata/rosemary/instance/model (rev 0)
+++ mgmt/newdata/rosemary/instance/model 2010-05-13 18:28:33 UTC (rev 3970)
@@ -0,0 +1 @@
+link ../../cumin/model
\ No newline at end of file
Property changes on: mgmt/newdata/rosemary/instance/model
___________________________________________________________________
Name: svn:special
+ *
Deleted: mgmt/newdata/rosemary/instance/xml
===================================================================
--- mgmt/newdata/rosemary/instance/xml 2010-05-13 14:58:53 UTC (rev 3969)
+++ mgmt/newdata/rosemary/instance/xml 2010-05-13 18:28:33 UTC (rev 3970)
@@ -1 +0,0 @@
-link ../xml
\ No newline at end of file
Show replies by date