Author: justi9
Date: 2007-10-15 13:53:49 -0400 (Mon, 15 Oct 2007)
New Revision: 1071
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
Log:
Adds a ConfigProperty object to the demo model and data and associates
it with Server.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-15 17:53:10 UTC (rev 1070)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-15 17:53:49 UTC (rev 1071)
@@ -63,6 +63,21 @@
server = Server(self.model)
server.name = fmt("server", server_count)
+ prop = ConfigProperty(self.model)
+ prop.name = "max_threads"
+ prop.value = 1000
+ server.add_config_property(prop)
+
+ prop = ConfigProperty(self.model)
+ prop.name = "max_memory"
+ prop.value = 1000000
+ server.add_config_property(prop)
+
+ prop = ConfigProperty(self.model)
+ prop.name = "ssl_enabled"
+ prop.value = True
+ server.add_config_property(prop)
+
index = server_count % 4
if index < 3:
server.set_cluster(clusters[index])
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-15 17:53:10 UTC (rev 1070)
+++ mgmt/cumin/python/cumin/model.py 2007-10-15 17:53:49 UTC (rev 1071)
@@ -7,6 +7,7 @@
self.cluster = ModelClass(self, "cluster")
self.server = ModelClass(self, "server")
+ self.config_property = ModelClass(self, "config_property")
self.server_group = ModelClass(self, "server_group")
self.server_group_type = ModelClass(self, "server_group_type")
self.virtual_host = ModelClass(self, "virtual_host")
@@ -24,6 +25,10 @@
assoc.add_endpoint(self.virtual_host, "cluster", "0..1")
assoc.add_endpoint(self.cluster, "virtual_host", "0..n")
+ assoc = ModelAssociation(self, "server_to_config_properties")
+ assoc.add_endpoint(self.config_property, "server", "0..1")
+ assoc.add_endpoint(self.server, "config_property", "0..n")
+
assoc = ModelAssociation(self, "server_to_virtual_hosts")
assoc.add_endpoint(self.virtual_host, "server", "0..1")
assoc.add_endpoint(self.server, "virtual_host", "0..n")
@@ -150,6 +155,13 @@
writer.write("</server>")
+class ConfigProperty(ModelObject):
+ def __init__(self, model):
+ super(ConfigProperty, self).__init__(model, model.config_property)
+
+ self.name = None
+ self.value = None
+
class ServerGroup(ModelObject):
def __init__(self, model):
super(ServerGroup, self).__init__(model, model.server_group)