rhmessaging commits: r1775 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-19 09:31:48 -0400 (Wed, 19 Mar 2008)
New Revision: 1775
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
Fixes a broken page.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-19 13:31:22 UTC (rev 1774)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-19 13:31:48 UTC (rev 1775)
@@ -78,10 +78,11 @@
super(CuminFrame, self).do_process(session, *args)
def render_href(self, session, *args):
- branch = session.branch()
- self.page().set_current_frame(branch, self)
- self.show_view(branch)
- return branch.marshal()
+ if self.get_object(session):
+ branch = session.branch()
+ self.page().set_current_frame(branch, self)
+ self.show_view(branch)
+ return branch.marshal()
class CuminView(Widget):
def get_args(self, session):
16 years, 9 months
rhmessaging commits: r1774 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-19 09:31:22 -0400 (Wed, 19 Mar 2008)
New Revision: 1774
Modified:
mgmt/cumin/python/wooly/devel.py
Log:
I use cumin-bench to check for broken pages. Print out the page
currently being visited before we actually do anything with it (and it
explodes) so I can manually check that page.
Modified: mgmt/cumin/python/wooly/devel.py
===================================================================
--- mgmt/cumin/python/wooly/devel.py 2008-03-19 12:59:51 UTC (rev 1773)
+++ mgmt/cumin/python/wooly/devel.py 2008-03-19 13:31:22 UTC (rev 1774)
@@ -19,6 +19,8 @@
visited.add(url)
break
+ print count, url,
+
start = clock()
session = Session(self.app)
@@ -32,7 +34,7 @@
bytes = len(html)
millis = (clock() - start) * 1000
- print count, bytes, millis, url
+ print "[%i bytes, %i millis]" % (bytes, millis)
if count == max:
break
16 years, 9 months
rhmessaging commits: r1773 - in mgmt: cumin/python/cumin and 3 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-19 08:59:51 -0400 (Wed, 19 Mar 2008)
New Revision: 1773
Modified:
mgmt/bin/devel
mgmt/cumin/python/cumin/action.py
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/brokerprofile.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/configproperty.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/realm.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/system.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/devel.py
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/pages.py
mgmt/cumin/python/wooly/server.py
mgmt/cumin/python/wooly/tables.py
mgmt/cumin/python/wooly/widgets.py
mgmt/misc/boneyard.py
mgmt/notes/justin-todo.txt
Log:
A change to address a long-standing API issue.
* get_title is gone; if you want to call render_title outside of a
widget.render call, you need to provide the correct arguments by
calling widget.get_args(session)
* Each widget can define the arguments passed to its internal
do_render and render_xxx calls by defining get_args(session).
* I removed the experimental features for passing args that didn't
pan out.
Modified: mgmt/bin/devel
===================================================================
--- mgmt/bin/devel 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/bin/devel 2008-03-19 12:59:51 UTC (rev 1773)
@@ -11,6 +11,6 @@
source "etc/devel.profile"
-devel-etags
+make tags
exec emacs -nw -l "etc/devel.el"
Modified: mgmt/cumin/python/cumin/action.py
===================================================================
--- mgmt/cumin/python/cumin/action.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/action.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -21,14 +21,14 @@
self.add_column(col)
class DescriptionColumn(ItemTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, item):
return "Description"
def render_content(self, session, item):
return item.get_description(session)
class WhenColumn(ItemTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, item):
return "When"
def render_content(self, session, item):
@@ -40,7 +40,7 @@
""
class StatusColumn(ItemTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, item):
return "Status"
def render_content(self, session, item):
@@ -57,7 +57,7 @@
return text
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
return reversed(sorted_by(self.app.model.invocations, "when"))
class ActionPage(Page):
@@ -67,5 +67,5 @@
self.__actions = ActionInvocationSet(app, "actions")
self.add_child(self.__actions)
- def get_title(self, session, object):
+ def render_title(self, session, *args):
return "Actions"
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -44,15 +44,15 @@
self.groupify = self.Groupify(app, "groupify", self)
self.add_child(self.groupify)
- def get_title(self, session, model):
+ def render_title(self, session, *args):
count = BrokerRegistration.select().count()
return "Brokers %s" % fmt_count(count)
class Unregister(FormButton):
- def render_content(self, session, model):
+ def render_content(self, session):
return "Unregister"
- def process_submit(self, session, model):
+ def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
@@ -62,14 +62,14 @@
self.page().set_redirect_url(session, branch.marshal())
class BrokerSetGroupInput(BrokerGroupInput):
- def render_submit_id(self, session, model):
+ def render_submit_id(self, session):
return self.parent.groupify.path()
class Groupify(FormButton):
- def render_content(self, session, model):
+ def render_content(self, session):
return "Add"
- def process_submit(self, session, model):
+ def process_submit(self, session):
group = self.parent.groups.get(session)
if group:
@@ -86,7 +86,7 @@
self.page().set_redirect_url(session, session.marshal())
class NameColumn(SqlTableColumn):
- def get_title(self, session, model):
+ def render_title(self, session, data):
return "Name"
def render_content(self, session, data):
@@ -96,7 +96,7 @@
return fmt_olink(branch, broker, name=data["name"])
class GroupsColumn(SqlTableColumn):
- def get_title(self, session, model):
+ def render_title(self, session, data):
return "Groups"
def get_orderby_sql(self, session):
@@ -181,7 +181,7 @@
self.page().set_current_frame(session, self.clients_close)
return self.show_mode(session, self.clients_close)
- def get_title(self, session, broker):
+ def render_title(self, session, broker):
return "Broker '%s'" % broker.name
class BrokerStatus(CuminStatus):
@@ -221,7 +221,7 @@
def show_config(self, session):
return self.tabs.show_mode(session, self.config)
- def get_title(self, session, reg):
+ def render_title(self, session, reg):
return "Broker '%s'" % reg.name
def do_process(self, session, reg):
@@ -232,7 +232,7 @@
super(BrokerView, self).do_process(session, reg)
- def render_data_url(self, session, model):
+ def render_data_url(self, session, reg):
return "model.xml"
def render_address(self, session, reg):
@@ -276,42 +276,48 @@
self.__queues = QueueSet(app, "items")
self.add_child(self.__queues)
- def get_object(self, session, reg):
- return self.parent.parent.parent.vhost.get(session)
+ def get_args(self, session):
+ return self.frame().get_args(session)
- def get_title(self, session, reg):
+ def render_title(self, session, reg):
vhost = reg.getDefaultVhost()
return "Queues %s" % fmt_count(vhost.queues.count())
- def render_add_queue_href(self, session, object):
+ def render_add_queue_href(self, session, reg):
branch = session.branch()
self.frame().show_queue(branch, None).show_add(branch)
return branch.marshal()
class BrokerExchangeTab(ExchangeSet):
- def get_object(self, session, reg):
- return self.parent.parent.parent.vhost.get(session)
+ def get_args(self, session):
+ return self.frame().get_args(session)
- def get_title(self, session, broker):
- vhost = self.parent.parent.parent.vhost.get(session)
- return super(BrokerView.BrokerExchangeTab, self).get_title \
+ def render_title(self, session, reg):
+ vhost = reg.getDefaultVhost()
+ return super(BrokerView.BrokerExchangeTab, self).render_title \
(session, vhost)
class BrokerClientTab(ClientSet):
- def get_object(self, session, reg):
- return self.parent.parent.parent.vhost.get(session)
+ def get_args(self, session):
+ return self.frame().get_args(session)
- def get_title(self, session, broker):
- vhost = self.parent.parent.parent.vhost.get(session)
- return super(BrokerView.BrokerClientTab, self).get_title \
+ def render_title(self, session, reg):
+ vhost = reg.getDefaultVhost()
+ return super(BrokerView.BrokerClientTab, self).render_title \
(session, vhost)
class BrokerStatsTab(Widget):
- def get_title(self, session, broker):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, reg):
return "Statistics"
class BrokerLogTab(Widget):
- def get_title(self, session, broker):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, reg):
return "Log Messages"
class BrokerBrowser(Widget):
@@ -334,11 +340,11 @@
self.brokers = self.BrowserBrokers(app, "brokers")
self.add_child(self.brokers)
- def get_title(self, session, model):
+ def render_title(self, session, *args):
return "Brokers %s" % fmt_count(BrokerRegistration.select().count())
class BrowserBrokers(BrokerSet):
- def render_sql_where(self, session, object):
+ def render_sql_where(self, session):
elems = list()
group = self.parent.group.get(session)
#profile = self.parent.profile.get(session)
@@ -355,33 +361,33 @@
if elems:
return "where %s" % " and ".join(elems)
- def render_add_broker_href(self, session, model):
+ def render_add_broker_href(self, session):
branch = session.branch()
self.frame().show_brokers_add(branch)
return branch.marshal()
- def render_clear_filters_href(self, session, model):
+ def render_clear_filters_href(self, session):
branch = session.branch()
self.group.set(branch, None)
self.profile.set(branch, None)
self.cluster.set(branch, None)
return branch.marshal()
- def render_group_filters(self, session, model):
+ def render_group_filters(self, session):
groups = BrokerGroup.select()
return self._render_filters(session, groups, self.group_tmpl)
def render_group_link(self, session, group):
return self._render_filter_link(session, group, self.group)
- def render_profile_filters(self, session, model):
+ def render_profile_filters(self, session):
profiles = BrokerProfile.select()
return self._render_filters(session, profiles, self.profile_tmpl)
def render_profile_link(self, session, profile):
return self._render_filter_link(session, profile, self.profile)
- def render_cluster_filters(self, session, model):
+ def render_cluster_filters(self, session):
clusters = BrokerCluster.select()
return self._render_filters(session, clusters, self.cluster_tmpl)
@@ -392,9 +398,9 @@
writer = Writer()
for object in collection:
- template.render(session, object, writer)
+ template.render(writer, session, object)
- template.render(session, None, writer)
+ template.render(writer, session, None)
return writer.to_string()
@@ -458,19 +464,19 @@
def get_default(self, session):
return dict()
- def process_display(self, session, object):
+ def process_display(self, session):
if self.more.get(session):
self.fields.set(session, self.fields.get(session) + 3)
- def render_fields(self, session, object):
+ def render_fields(self, session):
writer = Writer()
for i in range(self.fields.get(session)):
- self.field_tmpl.render(session, i, writer)
+ self.field_tmpl.render(writer, session, i)
return writer.to_string()
- def render_field_name_name(self, session, object):
+ def render_field_name_name(self, session, index):
return self.names.path()
def render_field_name_value(self, session, index):
@@ -484,7 +490,7 @@
return "<ul class=\"errors\"><li>%s</li></ul>" % \
"</li><li>".join(errors[index])
- def render_field_address_name(self, session, object):
+ def render_field_address_name(self, session, index):
return self.addrs.path()
def render_field_address_value(self, session, index):
@@ -498,45 +504,39 @@
return "<ul class=\"errors\"><li>%s</li></ul>" % \
"</li><li>".join(errors[index])
- def render_field_group_name(self, session, object):
+ def render_field_group_name(self, session, index):
return self.groups.path()
def render_groups(self, session, index):
writer = Writer()
for group in BrokerGroup.select():
- self.group_tmpl.render(session, (index, group), writer)
+ self.group_tmpl.render(writer, session, index, group)
return writer.to_string()
- def render_group_value(self, session, args):
- index, group = args
+ def render_group_value(self, session, index, group):
return group.id
- def render_group_name(self, session, args):
- index, group = args
+ def render_group_name(self, session, index, group):
return group.name
- def render_group_selected_attr(self, session, args):
- index, group = args
+ def render_group_selected_attr(self, session, index, group):
groups = self.groups.get(session)
if len(groups) > index and group.id == groups[index].id:
return "selected=\"selected\""
class MoreEntries(FormButton):
- def render_content(self, session, model):
+ def render_content(self, session):
return "More Entries"
class BrokerSetAdd(BrokerSetForm):
- def get_title(self, session, object):
- return "Register New Brokers"
-
- def process_cancel(self, session, model):
+ def process_cancel(self, session):
branch = session.branch()
self.frame().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, model):
+ def process_submit(self, session):
action = self.app.model.broker_registration.add
addrs = self.addrs.get(session)
@@ -571,7 +571,7 @@
if group:
reg.addBrokerGroup(group)
- self.process_cancel(session, model)
+ self.process_cancel(session)
def validate(self, session, addrs, names, groups):
nerrs = self.name_errors.get(session)
@@ -596,6 +596,9 @@
return not len(nerrs) and not len(aerrs)
+ def render_title(self, session):
+ return "Register New Brokers"
+
class BrokerEdit(CuminFieldForm):
def __init__(self, app, name):
super(BrokerEdit, self).__init__(app, name)
@@ -605,8 +608,11 @@
self.groups = BrokerGroupCheckboxField(app, "groups", self)
self.add_field(self.groups)
+
+ def get_args(self, session):
+ return self.frame().get_args(session)
- def get_title(self, session, reg):
+ def render_title(self, session, reg):
return "Edit Broker '%s'" % reg.name
def process_cancel(self, session, reg):
@@ -643,34 +649,33 @@
for group in reg.groups:
self.groups.get(session).append(group)
-# XXX use reg, not broker, where appropriate
class BrokerRemove(CuminConfirmForm):
- def get_title(self, session, broker):
- return "Unregister Broker '%s'" % broker.name
-
- def process_cancel(self, session, broker):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def process_cancel(self, session, reg):
branch = session.branch()
self.frame().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, broker):
+ def process_submit(self, session, reg):
action = self.app.model.broker_registration.remove
- action.invoke(broker)
+ action.invoke(reg)
branch = session.branch()
self.page().show_main(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def render_submit_content(self, session, broker):
- return "Yes, Unregister Broker '%s'" % broker.name
+ def render_title(self, session, reg):
+ return "Unregister Broker '%s'" % reg.name
- def render_cancel_content(self, session, broker):
+ def render_submit_content(self, session, reg):
+ return "Yes, Unregister Broker '%s'" % reg.name
+
+ def render_cancel_content(self, session, reg):
return "No, Cancel"
class BrokerSetRemove(CuminBulkActionForm, Frame):
- def get_title(self, session, model):
- return "Unregister Brokers"
-
def process_return(self, session, id):
branch = session.branch()
frame = self.frame()
@@ -683,6 +688,9 @@
# XXX need to handle object not found case
action.invoke(BrokerRegistration.get(id))
+ def render_title(self, session):
+ return "Unregister Brokers"
+
def render_item_content(self, session, id):
return "Unregister Broker '%s'" % BrokerRegistration.get(id).name
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/brokercluster.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -13,15 +13,15 @@
strings = StringCatalog(__file__)
class BrokerClusterSet(SQLObjectItemSet):
- def render_cluster_add_href(self, session, model):
+ def render_cluster_add_href(self, session, *args):
branch = session.branch()
self.page().show_broker_cluster_add(branch)
return branch.marshal()
- def get_title(self, session, model):
+ def render_title(self, session, *args):
return "Broker Clusters %s" % fmt_count(BrokerCluster.select().count())
- def do_get_items(self, session, model):
+ def do_get_items(self, session, *args):
return BrokerCluster.select()
def render_item_link(self, session, cluster):
@@ -67,7 +67,7 @@
self.broker.set_object(session, broker)
return self.show_mode(session, self.broker)
- def get_title(self, session, cluster):
+ def render_title(self, session, cluster):
return "Broker Cluster '%s'" % cluster.name
class BrokerClusterStatus(CuminStatus):
@@ -86,21 +86,27 @@
self.tabs.add_tab(self.ClusterBrokerTab(app, "brokers"))
self.tabs.add_tab(self.ClusterStatsTab(app, "stats"))
- def get_title(self, session, cluster):
+ def render_title(self, session, cluster):
return "Broker Cluster '%s'" % cluster.name
def render_name(self, session, cluster):
return cluster.name
class ClusterBrokerTab(BrokerSet):
- def get_title(self, session, cluster):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, cluster):
return "Brokers %s" % fmt_count(len(cluster.brokers))
def do_get_items(self, session, cluster):
return cluster.brokers
class ClusterStatsTab(Widget):
- def get_title(self, session, cluster):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, cluster):
return "Statistics"
class BrokerClusterForm(CuminForm):
@@ -118,21 +124,21 @@
self.page().set_redirect_url(session, branch.marshal())
class BrokerClusterAdd(BrokerClusterForm, Frame):
- def get_title(self, session, model):
+ def render_title(self, session):
return "Add Cluster"
- def process_cancel(self, session, model):
+ def process_cancel(self, session):
branch = session.branch()
self.page().show_main(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, model):
+ def process_submit(self, session):
cluster = BrokerCluster()
self.process_cluster(session, cluster)
class BrokerClusterEdit(BrokerClusterForm, Frame):
- def get_title(self, session, cluster):
- return "Edit Cluster '%s'" % cluster.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, cluster):
branch = session.branch()
@@ -145,9 +151,12 @@
def process_display(self, session, cluster):
self.cluster_name.set(session, cluster.name)
+ def render_title(self, session, cluster):
+ return "Edit Cluster '%s'" % cluster.name
+
class BrokerClusterRemove(CuminConfirmForm):
- def get_title(self, session, cluster):
- return "Remove Broker Cluster '%s'" % cluster.name
+ def get_args(self, session):
+ return self.get_args(session)
def process_cancel(self, session, cluster):
branch = session.branch()
@@ -161,6 +170,9 @@
self.page().show_main(branch)
self.page().set_redirect_url(session, branch.marshal())
+ def render_title(self, session, cluster):
+ return "Remove Broker Cluster '%s'" % cluster.name
+
def render_submit_content(self, session, cluster):
return "Yes, Remove Broker Cluster '%s'" % cluster.name
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/brokergroup.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -21,16 +21,16 @@
#col = self.StatusColumn(app, "status")
#self.add_column(col)
- def get_title(self, session, model):
+ def render_title(self, session):
return "Broker Groups %s" % fmt_count(BrokerGroup.select().count())
- def render_group_add_href(self, session, model):
+ def render_group_add_href(self, session):
branch = session.branch()
self.frame().show_broker_group(branch, None).show_add(branch)
return branch.marshal()
class NameColumn(SqlTableColumn):
- def get_title(self, session, model):
+ def render_title(self, session, data):
return "Name"
def render_content(self, session, data):
@@ -47,7 +47,7 @@
self.add_parameter(param)
self.set_parameter(param)
- def do_get_items(self, session, model):
+ def do_get_items(self, session, *args):
return BrokerGroup.select()
def render_item_value(self, session, group):
@@ -68,7 +68,7 @@
self.set_parameter(self.__inputs.get_parameter())
- def get_title(self, session, object):
+ def render_title(self, session):
return "Broker Groups"
class BrokerGroupFrame(CuminFrame):
@@ -95,7 +95,7 @@
self.add_child(remove)
self.set_remove_mode(remove)
- def get_title(self, session, group):
+ def render_title(self, session, group):
if group:
title = "Broker Group '%s'" % group.name
else:
@@ -118,14 +118,17 @@
self.tabs.add_tab(self.GroupBrokerTab(app, "brokers"))
- def get_title(self, session, group):
+ def render_title(self, session, group):
return "Broker Group '%s'" % group.name
def render_name(self, session, group):
return group.name
class GroupBrokerTab(BrokerSet):
- def get_title(self, session, group):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, group):
return "Brokers %s" % \
fmt_count(self.get_item_count(session, group))
@@ -145,17 +148,14 @@
self.add_field(self.group_name)
class BrokerGroupAdd(BrokerGroupForm):
- def get_title(self, session, model):
- return "Add Group"
-
- def process_cancel(self, session, model):
+ def process_cancel(self, session):
branch = session.branch()
self.page().pop_current_frame(branch)
self.page().pop_current_frame(branch)
self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, model):
+ def process_submit(self, session):
errors = self.validate(session)
if errors:
@@ -165,11 +165,14 @@
method = self.app.model.broker_group.add
method.invoke(None, args)
- self.process_cancel(session, model)
+ self.process_cancel(session)
+ def render_title(self, session):
+ return "Add Group"
+
class BrokerGroupEdit(BrokerGroupForm):
- def get_title(self, session, group):
- return "Edit Group '%s'" % group.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, group):
branch = session.branch()
@@ -192,9 +195,12 @@
def process_display(self, session, group):
self.group_name.set(session, group.name)
+ def render_title(self, session, group):
+ return "Edit Group '%s'" % group.name
+
class BrokerGroupRemove(CuminConfirmForm, Frame):
- def get_title(self, session, group):
- return "Remove Broker Group '%s'" % group.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, group):
branch = session.branch()
@@ -213,6 +219,9 @@
self.page().pop_current_frame(branch)
self.page().set_redirect_url(session, branch.marshal())
+ def render_title(self, session, group):
+ return "Remove Broker Group '%s'" % group.name
+
def render_submit_content(self, session, group):
return "Yes, Remove Broker Group '%s'" % group.name
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -12,15 +12,15 @@
strings = StringCatalog(__file__)
class BrokerProfileSet(SQLObjectItemSet):
- def render_profile_add_href(self, session, profile):
+ def render_profile_add_href(self, session, *args):
branch = session.branch()
self.page().show_broker_profile_add(branch)
return branch.marshal()
- def get_title(self, session, model):
+ def render_title(self, session, *args):
return "Broker Profiles %s" % fmt_count(BrokerProfile.select().count())
- def do_get_items(self, session, model):
+ def do_get_items(self, session, *args):
return BrokerProfile.select()
def render_item_link(self, session, profile):
@@ -48,7 +48,7 @@
self.add_mode(self.remove)
self.set_remove_mode(self.remove)
- def get_title(self, session, profile):
+ def render_title(self, session, profile):
return "Broker Profile '%s'" % profile.name
class BrokerProfileView(CuminView):
@@ -61,24 +61,30 @@
self.tabs.add_tab(self.ProfileConfigTab(app, "config"))
self.tabs.add_tab(self.ProfileBrokerTab(app, "brokers"))
- def get_title(self, session, profile):
+ def render_title(self, session, profile):
return "Broker Profile '%s'" % profile.name
def render_name(self, session, profile):
return profile.name
class ProfileConfigTab(ConfigPropertySet):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
def do_get_items(self, session, profile):
return sorted_by(profile.properties)
- def get_title(self, session, profile):
+ def render_title(self, session, profile):
return "Configuration"
class ProfileBrokerTab(BrokerSet):
def __init__(self, app, name):
super(BrokerProfileView.ProfileBrokerTab, self).__init__(app, name)
- def get_title(self, session, profile):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, profile):
return "Brokers %s" % fmt_count(len(profile.brokers))
def do_get_items(self, session, profile):
@@ -119,21 +125,21 @@
self.page().set_redirect_url(session, branch.marshal())
class BrokerProfileAdd(BrokerProfileForm, Frame):
- def get_title(self, session, model):
+ def render_title(self, session):
return "Add Profile"
- def process_cancel(self, session, model):
+ def process_cancel(self, session):
branch = session.branch()
self.page().show_main(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, model):
+ def process_submit(self, session):
profile = BrokerProfile()
self.process_profile(session, profile)
class BrokerProfileEdit(BrokerProfileForm, Frame):
- def get_title(self, session, profile):
- return "Edit Profile '%s'" % profile.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, profile):
branch = session.branch()
@@ -146,9 +152,12 @@
def process_display(self, session, profile):
self.profile_name.set(session, profile.name)
+ def render_title(self, session, profile):
+ return "Edit Profile '%s'" % profile.name
+
class BrokerProfileRemove(CuminConfirmForm):
- def get_title(self, session, profile):
- return "Remove Broker Profile '%s'" % profile.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, profile):
branch = session.branch()
@@ -162,6 +171,9 @@
self.page().show_main(branch)
self.page().set_redirect_url(session, branch.marshal())
+ def render_title(self, session, profile):
+ return "Remove Broker Profile '%s'" % profile.name
+
def render_submit_content(self, session, profile):
return "Yes, Remove Broker Profile '%s'" % profile.name
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/client.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -45,12 +45,15 @@
self.__close = self.Close(app, "close", self)
self.add_child(self.__close)
- def get_title(self, session, vhost):
- return "Clients %s" % fmt_count(vhost.clients.count())
+ def get_args(self, session):
+ return self.frame().get_args(session)
def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Frames"
+ def render_title(self, session, vhost):
+ return "Clients %s" % fmt_count(vhost.clients.count())
+
def render_sql_where(self, session, vhost):
elems = list()
elems.append("l.vhost_id = %(id)r")
@@ -61,10 +64,10 @@
return {"id": vhost.id}
class Close(FormButton):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Close"
- def process_submit(self, session, model):
+ def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
@@ -74,7 +77,7 @@
self.page().set_redirect_url(session, branch.marshal())
class AddressColumn(SqlTableColumn):
- def get_title(self, session, vhost):
+ def render_title(self, session, data):
return "Address"
def render_content(self, session, data):
@@ -84,7 +87,7 @@
return fmt_olink(branch, client, name=data["addr"])
class SessionsColumn(SqlTableColumn):
- def get_title(self, session, vhost):
+ def render_title(self, session, data):
return "Sessions"
def render_content(self, session, data):
@@ -97,7 +100,7 @@
return "XXX"
class SentColumn(NullSortColumn):
- def get_title(self, session, vhost):
+ def render_title(self, session, data):
return "%s Sent" % self.parent.get_unit_plural(session)
def get_column_key(self, session):
@@ -108,7 +111,7 @@
return fmt_rate(value, "", "sec")
class ReceivedColumn(NullSortColumn):
- def get_title(self, session, vhost):
+ def render_title(self, session, data):
return "%s Received" % self.parent.get_unit_plural(session)
def get_column_key(self, session):
@@ -148,7 +151,7 @@
def show_sessions_close(self, session):
return self.show_mode(session, self.sessions_close)
- def get_title(self, session, client):
+ def render_title(self, session, client):
return "Client %s" % client.address
def doit(error, args):
@@ -157,8 +160,8 @@
#print "did it!"
class ClientClose(CuminConfirmForm):
- def get_title(self, session, client):
- return "Close Client '%s'" % client.address
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, client):
branch = session.branch()
@@ -173,6 +176,9 @@
else:
self.process_cancel(session, client)
+ def render_title(self, session, client):
+ return "Close Client '%s'" % client.address
+
def render_submit_content(self, session, client):
return "Yes, Close Client '%s'" % client.address
@@ -180,10 +186,7 @@
return "No, Cancel"
class ClientSetClose(CuminBulkActionForm):
- def get_title(self, session, object):
- return "Close Clients"
-
- def process_return(self, session, object):
+ def process_return(self, session):
branch = session.branch()
frame = self.frame()
frame.show_view(branch)
@@ -195,6 +198,9 @@
action = self.app.model.client.close
action.invoke(client)
+ def render_title(self, session):
+ return "Close Clients"
+
def render_item_content(self, session, id):
return "Close Client %s" % Client.get(id).address
@@ -215,7 +221,7 @@
stat = self.app.model.client.get_stat("bytesToClient")
return fmt_rate(stat.rate(client), "byte", "sec")
-class ClientView(Widget):
+class ClientView(CuminView):
def __init__(self, app, name):
super(ClientView, self).__init__(app, name)
@@ -233,7 +239,7 @@
def show_sessions(self, session):
return self.tabs.show_mode(session, self.sessions)
- def get_title(self, session, client):
+ def render_title(self, session, client):
return "Client '%s'" % client.address
def render_data_url(self, session, client):
@@ -258,7 +264,7 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def get_title(self, session, client):
+ def render_title(self, session):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -267,7 +273,7 @@
self.add_child(StatSet(app, "general", "general"))
- def get_title(self, session, client):
+ def render_title(self, session):
return "Current"
class StatisticsHistory(Widget):
@@ -284,14 +290,11 @@
chart.mode = "rate"
self.add_child(chart)
- def get_title(self, session, client):
+ def render_title(self, session):
return "History"
class ClientSessionSetDetach(CuminBulkActionForm, Frame):
- def get_title(self, session, object):
- return "Detach Sessions"
-
- def process_return(self, session, object):
+ def process_return(self, session):
branch = session.branch()
frame = self.frame()
frame.show_view(branch).show_sessions(branch)
@@ -303,14 +306,14 @@
action = self.app.model.session.detach
action.invoke(session_)
+ def render_title(self, session):
+ return "Detach Sessions"
+
def render_item_content(self, session, id):
return "Detach Session '%s'" % Session.get(id).name
class ClientSessionSetClose(CuminBulkActionForm, Frame):
- def get_title(self, session, object):
- return "Close Sessions"
-
- def process_return(self, session, object):
+ def process_return(self, session):
branch = session.branch()
frame = self.frame()
frame.show_view(branch).show_sessions(branch)
@@ -322,6 +325,9 @@
action = self.app.model.session.close
action.invoke(session_)
+ def render_title(self, session):
+ return "Close Sessions"
+
def render_item_content(self, session, id):
return "Close Session '%s'" % Session.get(id).name
@@ -352,7 +358,10 @@
self.__close = self.Close(app, "close", self)
self.add_child(self.__close)
- def get_title(self, session, client):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, client):
return "Sessions %s" % fmt_count(client.sessions.count())
def render_sql_where(self, session, client):
@@ -365,10 +374,10 @@
return {"id": client.id}
class Detach(FormButton):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Detach"
- def process_submit(self, session, model):
+ def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
@@ -379,10 +388,10 @@
self.page().set_redirect_url(session, branch.marshal())
class Close(FormButton):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Close"
- def process_submit(self, session, model):
+ def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
@@ -393,18 +402,18 @@
self.page().set_redirect_url(session, branch.marshal())
class NameColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Name"
class ExpiresColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Expires"
def render_value(self, session, value):
return fmt_datetime(datetime.fromtimestamp(value / 1000000000))
class StatusColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Attached?"
def render_value(self, session, value):
Modified: mgmt/cumin/python/cumin/configproperty.py
===================================================================
--- mgmt/cumin/python/cumin/configproperty.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/configproperty.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -6,7 +6,7 @@
from util import *
class ConfigPropertySet(ItemSet):
- def do_get_items(self, session, model):
+ def do_get_items(self, session, *args):
return sorted_by(model.get_config_properties())
def render_item_name(self, session, prop):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/exchange.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -65,7 +65,10 @@
self.phase = PhaseSwitch(app, "phase")
self.add_child(self.phase)
- def get_title(self, session, vhost):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, vhost):
return "Exchanges %s" % fmt_count(vhost.exchanges.count())
def render_sql_where(self, session, vhost):
@@ -78,7 +81,7 @@
return {"id": vhost.id}
class NameColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Name"
def render_content(self, session, data):
@@ -89,7 +92,7 @@
return fmt_olink(branch, exchange, name=name)
class ProducersColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Producers"
def render_content(self, session, data):
@@ -103,7 +106,7 @@
return fmt_link(branch.marshal(), data["producers"])
class BindingsColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Bindings"
def render_content(self, session, data):
@@ -114,7 +117,7 @@
return fmt_link(branch.marshal(), data["bindings"])
class ReceivedColumn(NullSortColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Received" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
@@ -125,7 +128,7 @@
return fmt_rate(value, "", "sec")
class RoutedColumn(NullSortColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Routed" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
@@ -136,7 +139,7 @@
return fmt_rate(value, "", "sec")
class DroppedColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Dropped" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
@@ -163,15 +166,7 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
- # XXX not awesome
- def get_object(self, session, object):
- exchange = self.param.get(session)
- # XXX
- #self.app.model.get_stat(exchange, "producers").link_cb = show_producers
- #self.app.model.get_stat(exchange, "bindings").link_cb = show_bindings
- return exchange
-
- def get_title(self, session, exchange):
+ def render_title(self, session, exchange):
return exchange.name and "Exchange '%s'" % exchange.name \
or "Default Exchange"
@@ -194,7 +189,7 @@
def render_bytes_dropped(self, session, exchange):
return self.app.model.exchange.get_stat("byteDrops").value(exchange)
-class ExchangeView(Widget):
+class ExchangeView(CuminView):
def __init__(self, app, name):
super(ExchangeView, self).__init__(app, name)
@@ -218,9 +213,6 @@
def show_bindings(self, session):
return self.tabs.show_mode(session, self.bindings);
- def get_title(self, session, exchange):
- return self.parent.get_title(session, exchange)
-
def render_data_url(self, session, exchange):
return "model.xml?class=exchange;id=%i" % exchange.id
@@ -242,7 +234,10 @@
return fmt_datetime(exchange.recTime)
class ExchangeBindingSet(BindingSet):
- def get_title(self, session, exchange):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, exchange):
return "Queue Bindings %s" % \
fmt_count(self.get_item_count(session, exchange))
@@ -306,9 +301,9 @@
return error is None
class ExchangeAdd(ExchangeForm):
- def get_title(self, session, vhost):
- return "Add Exchange to Host Template '%s'" % vhost.name
-
+ def get_args(self, session):
+ return self.frame().frame().get_args(session)
+
def process_cancel(self, session, vhost):
branch = session.branch()
self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
@@ -326,9 +321,12 @@
self.page().show_exchange(branch, exchange).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
+ def render_title(self, session, vhost):
+ return "Add Exchange"
+
class ExchangeEdit(ExchangeForm):
- def get_title(self, session, exchange):
- return "Edit Exchange '%s'" % exchange.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, exchange):
branch = session.branch()
@@ -350,9 +348,12 @@
self.exchange_name.set(session, exchange.name)
self.type.set(session, exchange.type)
+ def render_title(self, session, exchange):
+ return "Edit Exchange '%s'" % exchange.name
+
class ExchangeRemove(CuminConfirmForm):
- def get_title(self, session, exchange):
- return "Remove Exchange '%s'" % exchange.name
+ def get_args(self, session):
+ return self.frame().get_args(session)
def process_cancel(self, session, exchange):
branch = session.branch()
@@ -368,6 +369,9 @@
self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
+ def render_title(self, session, exchange):
+ return "Remove Exchange '%s'" % exchange.name
+
def render_submit_content(self, session, exchange):
return "Yes, Remove Exchange '%s'" % exchange.name
@@ -381,7 +385,10 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def get_title(self, session, exchange):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, exchange):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -391,7 +398,10 @@
self.add_child(StatSet(app, "general", "general"))
- def get_title(self, session, exchange):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, exchange):
return "Current"
class StatisticsHistory(Widget):
@@ -413,11 +423,17 @@
chart.stats = ("msgDrops",)
self.add_child(chart)
- def get_title(self, session, queue):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, exchange):
return "History"
class ExchangeProducerSet(ItemSet):
- def get_title(self, session, exchange):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, exchange):
return "Producers %s" % \
fmt_count(self.get_item_count(session, exchange))
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/model.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -727,7 +727,7 @@
def get_content_type(self, session):
return Page.xml_content_type
- def do_render(self, session, model):
+ def do_render(self, session):
writer = Writer()
writer.write(Page.xml_1_0_declaration)
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/page.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -42,9 +42,6 @@
def set_modal(self, session, modal):
self.__modal.set(session, modal)
- def get_object(self, session, object):
- return self.app.model
-
class FramesAttribute(Attribute):
def get_default(self, session):
return list()
@@ -52,10 +49,10 @@
def get_frames(self, session):
return self.__frames.get(session)
- def render_class(self, session, object):
+ def render_class(self, session):
return self.__modal.get(session) and "modal"
- def get_title(self, session, model):
+ def render_title(self, session):
return "MRG Management"
class MainFrame(CuminFrame):
@@ -99,55 +96,48 @@
self.__system = SystemFrame(app, "system")
self.add_mode(self.__system)
- def get_title(self, session, object):
+ def render_title(self, session):
return "Main"
- def render_user_name(self, session, object):
+ def render_user_name(self, session):
return session.credentials.get("name")
- def render_logout_href(self, session, object):
+ def render_logout_href(self, session):
branch = session.branch()
self.__logout.set(branch, True)
return branch.marshal()
- def render_frames(self, session, object):
+ def render_frames(self, session):
self.__object.set(session, object)
writer = Writer()
for frame in self.page().get_frames(session):
- self.__frame_tmpl.render(session, frame, writer)
+ self.__frame_tmpl.render(writer, session, frame)
return writer.to_string()
def render_frame_href(self, session, frame):
- object = frame.get_object(session, self.__object.get(session))
- return frame.render_href(session, object)
+ args = frame.get_args(session)
+ return frame.render_href(session, *args)
def render_frame_title(self, session, frame):
- object = frame.get_object(session, self.__object.get(session))
- return frame.render_title(session, object)
+ args = frame.get_args(session)
+ return frame.render_title(session, *args)
- def render_pending_count(self, session, object):
+ def render_pending_count(self, session):
return self.app.model.count_invocations("pending")
- def render_completed_count(self, session, object):
+ def render_completed_count(self, session):
return self.app.model.count_invocations("OK")
- def render_failed_count(self, session, object):
+ def render_failed_count(self, session):
pcount = self.app.model.count_invocations("pending")
ccount = self.app.model.count_invocations("OK")
return len(self.app.model.invocations) - pcount - ccount
def show_broker(self, session, broker):
- cluster = None #broker.get_broker_cluster()
-
- if cluster:
- frame = self.show_broker_cluster(session, cluster)
- frame = frame.show_broker(session, broker)
- else:
- frame = self.show_mode(session, self.__broker)
- frame.set_object(session, broker)
-
+ frame = self.show_mode(session, self.__broker)
+ frame.set_object(session, broker)
return self.page().set_current_frame(session, frame)
def show_brokers_add(self, session):
@@ -178,7 +168,7 @@
frame.set_object(session, system)
return self.page().set_current_frame(session, frame)
- def do_process(self, session, object):
+ def do_process(self, session, *args):
if self.__logout.get(session):
self.__logout.set(session, False)
@@ -201,7 +191,7 @@
self.page().set_redirect_url(session, session.marshal())
- super(MainFrame, self).do_process(session, object)
+ super(MainFrame, self).do_process(session, *args)
class MainFrameTabs(LinkSet):
def __init__(self, app, name):
@@ -218,33 +208,33 @@
self.add_link(self.SystemsTab(app, "stab"))
class Tab(Link):
- def render_class(self, session, object):
+ def render_class(self, session):
if self.parent.selection.get(session) == self.name:
return "selected"
class MessagingTab(Tab):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Messaging"
- def edit_session(self, session, object):
+ def edit_session(self, session):
self.parent.selection.set(session, self.name)
frame = self.page().show_main(session).show_view(session)
frame.show_messaging(session)
class GridTab(Tab):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Grid"
- def edit_session(self, session, object):
+ def edit_session(self, session):
self.parent.selection.set(session, self.name)
frame = self.page().show_main(session).show_view(session)
frame.show_grid(session)
class SystemsTab(Tab):
- def render_content(self, session, object):
+ def render_content(self, session):
return "Systems"
- def edit_session(self, session, object):
+ def edit_session(self, session):
self.parent.selection.set(session, self.name)
frame = self.page().show_main(session).show_view(session)
frame.show_systems(session)
@@ -281,21 +271,21 @@
#self.add_tab(BrokerClusterSet(app, "clusters"))
#self.add_tab(self.TagTab(app, "tags"))
- def get_title(self, session, model):
+ def render_title(self, session):
return "Messaging"
- def render_data_url(self, session, model):
+ def render_data_url(self, session):
return "model.xml"
class TagTab(Widget):
- def get_title(self, session, model):
+ def render_title(self, session):
return "Tags"
class GridView(TabbedModeSet):
- def get_title(self, session, model):
+ def render_title(self, session):
return "Grid"
- def render_data_url(self, session, model):
+ def render_data_url(self, session):
return "model.xml"
class SystemsView(TabbedModeSet):
@@ -304,8 +294,8 @@
self.add_tab(SystemSet(app, "systems"))
- def get_title(self, session, model):
+ def render_title(self, session):
return "Systems"
- def render_data_url(self, session, model):
+ def render_data_url(self, session):
return "model.xml"
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/queue.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -59,7 +59,10 @@
self.__purge = self.Purge(app, "purge", self)
self.add_child(self.__purge)
- def get_title(self, session, vhost):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, *args):
return "Queues %s" % fmt_count(Queue.select().count())
def render_sql_where(self, session, vhost):
@@ -72,7 +75,7 @@
return {"id": vhost.id}
class Purge(FormButton):
- def process_submit(self, session, object):
+ def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
@@ -81,11 +84,11 @@
frame.ids.set(branch, ids)
self.page().set_redirect_url(session, branch.marshal())
- def render_content(self, session, object):
+ def render_content(self, session):
return "Purge"
class NameColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Name"
def render_content(self, session, data):
@@ -95,7 +98,7 @@
return fmt_olink(branch, queue, name=data["name"])
class ConsumersColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Consumers"
def render_content(self, session, data):
@@ -109,7 +112,7 @@
return fmt_link(branch.marshal(), data["consumers"])
class BindingsColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "Bindings"
def render_content(self, session, data):
@@ -120,7 +123,7 @@
return fmt_link(branch.marshal(), data["bindings"])
class EnqueuedColumn(NullSortColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Enqueued" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
@@ -131,7 +134,7 @@
return fmt_rate(value, "", "sec")
class DequeuedColumn(NullSortColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Dequeued" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
@@ -142,7 +145,7 @@
return fmt_rate(value, "", "sec")
class DepthColumn(SqlTableColumn):
- def get_title(self, session, object):
+ def render_title(self, session, data):
return "%s Depth" % self.parent.unit.get_brief_singular(session)
def get_column_key(self, session):
@@ -179,14 +182,7 @@
def show_purge(self, session):
return self.show_mode(session, self.purge)
- # XXX not awesome
- def get_object(self, session, object):
- queue = self.param.get(session)
- #queue_stat(queue, "consumers").link_cb = show_consumers
- #queue_stat(queue, "bindings").link_cb = show_bindings
- return queue
-
- def get_title(self, session, queue):
+ def render_title(self, session, queue):
if queue:
return "Queue '%s'" % queue.name
else:
@@ -226,7 +222,7 @@
stat = self.app.model.queue.get_stat("byteDepth")
return fmt_rate(stat.rate(queue), "byte", "sec")
-class QueueView(Widget):
+class QueueView(CuminView):
def __init__(self, app, name):
super(QueueView, self).__init__(app, name)
@@ -250,7 +246,7 @@
def show_bindings(self, session):
self.tabs.show_mode(session, self.bindings);
- def get_title(self, session, queue):
+ def render_title(self, session, queue):
return "Queue '%s'" % queue.name
def render_data_url(self, session, queue):
@@ -275,10 +271,13 @@
return branch.marshal()
class QueueBindingSet(BindingSet):
- def get_title(self, session, queue):
- return "Exchange Bindings %s" % \
- fmt_count(self.get_item_count(session, queue))
+ def get_args(self, session):
+ return self.frame().get_args(session)
+ def render_title(self, session, queue):
+ count = fmt_count(self.get_item_count(session, queue))
+ return "Exchange Bindings %s" % count
+
def get_item_count(self, session, queue):
return queue.bindings.count()
@@ -309,20 +308,20 @@
self.add_field(self.durable)
class QueueAdd(QueueForm):
- def process_cancel(self, session, object):
+ def process_cancel(self, session):
branch = session.branch()
self.page().pop_current_frame(branch)
self.page().pop_current_frame(branch)
self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def process_submit(self, session, object):
+ def process_submit(self, session):
errors = self.validate(session)
if errors:
pass
else:
- reg = self.frame().frame().get_object(session, None)
+ reg = self.frame().frame().get_object(session)
vhost = reg.getDefaultVhost()
name = self.namef.get(session)
@@ -330,14 +329,17 @@
print "XXX add queue", name, self.durable.get(session)
- self.process_cancel(session, object)
+ self.process_cancel(session)
- def get_title(self, session, object):
- reg = self.frame().frame().get_object(session, None)
+ def render_title(self, session):
+ reg = self.frame().frame().get_object(session)
return "Add Queue to Broker '%s'" % reg.name
class QueuePurge(CuminConfirmForm):
- def get_title(self, session, queue):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def render_title(self, session, queue):
return "Purge Queue '%s'" % queue.name
def process_cancel(self, session, queue):
@@ -358,10 +360,7 @@
return "No, Cancel"
class QueueSetPurge(CuminBulkActionForm):
- def get_title(self, session, object):
- return "Purge Queues"
-
- def process_return(self, session, object):
+ def process_return(self, session):
branch = session.branch()
frame = self.frame()
frame.show_view(branch)
@@ -373,6 +372,9 @@
action = self.app.model.queue.purge
action.invoke(queue)
+ def render_title(self, session):
+ return "Purge Queues"
+
def render_item_content(self, session, id):
return "Purge Queue '%s'" % Queue.get(id).name
@@ -385,10 +387,10 @@
self.binding_key = TextInput(app, "binding_key", self)
self.add_child(self.binding_key)
+
+ def get_args(self, session):
+ return self.frame().get_args(session)
- def get_title(self, session, queue):
- return "Add Binding to Queue '%s'" % queue.name
-
def process_cancel(self, session, queue):
branch = session.branch()
self.page().show_queue(branch, queue).show_view(branch)
@@ -423,22 +425,28 @@
self.process_cancel(session, queue)
+ def render_title(self, session, queue):
+ return "Add Binding to Queue '%s'" % queue.name
+
class Exchanges(ExchangeInputSet):
def do_get_items(self, session, queue):
return sorted_by(queue.virtual_host.exchange_items())
class QueueBindingRemove(CuminConfirmForm):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
def process_cancel(self, session, binding):
branch = session.branch()
self.page().show_queue(branch, binding.get_queue()).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, binding):
- print binding
+ print "processing", binding
self.process_cancel(session, binding)
- def get_title(self, session, binding):
+ def render_title(self, session, binding):
return "Remove Binding"
def render_submit_content(self, session, binding):
@@ -454,7 +462,7 @@
self.add_tab(self.StatisticsCurrent(app, "current"))
self.add_tab(self.StatisticsHistory(app, "history"))
- def get_title(self, session, queue):
+ def render_title(self, session):
return "Statistics"
class StatisticsCurrent(Widget):
@@ -467,7 +475,7 @@
self.add_child(StatSet(app, "persistent", "persistent"))
self.add_child(StatSet(app, "transaction", "transaction"))
- def get_title(self, session, queue):
+ def render_title(self, session):
return "Current"
class StatisticsHistory(Widget):
@@ -486,13 +494,17 @@
chart.stats = ("consumers",)
self.add_child(chart)
- def get_title(self, session, queue):
+ def render_title(self, session):
return "History"
class QueueConsumerSet(PaginatedItemSet):
- def get_title(self, session, queue):
- return "Consumers %s" % fmt_count(self.get_item_count(session, queue))
+ def get_args(self, session):
+ return self.frame().get_args(session)
+ def render_title(self, session, queue):
+ count = fmt_count(self.get_item_count(session, queue))
+ return "Consumers %s" % count
+
def get_item_count(self, session, queue):
return queue.consumers.count()
Modified: mgmt/cumin/python/cumin/realm.py
===================================================================
--- mgmt/cumin/python/cumin/realm.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/realm.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -10,7 +10,7 @@
strings = StringCatalog(__file__)
class RealmSet(ItemSet):
- def get_title(self, session, vhost):
+ def render_title(self, session, vhost):
return "Realms %s" % fmt_count(len(vhost.realm_items()))
def do_get_items(self, session, vhost):
@@ -30,16 +30,6 @@
def do_get_items(self, session, vhost):
return sorted_by(vhost.realm_items())
- # just parked here
- def do_process(self, session, queue):
- for realm in self.get(session):
- if realm not in queue.realm_items():
- queue.add_realm(realm)
-
- for realm in list(queue.realm_items()):
- if realm not in self.get(session):
- queue.remove_realm(realm)
-
def render_item_value(self, session, realm):
return realm.id
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/stat.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -23,6 +23,9 @@
self.object = Attribute(app, "object");
self.add_attribute(self.object);
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
def do_get_items(self, session, object):
stats = list()
cls = self.app.model.get_class_by_object(object)
@@ -80,6 +83,9 @@
self.duration = DurationSwitch(app, "duration")
self.add_child(self.duration)
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
def render_href(self, session, object):
params = list()
@@ -103,25 +109,23 @@
return "stats.png?" + ";".join(params)
- def render_mode(self, session, object):
- return self.mode
-
def render_stats(self, session, object):
writer = Writer()
for name in self.stats:
cls = self.app.model.get_class_by_object(object)
stat = cls.get_stat(name)
- self.stats_tmpl.render(session, (stat, object), writer)
+ self.stats_tmpl.render(writer, session, stat, object)
return writer.to_string()
- def render_stat_color(self, session, args):
+ def render_stat_mode(self, session, stat, object):
+ return self.mode
+
+ def render_stat_color(self, session, stat, object):
return "rgb(255,0,0)"
- def render_stat_value(self, session, args):
- stat, object = args
-
+ def render_stat_value(self, session, stat, object):
if self.mode == "rate":
html = stat.rate_html(object)
else:
@@ -129,8 +133,7 @@
return html
- def render_stat_name(self, session, args):
- stat, object = args
+ def render_stat_name(self, session, stat, object):
return stat.name
class StatChartPage(Page):
@@ -157,17 +160,17 @@
self.duration.default = 600
self.add_parameter(self.duration)
- def get_object(self, session, object):
- cls = self.class_.get(session).mint_class
- id = self.id.get(session)
- return cls.get(id)
-
def get_content_type(self, session):
return "image/png"
def get_cache_control(self, session):
return "no-cache"
+ def get_args(self, session):
+ cls = self.class_.get(session).mint_class
+ id = self.id.get(session)
+ return (cls.get(id),)
+
def do_render(self, session, object):
chart = LineChart(480, 120)
Modified: mgmt/cumin/python/cumin/system.py
===================================================================
--- mgmt/cumin/python/cumin/system.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/system.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -25,12 +25,12 @@
self.add_parameter(self.submit)
self.add_form_parameter(self.submit)
- def get_title(self, session, model):
+ def render_title(self, session, *args):
count = System.select().count()
return "Systems %s" % fmt_count(count)
class NameColumn(SqlTableColumn):
- def get_title(self, session, model):
+ def render_title(self, session, data):
return "Name"
def render_content(self, session, data):
@@ -51,7 +51,7 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
- def get_title(self, session, system):
+ def render_title(self, session, system):
return "System '%s'" % system.sysId
class SystemStatus(CuminStatus):
@@ -69,7 +69,7 @@
self.tabs.add_tab(self.SystemStatsTab(app, "stats"))
- def get_title(self, session, system):
+ def render_title(self, session, system):
return "System '%s'" % system.sysId
def render_created_deleted(self, session, system):
@@ -79,9 +79,9 @@
def render_updated(self, session, system):
return fmt_datetime(system.recTime)
- def render_data_url(self, session, model):
+ def render_data_url(self, session, system):
return "model.xml"
class SystemStatsTab(Widget):
- def get_title(self, session, broker):
+ def render_title(self, session, *args):
return "Statistics"
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/virtualhost.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -12,11 +12,11 @@
strings = StringCatalog(__file__)
class VirtualHostSet(ItemSet):
- def get_title(self, session, model):
+ def render_title(self, session, *args):
return "Functional Hosts %s" % \
fmt_count(len(model.get_virtual_hosts()))
- def do_get_items(self, session, model):
+ def do_get_items(self, session, *args):
return sorted_by(model.get_virtual_hosts())
def render_item_link(self, session, vhost):
@@ -57,10 +57,10 @@
self.client.set_object(session, client)
return self.show_mode(session, self.client)
- def get_title(self, session, vhost):
+ def render_title(self, session, vhost):
return "Functional Host '%s'" % vhost.name
-class VirtualHostView(Widget):
+class VirtualHostView(CuminView):
def __init__(self, app, name):
super(VirtualHostView, self).__init__(app, name)
@@ -71,7 +71,7 @@
self.tabs.add_tab(ExchangeSet(app, "exchanges"))
self.tabs.add_tab(ClientSet(app, "clients"))
- def get_title(self, session, vhost):
+ def render_title(self, session, vhost):
return "Functional Host '%s'" % vhost.name
def render_name(self, session, vhost):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -24,10 +24,16 @@
self.__edit = None
self.__remove = None
+ def get_args(self, session):
+ if self.__param:
+ return (self.get_object(session),)
+ else:
+ return ()
+
def set_object_parameter(self, param):
self.__param = param
- def get_object(self, session, object):
+ def get_object(self, session):
if self.__param:
return self.__param.get(session)
@@ -66,27 +72,30 @@
return mode
- def do_process(self, session, object):
+ def do_process(self, session, *args):
self.page().get_frames(session).append(self)
- if self.__param:
- self.set(session, "object", self.__param.get(session))
+ super(CuminFrame, self).do_process(session, *args)
- super(CuminFrame, self).do_process(session, object)
-
- def render_href(self, session, object):
+ def render_href(self, session, *args):
branch = session.branch()
self.page().set_current_frame(branch, self)
self.show_view(branch)
return branch.marshal()
class CuminView(Widget):
- def render_edit_href(self, session, object):
+ def get_args(self, session):
+ return (self.frame().get_object(session),)
+
+ def render_title(self, session, *args):
+ return self.frame().render_title(session, *args)
+
+ def render_edit_href(self, session, *args):
branch = session.branch()
self.parent.show_edit(branch)
return branch.marshal()
- def render_remove_href(self, session, object):
+ def render_remove_href(self, session, *args):
branch = session.branch()
self.parent.show_remove(branch)
return branch.marshal()
@@ -103,51 +112,53 @@
self.submit.set_tab_index(200)
self.add_child(self.submit)
- def do_process(self, session, object):
+ def do_process(self, session, *args):
self.page().set_modal(session, True)
if self.cancel.get(session):
self.cancel.set(session, False)
- self.process_cancel(session, object)
+ self.process_cancel(session, *args)
elif self.submit.get(session):
self.submit.set(session, False)
- self.process_submit(session, object)
+ self.process_submit(session, *args)
else:
- self.process_display(session, object)
+ self.process_display(session, *args)
- def process_cancel(self, session, object):
+ def process_cancel(self, session, *args):
pass
- def process_submit(self, session, object):
+ def process_submit(self, session, *args):
pass
- def process_display(self, session, object):
+ def process_display(self, session, *args):
pass
- def render_help_href(self, session, object):
- return self.render_href(self, session, object)
+ def render_help_href(self, session, *args):
+ return self.render_href(self, session, *args)
- def render_cancel_content(self, session, object):
+ def render_cancel_content(self, session, *args):
return "Cancel"
- def render_submit_content(self, session, object):
+ def render_submit_content(self, session, *args):
return "Submit"
class Cancel(FormButton):
- def render_class(self, session, object):
+ def render_class(self, session, *args):
return "cancel"
- def render_content(self, session, object):
- return self.parent.render_cancel_content(session, object)
+ def render_content(self, session, *args):
+ cargs = self.parent.get_args(session)
+ return self.parent.render_cancel_content(session, *cargs)
class Submit(FormButton):
- def render_class(self, session, object):
+ def render_class(self, session, *args):
return "submit"
- def render_content(self, session, object):
- return self.parent.render_submit_content(session, object)
+ def render_content(self, session, *args):
+ cargs = self.parent.get_args(session)
+ return self.parent.render_submit_content(session, *cargs)
class CuminFieldForm(CuminForm, FieldForm, Frame):
pass
@@ -170,30 +181,33 @@
self.ids = ListParameter(app, "id", param)
self.add_parameter(self.ids)
- def get_items(self, session, object):
+ def get_items(self, session, *args):
return self.ids.get(session)
- def process_submit(self, session, object):
- items = self.get_items(session, object)
+ def process_submit(self, session, *args):
+ items = self.get_items(session, *args)
for item in items:
self.process_item(session, item)
- self.process_return(session, object)
+ self.process_return(session, *args)
def process_item(self, session, item):
print "processing item", item
- def process_return(self, session, object):
+ def process_return(self, session, *args):
pass
- def process_cancel(self, session, object):
- self.process_return(session, object)
+ def process_cancel(self, session, *args):
+ self.process_return(session, *args)
def render_item_content(self, session, id):
return "Act on object %i" % id
class CuminStatus(Widget):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
def render_class(self, session, object):
if hasattr(object, "errors"):
if object.errors:
@@ -236,7 +250,7 @@
def set(self, session, value):
return self.param.set(session, value)
- def get_items(self, session, object):
+ def get_items(self, session):
return self.states
def render_item_link(self, session, state):
@@ -272,7 +286,7 @@
self.add_state("i", "Idle")
self.add_state("d", "Deleted")
- def get_sql_constraint(self, session, object):
+ def get_sql_constraint(self, session, *args):
phase = self.get(session)
if phase == "a":
@@ -325,7 +339,7 @@
page_count = self.get_page_count(session)
return int(ceil(page_count / float(self.pageset_size)))
- def render_prev_page_link(self, session, object):
+ def render_prev_page_link(self, session, *args):
page = self.__page.get(session)
if page < 1:
@@ -342,7 +356,7 @@
return html
- def render_next_page_link(self, session, object):
+ def render_next_page_link(self, session, *args):
page = self.__page.get(session)
if page >= self.get_page_count(session) - 1:
@@ -359,7 +373,7 @@
return html
- def render_prev_pageset_link(self, session, object):
+ def render_prev_pageset_link(self, session, *args):
pageset = self.__pageset.get(session)
if pageset < 1:
@@ -371,7 +385,7 @@
return html
- def render_next_pageset_link(self, session, object):
+ def render_next_pageset_link(self, session, *args):
pageset = self.__pageset.get(session)
if pageset >= self.get_pageset_count(session) - 1:
@@ -383,7 +397,7 @@
return html
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
count = self.__count.get(session)
start, end = self.get_pageset_bounds(session)
@@ -413,12 +427,12 @@
def get_connection(self, session):
return sqlhub.getConnection().getConnection()
- def do_process(self, session, object):
- super(CuminTable, self).do_process(session, object)
+ def do_process(self, session, *args):
+ super(CuminTable, self).do_process(session, *args)
- self.paginator.set_count(session, self.get_item_count(session, object))
+ self.paginator.set_count(session, self.get_item_count(session, *args))
- def render_sql_limit(self, session, object):
+ def render_sql_limit(self, session, *args):
start, end = self.paginator.get_bounds(session)
return "limit %i offset %i" % (end - start, start)
@@ -437,23 +451,23 @@
self.paginator = Paginator(app, "page")
self.add_child(self.paginator)
- def do_process(self, session, object):
- super(PaginatedItemSet, self).do_process(session, object)
+ def do_process(self, session, *args):
+ super(PaginatedItemSet, self).do_process(session, *args)
- self.paginator.set_count(session, self.get_item_count(session, object))
+ self.paginator.set_count(session, self.get_item_count(session, *args))
def get_bounds(self, session):
return self.paginator.get_bounds(session)
class SQLObjectItemSet(ItemSet):
- def get_item_count(self, session, object):
- items = self.get_items(session, object)
+ def get_item_count(self, session, *args):
+ items = self.get_items(session, *args)
if isinstance(items, SelectResults):
return items.count()
else:
return super(SQLObjectItemSet, self).get_item_count \
- (session, object)
+ (session, *args)
class BrokerGroupInput(OptionInputSet):
def __init__(self, app, name, form):
@@ -462,7 +476,7 @@
self.set_parameter(BrokerGroupParameter(app, "param"))
self.add_parameter(self.get_parameter())
- def do_get_items(self, session, model):
+ def do_get_items(self, session):
return list(BrokerGroup.select()) #XXX avoid list()ing this?
def render_item_value(self, session, group):
@@ -475,13 +489,13 @@
def __init__(self, app, name):
super(BindingSet, self).__init__(app, name)
- def get_title(self, session, queue):
+ def render_title(self, session, *args):
return "Bindings"
- def get_item_count(self, session, object):
+ def get_item_count(self, session, *args):
return Binding.select().count()
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
start, end = self.get_bounds(session)
return Binding.select()[start:end]
@@ -524,10 +538,10 @@
return t % (name, id, attr)
class CheckboxIdColumnHeader(ItemTableColumnHeader):
- def render_form_id(self, session, object):
+ def render_form_id(self, session, *args):
return self.column.form.path()
- def render_elem_name(self, session, object):
+ def render_elem_name(self, session, *args):
return self.column.ids.path()
class NameField(StringField):
@@ -538,7 +552,7 @@
self.illegal_chars = ""
self.legal_chars_desc = None
- def get_title(self, session, object):
+ def render_title(self, session):
return "Name"
def do_validate(self, session, errors):
@@ -569,19 +583,19 @@
self.add_option(self.Durable(app, "durable", form))
self.add_option(self.Transient(app, "transient", form))
- def get_title(self, session, object):
+ def render_title(self, session):
return "Durable?"
class Durable(RadioFieldOption):
- def get_value(self, session, object):
+ def render_value(self, session):
return "durable"
- def get_title(self, session, object):
+ def render_title(self, session):
return "Durable"
class Transient(RadioFieldOption):
- def get_value(self, session, object):
+ def render_value(self, session):
return "transient"
- def get_title(self, session, object):
+ def render_title(self, session):
return "Transient"
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -102,9 +102,6 @@
self.__main_tmpl = Template(self, "html")
- self.args = self.ArgsAttribute(app, "args")
- self.add_attribute(self.args)
-
self.__ancestors = None
self.__path = None
self.__page = None
@@ -118,11 +115,6 @@
if cls is Widget:
break
- class ArgsAttribute(Attribute):
- def get_default(self, session):
- if self.widget.parent:
- return ArgsDict(self.widget.parent.args)
-
def ancestors(self):
if self.__ancestors is None:
if self.parent is None:
@@ -210,13 +202,6 @@
if str:
return str
- def get(self, session, name):
- return self.args.get(session).get(name)
-
- def set(self, session, name, value):
- self.args.get(session)[name] = value
- return value
-
def get_saved_parameters(self, session):
params = list()
params.extend(self.parameters)
@@ -228,66 +213,61 @@
return params
- def get_object(self, session, object):
- return object
+ def get_args(self, session):
+ return ()
- def process(self, session, object):
+ def process(self, session):
if session.debug:
call = WidgetCall(session.debug.process_stack,
- self, session, object)
+ self, session, None)
call.open()
- object = self.get_object(session, object)
- self.do_process(session, object)
+ args = self.get_args(session)
+ self.do_process(session, *args)
if session.debug:
call.close()
- def do_process(self, session, object):
+ def do_process(self, session, *args):
for child in self.children:
- child.process(session, object)
+ child.process(session)
- def render(self, session, object):
+ def render(self, session):
if session.debug:
call = WidgetCall(session.debug.render_stack,
- self, session, object)
+ self, session, None)
call.open()
- object = self.get_object(session, object)
- string = self.do_render(session, object)
+ args = self.get_args(session)
+ string = self.do_render(session, *args)
if session.debug:
call.close()
return string
- def do_render(self, session, object):
+ def do_render(self, session, *args):
writer = Writer()
-
- self.__main_tmpl.render(session, object, writer)
-
+ self.__main_tmpl.render(writer, session, *args)
return writer.to_string()
- def get_title(self, session, object):
- return None
-
- def render_id(self, session, object):
+ def render_id(self, session, *args):
return self.path()
- def render_class(self, session, object):
+ def render_class(self, session, *args):
return self.html_class
- def render_href(self, session, object):
+ def render_href(self, session, *args):
return session.marshal()
- def render_title(self, session, object):
- return self.get_title(session, object)
+ def render_title(self, session, *args):
+ return None
- def render_content(self, session, object):
+ def render_content(self, session, *args):
writer = Writer()
for child in self.children:
- writer.write(child.render(session, object))
+ writer.write(child.render(session))
return writer.to_string()
@@ -747,7 +727,7 @@
if method and callable(method):
return method
- def render(self, session, object, writer):
+ def render(self, writer, session, *args):
if not self.fragments:
self.fragments = self.compile()
@@ -755,12 +735,14 @@
if type(elem) is str:
writer.write(elem)
elif callable(elem):
- result = elem(self.widget, session, object)
+ #print "tc", elem, args
+ result = elem(self.widget, session, *args)
+
if result is not None:
writer.write(str(result))
else:
- result = elem.render(session, object)
+ result = elem.render(session)
if result is not None:
writer.write(str(result))
Modified: mgmt/cumin/python/wooly/devel.py
===================================================================
--- mgmt/cumin/python/wooly/devel.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/devel.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -25,9 +25,9 @@
session.unmarshal(url)
page = session.get_page()
- page.process(session, None)
+ page.process(session)
- html = page.render(session, None)
+ html = page.render(session)
bytes = len(html)
millis = (clock() - start) * 1000
@@ -56,7 +56,7 @@
self.add_child(self.render_trace)
class RenderTrace(Widget):
- def do_render(self, session, object):
+ def do_render(self, session):
writer = Writer()
writer.write("<ul>")
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/forms.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -14,7 +14,7 @@
def add_form_parameter(self, param):
self.form_params.add(param)
- def render_hidden_inputs(self, session, object):
+ def render_hidden_inputs(self, session, *args):
writer = Writer()
params = set(session.get_page().get_saved_parameters(session))
@@ -82,16 +82,16 @@
def set_disabled(self, disabled):
self.disabled = disabled
- def render_name(self, session, object):
+ def render_name(self, session, *args):
return self.param.path()
- def render_value(self, session, object):
+ def render_value(self, session, *args):
return self.param.marshal(self.param.get(session))
- def render_tab_index(self, session, object):
+ def render_tab_index(self, session, *args):
return self.tab_index
- def render_disabled_attr(self, session, object):
+ def render_disabled_attr(self, session, *args):
return self.disabled and "disabled=\"disabled\"" or None
class MissingValueError(Error):
@@ -119,7 +119,7 @@
def set_size(self, size):
self.size = size
- def render_size(self, session, object):
+ def render_size(self, session, *args):
return self.size
class StringInput(TextInput):
@@ -147,7 +147,7 @@
self.set_parameter(VoidBooleanParameter(app, "param"))
self.add_parameter(self.get_parameter())
- def render_checked_attr(self, session, object):
+ def render_checked_attr(self, session, *args):
return self.get(session) and "checked=\"checked\""
class RadioInput(FormInput):
@@ -159,16 +159,17 @@
def xxx_set_value(self, value):
self.value = value
- def get_value(self, session, object):
+ # XXX get rid of this
+ def get_value(self, session, *args):
pass
- def render_value(self, session, object):
- return self.get_value(session, object)
+ def render_value(self, session, *args):
+ return self.get_value(session, *args)
- def render_checked_attr(self, session, object):
+ def render_checked_attr(self, session, *args):
value = self.get(session)
- if value and value == self.get_value(session, object):
+ if value and value == self.get_value(session, *args):
return "checked=\"checked\""
class FormButton(FormInput):
@@ -178,41 +179,41 @@
self.set_parameter(BooleanParameter(app, "param"))
self.add_parameter(self.get_parameter())
- def do_process(self, session, object):
+ def do_process(self, session, *args):
if self.get(session):
self.set(session, False)
- self.process_submit(session, object)
+ self.process_submit(session, *args)
- def process_submit(self, session, object):
+ def process_submit(self, session, *args):
pass
- def render_value(self, session, object):
+ def render_value(self, session, *args):
branch = session.branch()
self.set(branch, True)
- return super(FormButton, self).render_value(branch, object)
+ return super(FormButton, self).render_value(branch, *args)
class CheckboxInputSet(FormInput, ItemSet):
- def render_item_value(self, session, object):
+ def render_item_value(self, session, *args):
return None
- def render_item_checked_attr(self, session, object):
+ def render_item_checked_attr(self, session, *args):
return None
class RadioInputSet(FormInput, ItemSet):
- def render_item_value(self, session, object):
+ def render_item_value(self, session, *args):
return None
- def render_item_checked_attr(self, session, object):
+ def render_item_checked_attr(self, session, *args):
return None
class OptionInputSet(FormInput, ItemSet):
- def render_item_value(self, session, object):
+ def render_item_value(self, session, item):
return None
- def render_item_selected_attr(self, session, object):
+ def render_item_selected_attr(self, session, item):
return None
class FieldSet(Widget):
@@ -227,11 +228,11 @@
self.fields.append(field)
self.add_child(field)
- def render_fields(self, session, object):
+ def render_fields(self, session, *args):
writer = Writer()
for field in self.fields:
- writer.write(field.render(session, object))
+ writer.write(field.render(session))
return writer.to_string()
@@ -270,9 +271,9 @@
def do_validate(self, session, errors):
pass
- def render_errors(self, session, object):
+ def render_errors(self, session, *args):
if self.__errors.attr.get(session):
- return self.__errors.render(session, object)
+ return self.__errors.render(session)
class FormFieldErrors(ItemSet):
def __init__(self, app, name):
@@ -281,7 +282,7 @@
self.attr = self.Errors(app, "attr")
self.add_attribute(self.attr)
- def get_items(self, session, object):
+ def get_items(self, session, *args):
return self.attr.get(session)
def render_item_content(self, session, item):
@@ -307,8 +308,8 @@
self.__input = input
return input
- def render_inputs(self, session, object):
- return self.__input.render(session, object)
+ def render_inputs(self, session, *args):
+ return self.__input.render(session)
class StringField(ScalarField):
def __init__(self, app, name, form):
@@ -339,11 +340,11 @@
self.options.append(option)
self.add_child(option)
- def render_inputs(self, session, object):
+ def render_inputs(self, session, *args):
writer = Writer()
for option in self.options:
- writer.write(option.render(session, object))
+ writer.write(option.render(session))
return writer.to_string()
@@ -362,11 +363,11 @@
self.buttons.append(button)
self.add_child(button)
- def render_buttons(self, session, object):
+ def render_buttons(self, session, *args):
writer = Writer()
for button in self.buttons:
- writer.write(button.render(session, object))
+ writer.write(button.render(session))
return writer.to_string()
Modified: mgmt/cumin/python/wooly/pages.py
===================================================================
--- mgmt/cumin/python/wooly/pages.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/pages.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -33,7 +33,7 @@
return self.__css
- def do_render(self, session, object):
+ def do_render(self, session, *args):
return self.get_css()
class JavascriptPage(Page):
@@ -67,7 +67,7 @@
return self.__javascript
- def do_render(self, session, object):
+ def do_render(self, session, *args):
return self.get_javascript()
class ResourcePage(Page):
@@ -97,7 +97,7 @@
return type
- def do_render(self, session, object):
+ def do_render(self, session, *args):
name = self.rname.get(session)
if name:
Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/server.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -61,7 +61,7 @@
page = session.get_page()
try:
- page.process(session, None)
+ page.process(session)
except:
return self.error(session, respond)
@@ -84,7 +84,7 @@
# return
try:
- response = page.render(session, None)
+ response = page.render(session)
except:
return self.error(session, respond)
Modified: mgmt/cumin/python/wooly/tables.py
===================================================================
--- mgmt/cumin/python/wooly/tables.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/tables.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -47,21 +47,21 @@
def is_reversed(self, session):
return self.reversed.get(session)
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
"""Gets the rows"""
return None
- def render_count(self, session, object):
- count = self.get_item_count(session, object)
+ def render_count(self, session, *args):
+ count = self.get_item_count(session, *args)
return "%i %s" % (count, count == 1 and "item" or "items")
- def render_headers(self, session, object):
+ def render_headers(self, session, *args):
writer = Writer()
for column in self.columns:
header = self.headers_by_column[column]
- writer.write(header.render(session, object))
+ writer.write(header.render(session))
return writer.to_string()
@@ -69,11 +69,12 @@
writer = Writer()
for col in self.columns:
- writer.write(col.render(session, item))
+ col.set_item(session, item)
+ writer.write(col.render(session))
return writer.to_string()
- def render_none(self, session, object):
+ def render_none(self, session, *args):
"""For producing a message when the table is empty"""
return None
@@ -85,6 +86,15 @@
self.header_class = ItemTableColumnHeader
self.alignment = None
+ self.__item = Attribute(app, "item")
+ self.add_attribute(self.__item)
+
+ def set_item(self, session, item):
+ return self.__item.set(session, item)
+
+ def get_args(self, session):
+ return (self.__item.get(session),)
+
def get_column_key(self, session):
return self.name
@@ -108,7 +118,7 @@
self.column = column
- def render_href(self, session, object):
+ def render_href(self, session, *args):
branch = session.branch()
sel = self.parent.get_selected_column(session)
@@ -121,13 +131,14 @@
return branch.marshal()
- def render_content(self, session, object):
- return self.column.get_title(session, object)
+ def render_content(self, session, *args):
+ cargs = self.column.get_args(session)
+ return self.column.render_title(session, *cargs)
- def render_class_attr(self, session, object):
+ def render_class_attr(self, session, *args):
return self.column.get_class_attr(session)
- def render_sort_arrow(self, session, object):
+ def render_sort_arrow(self, session, *args):
sel = self.parent.get_selected_column(session)
if sel is self.column:
@@ -143,9 +154,9 @@
self.__sql_tmpl = Template(self, "sql")
self.__count_sql_tmpl = Template(self, "count_sql")
- def render_sql(self, session, object):
+ def render_sql(self, session, *args):
writer = Writer()
- self.__sql_tmpl.render(session, object, writer)
+ self.__sql_tmpl.render(writer, session, *args)
sql = writer.to_string()
#print "sql -----------------------"
@@ -153,20 +164,20 @@
return sql
- def render_sql_where(self, session, object):
+ def render_sql_where(self, session, *args):
pass
- def render_sql_orderby(self, session, object):
+ def render_sql_orderby(self, session, *args):
scol = self.get_selected_column(session)
return scol.get_orderby_sql(session)
- def render_sql_limit(self, session, object):
+ def render_sql_limit(self, session, *args):
return None
- def render_count_sql(self, session, object):
+ def render_count_sql(self, session, *args):
writer = Writer()
- self.__count_sql_tmpl.render(session, object, writer)
+ self.__count_sql_tmpl.render(writer, session, *args)
sql = writer.to_string()
#print "sql -----------------------"
@@ -184,32 +195,32 @@
return writer.to_string()
- def get_sql_values(self, session, object):
+ def get_sql_values(self, session, *args):
return None
def get_connection(self, session):
pass
- def get_item_count(self, session, object):
+ def get_item_count(self, session, *args):
conn = self.get_connection(session)
if conn:
cursor = conn.cursor()
- sql = self.render_count_sql(session, object)
- sql_values = self.get_sql_values(session, object)
+ sql = self.render_count_sql(session, *args)
+ sql_values = self.get_sql_values(session, *args)
cursor.execute(sql, sql_values)
data = cursor.fetchone()
return data[0]
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
conn = self.get_connection(session)
if conn:
cursor = conn.cursor()
- sql = self.render_sql(session, object)
- sql_values = self.get_sql_values(session, object)
+ sql = self.render_sql(session, *args)
+ sql_values = self.get_sql_values(session, *args)
#print "SQL TEXT", sql
#print "SQL VALS", sql_values
@@ -218,8 +229,8 @@
return cursor
- def render_items(self, session, object):
- cursor = self.get_items(session, object)
+ def render_items(self, session, *args):
+ cursor = self.get_items(session, *args)
cols = [spec[0] for spec in cursor.description]
data = dict()
@@ -229,7 +240,7 @@
for col, datum in zip(cols, tuple):
data[col] = datum
- self.item_tmpl.render(session, data, writer)
+ self.item_tmpl.render(writer, session, data)
return writer.to_string()
@@ -237,7 +248,8 @@
writer = Writer()
for col in self.columns:
- writer.write(col.render(session, data))
+ col.set_item(session, data)
+ writer.write(col.render(session))
return writer.to_string()
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/cumin/python/wooly/widgets.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -32,17 +32,17 @@
return mode
- def do_process(self, session, object):
+ def do_process(self, session, *args):
mode = self.get_selected_mode(session)
if mode:
- mode.process(session, object)
+ mode.process(session)
- def render_mode(self, session, object):
+ def render_mode(self, session, *args):
mode = self.get_selected_mode(session)
if mode:
- return mode.render(session, object)
+ return mode.render(session)
class TabbedModeSet(ModeSet):
def __init__(self, app, name):
@@ -51,34 +51,30 @@
self.__tabs = list()
self.__tab_tmpl = Template(self, "tab_html")
- self.object = Attribute(app, "object")
- self.add_attribute(self.object)
-
def add_tab(self, tab):
self.__tabs.append(tab)
-
self.add_mode(tab)
- def render_tabs(self, session, object):
- self.object.set(session, object)
+ def render_tabs(self, session, *args):
writer = Writer()
for tab in self.__tabs:
- self.__tab_tmpl.render(session, tab, writer)
+ self.__tab_tmpl.render(writer, session, tab)
return writer.to_string()
- def render_tab_href(self, session, mode):
+ def render_tab_href(self, session, tab):
branch = session.branch()
- self.set_selected_mode(branch, mode)
+ self.set_selected_mode(branch, tab)
return branch.marshal()
- def render_tab_class(self, session, mode):
- smode = self.get_selected_mode(session)
- return smode == mode and "selected" or ""
+ def render_tab_class(self, session, tab):
+ stab = self.get_selected_mode(session)
+ return stab is tab and "selected" or ""
- def render_tab_content(self, session, mode):
- return mode.get_title(session, self.object.get(session))
+ def render_tab_content(self, session, tab):
+ args = tab.get_args(session)
+ return tab.render_title(session, *args)
class LinkSet(Widget):
def __init__(self, app, name):
@@ -91,33 +87,32 @@
self.__links.append(link)
self.add_child(link)
- def get_links(self, session, object):
+ def get_links(self, session):
return self.__links
- def render_links(self, session, object):
+ def render_links(self, session, *args):
writer = Writer()
- for link in self.get_links(session, object):
- self.__link_tmpl.render(session, (link, object), writer)
+ for link in self.get_links(session):
+ self.__link_tmpl.render(writer, session, link)
return writer.to_string()
- def render_link(self, session, args):
- link, object = args
- return link.render(session, object)
+ def render_link(self, session, link):
+ return link.render(session)
class Link(Widget):
- def render_class(self, session, object):
+ def render_class(self, session, *args):
+ print "args", self.get_args(session)
+
return self.html_class
- def edit_session(self, session, object):
+ def edit_session(self, session, *args):
pass
- def render_href(self, session, object):
+ def render_href(self, session, *args):
branch = session.branch()
-
- self.edit_session(branch, object)
-
+ self.edit_session(branch, *args)
return branch.marshal()
class Toggle(Link):
@@ -133,19 +128,19 @@
def set(self, session, toggled):
self.toggled.set(session, toggled)
- def do_process(self, session, object):
+ def do_process(self, session, *args):
if self.get(session):
- self.on_click(session, object)
+ self.on_click(session, *args)
- def on_click(self, session, object):
+ def on_click(self, session, *args):
pass
- def render_href(self, session, object):
+ def render_href(self, session, *args):
branch = session.branch()
self.set(branch, not self.get(session))
return branch.marshal()
- def render_state(self, session, object):
+ def render_state(self, session, *args):
return self.toggled.get(session) and "on" or "off"
class ItemSet(Widget):
@@ -157,52 +152,52 @@
self.item_tmpl = Template(self, "item_html")
- def get_item_count(self, session, object):
- return len(self.get_items(session, object))
+ def get_item_count(self, session, *args):
+ return len(self.get_items(session, *args))
- def get_items(self, session, object):
+ def get_items(self, session, *args):
items = self.items.get(session)
if items is None:
- items = self.do_get_items(session, object)
+ items = self.do_get_items(session, *args)
if items is None:
items = ()
return items
- def do_get_items(self, session, object):
+ def do_get_items(self, session, *args):
return ()
- def render_items(self, session, object):
- items = self.get_items(session, object)
+ def render_items(self, session, *args):
+ items = self.get_items(session, *args)
writer = Writer()
for item in items:
- self.item_tmpl.render(session, item, writer)
+ self.item_tmpl.render(writer, session, item)
return writer.to_string()
def render_item_content(self, session, item):
return None
- def render_none(self, session, object):
+ def render_none(self, session, *args):
"""For producing a message when the set is empty"""
return None
class ItemTree(ItemSet):
- def get_items(self, session, object):
+ def get_items(self, session, *args):
"""Get the root items"""
pass
- def get_child_items(self, session, object):
+ def get_child_items(self, session, *args):
pass
- def render_child_items(self, session, object):
+ def render_child_items(self, session, *args):
writer = Writer()
- for child in self.get_child_items(session, object):
- self.item_tmpl.render(session, child, writer)
+ for child in self.get_child_items(session, *args):
+ self.item_tmpl.render(writer, session, child)
return writer.to_string()
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/misc/boneyard.py 2008-03-19 12:59:51 UTC (rev 1773)
@@ -11,13 +11,16 @@
self.servers = self.BrowserServers(app, "servers")
self.add_child(self.servers)
- def get_object(self, session, object):
+ def get_args(self, session):
+ return self.frame().get_args(session)
+
+ def get_object(self, session):
return self.param.get(session)
def set_object(self, session, group):
return self.param.set(session, group)
- def get_title(self, session, group):
+ def render_title(self, session, group):
return "Servers %s" % fmt_count(len(self.app.model.get_servers()))
def render_all_servers_link(self, session, group):
@@ -60,7 +63,7 @@
writer = Writer()
for type in self.get_items(session, model):
- self.type_tmpl.render(session, type, writer)
+ self.type_tmpl.render(writer, session, type)
return writer.to_string()
@@ -71,7 +74,7 @@
writer = Writer()
for group in sorted_by(type.server_group_items()):
- self.group_tmpl.render(session, group, writer)
+ self.group_tmpl.render(writer, session, group)
return writer.to_string()
@@ -126,13 +129,13 @@
branch = session.branch()
return branch.marshal()
- def render_view(self, session, model):
+ def render_view(self, session, *args):
object = self.param.get(session)
if object:
- html = self.view.render(session, object)
+ html = self.view.render(session)
else:
- html = self.render_none(session, model)
+ html = self.render_none(session, *args)
return html
@@ -176,10 +179,10 @@
self.lvalue = TextInput(app, "local_value", self)
self.add_child(self.lvalue)
- def get_title(self, session, prop):
+ def render_title(self, session, prop):
return "Edit Property '%s'" % prop.name
- def get_object(self, session, object):
+ def get_object(self, session):
return self.param.get(session)
def set_config_property(self, session, prop):
@@ -210,7 +213,7 @@
self.lvalue.set(session, prop.value)
class BrokerConfigTab(ConfigPropertySet):
- def get_title(self, session, broker):
+ def render_title(self, session, broker):
return "Configuration"
def do_get_items(self, session, broker):
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-03-18 09:00:14 UTC (rev 1772)
+++ mgmt/notes/justin-todo.txt 2008-03-19 12:59:51 UTC (rev 1773)
@@ -1,5 +1,7 @@
Current
+ * Bind to localhost by default, and add config param
+
* Tables: Make null values in tables dashes, not zeroes
* Get rid of single object confirms
16 years, 9 months
rhmessaging commits: r1772 - store/trunk/java/bdbstore/src/main/java/com/redhat/rhm/server/store/berkeleydb/messageStore.
by rhmessaging-commits@lists.jboss.org
Author: asimon
Date: 2008-03-18 05:00:14 -0400 (Tue, 18 Mar 2008)
New Revision: 1772
Modified:
store/trunk/java/bdbstore/src/main/java/com/redhat/rhm/server/store/berkeleydb/messageStore/MessageStoreImpl.java
Log:
Updated for fixing compilation issues, this class will have to be updated for the new 0.10 broker.
Modified: store/trunk/java/bdbstore/src/main/java/com/redhat/rhm/server/store/berkeleydb/messageStore/MessageStoreImpl.java
===================================================================
--- store/trunk/java/bdbstore/src/main/java/com/redhat/rhm/server/store/berkeleydb/messageStore/MessageStoreImpl.java 2008-03-17 21:11:19 UTC (rev 1771)
+++ store/trunk/java/bdbstore/src/main/java/com/redhat/rhm/server/store/berkeleydb/messageStore/MessageStoreImpl.java 2008-03-18 09:00:14 UTC (rev 1772)
@@ -462,7 +462,7 @@
byte[] routingKey = ((AMQMessage) m).getMessagePublishInfo().getRoutingKey().getBytes();
final int headerSize = HEADER_SIZE + m.getHeaderSize() + EXCHANGENAME_SIZE + exchangeName.length + ROUTINGKEY_SIZE
+ routingKey.length + BOOLEAN_SIZE + BOOLEAN_SIZE;
- // we write header size � headerbody � payload size
+ // we write header size � headerbody � payload size
// The payload size is set during the first enqueue of the staged message
byte[] underlying = new byte[HEADER_SIZE + headerSize + PAYLOAD_SIZE];
ByteBuffer buf = ByteBuffer.wrap(underlying);
@@ -787,7 +787,7 @@
{
//This is the first time this message is enqueued and it has not been staged.
//We need to write the header body, the payload and the queue name
- // we write: headerSize � headerBody � payloadSize � payload � queueNames
+ // we write: headerSize � headerBody � payloadSize � payload � queueNames
underlying = new byte[HEADER_SIZE + headerSize + PAYLOAD_SIZE + m.getData().length + QUEUEID_SIZE];
ByteBuffer buf = ByteBuffer.wrap(underlying);
buf.putInt(headerSize);
@@ -1066,7 +1066,8 @@
AbstractRecord foundRecord;
com.redhat.rhm.server.store.berkeleydb.txn.TransactionImpl foundTx;
AMQQueue recorQueue;
- TransactionalContext txnContext = new NonTransactionalContext(this, new StoreContext(), null, null, null);
+ // TODO: changed for compilation issue, to be updated with the new 0.10 broker
+ TransactionalContext txnContext = null;// new NonTransactionalContext(this, new StoreContext(), null, null, null);
MessageHandleFactory messageHandleFactory = new MessageHandleFactory();
while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS)
{
@@ -1079,7 +1080,8 @@
foundRecord.setMessage(recorQueue.getEnqueuedMessage(foundRecord.getMessageID()));
} else
{
- foundRecord.setMessage(new AMQMessage(foundRecord.getMessageID(), this, messageHandleFactory, txnContext));
+ // TODO: changed for compilation issue, to be updated with the new 0.10 broker
+ foundRecord.setMessage( null); // new AMQMessage(foundRecord.getMessageID(), this, messageHandleFactory, txnContext));
}
foundTx = result.get(foundXid);
if (foundTx == null)
@@ -1103,7 +1105,8 @@
foundTx.addRecord(foundRecord);
}
}
- catch (AMQException e)
+ // TODO: changed for compilation issue, to be updated with the new 0.10 broker
+ catch (Exception e)
{
throw new InternalErrorException("Cannot recover in doubt tx", e);
}
@@ -1455,7 +1458,8 @@
try
{
StoreContext context = new StoreContext();
- TransactionalContext txnContext = new NonTransactionalContext(this, new StoreContext(), null, null, null);
+ // TODO: changed for compilation issue, to be updated with the new 0.10 broker
+ TransactionalContext txnContext = null; //new NonTransactionalContext(this, new StoreContext(), null, null, null);
MessageHandleFactory messageHandleFactory = new MessageHandleFactory();
cursor = _messageDB.openCursor(tx, null);
DatabaseEntry foundKey = new DatabaseEntry();
@@ -1491,7 +1495,8 @@
if (message.length > hs + ps + HEADER_SIZE + PAYLOAD_SIZE)
{
// this message has been enqueued
- foundMessage = new AMQMessage(foundMessageId, this, messageHandleFactory, txnContext);
+ // TODO: changed for compilation issue, to be updated with the new 0.10 broker
+ foundMessage = null; //new AMQMessage(foundMessageId, this, messageHandleFactory, txnContext);
for (int i = hs + ps + HEADER_SIZE + PAYLOAD_SIZE; i < message.length; i = i + QUEUEID_SIZE)
{
foundQueueID = buf.getInt();
16 years, 9 months
rhmessaging commits: r1771 - in store/trunk/cpp: lib/jrnl and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-03-17 17:11:19 -0400 (Mon, 17 Mar 2008)
New Revision: 1771
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/jrnl/enums.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/nlfh.cpp
store/trunk/cpp/lib/jrnl/nlfh.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
store/trunk/cpp/tests/jrnl/_st_basic.cpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/run-journal-tests
Log:
Bugfix for BZ437880: Small total message journal capacity can cause premature file overwrite. Added an outstanding aio count to class nlfh and an additional aio return enumeration to cover this case. Modified the return handler logic in class jcntl to handle this new return value.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -579,16 +579,16 @@
aio_sleep_cnt = 0;
break;
}
- case rhm::journal::RHM_IORES_AIO_WAIT:
- if (++aio_sleep_cnt > MAX_AIO_SLEEPS)
- THROW_STORE_EXCEPTION("Timeout waiting for AIO");
- ::usleep(AIO_SLEEP_TIME);
- break;
+ case rhm::journal::RHM_IORES_PAGE_AIOWAIT:
+ if (++aio_sleep_cnt > MAX_AIO_SLEEPS)
+ THROW_STORE_EXCEPTION("Timeout waiting for AIO");
+ ::usleep(AIO_SLEEP_TIME);
+ break;
case rhm::journal::RHM_IORES_EMPTY:
- read = false;
- break; // done with all messages. ((add call in jrnl to test that _emap is empty.
+ read = false;
+ break; // done with all messages. ((add call in jrnl to test that _emap is empty.
default:
- assert( "Store Error: Unexpected msg state");
+ assert( "Store Error: Unexpected msg state");
} // switch
} // while
} catch (const journal::jexception& e) {
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -147,7 +147,7 @@
&_dtok);
if (res == journal::RHM_IORES_SUCCESS) {
done = true;
- } else if (res == journal::RHM_IORES_AIO_WAIT) {
+ } else if (res == journal::RHM_IORES_PAGE_AIOWAIT) {
if (++aio_sleep_cnt <= MAX_AIO_SLEEPS) {
get_wr_events();
usleep(AIO_SLEEP_TIME);
Modified: store/trunk/cpp/lib/jrnl/enums.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enums.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/enums.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -44,7 +44,8 @@
enum _iores
{
RHM_IORES_SUCCESS = 0, ///< Success: IO operation completed noramlly.
- RHM_IORES_AIO_WAIT, ///< IO operation suspended - all pages are waiting for AIO.
+ RHM_IORES_PAGE_AIOWAIT, ///< IO operation suspended - next page is waiting for AIO.
+ RHM_IORES_FILE_AIOWAIT, ///< IO operation suspended - next file is waiting for AIO.
RHM_IORES_EMPTY, ///< During read operations, nothing further is available to read.
RHM_IORES_ENQCAPTHRESH, ///< Enqueue capacity threshold (limit) reached.
RHM_IORES_FULL, ///< During write operations, the journal files are full.
@@ -59,7 +60,8 @@
switch (res)
{
case RHM_IORES_SUCCESS: return "RHM_IORES_SUCCESS";
- case RHM_IORES_AIO_WAIT: return "RHM_IORES_AIO_WAIT";
+ case RHM_IORES_PAGE_AIOWAIT: return "RHM_IORES_PAGE_AIOWAIT";
+ case RHM_IORES_FILE_AIOWAIT: return "RHM_IORES_FILE_AIOWAIT";
case RHM_IORES_EMPTY: return "RHM_IORES_EMPTY";
case RHM_IORES_ENQCAPTHRESH: return "RHM_IORES_ENQCAPTHRESH";
case RHM_IORES_FULL: return "RHM_IORES_FULL";
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -217,7 +217,7 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, 0,
- 0, transient, false), r));
+ 0, transient, false), r, dtokp));
return r;
}
}
@@ -230,7 +230,7 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, 0, 0, transient,
- true), r));
+ true), r, dtokp));
return r;
}
}
@@ -245,7 +245,7 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp,
- xid.data(), xid.size(), transient, false), r));
+ xid.data(), xid.size(), transient, false), r, dtokp));
return r;
}
}
@@ -259,7 +259,7 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, xid.data(), xid.size(),
- transient, true), r));
+ transient, true), r, dtokp));
return r;
}
}
@@ -294,7 +294,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.dequeue(dtokp, 0, 0), r));
+ while (handle_aio_wait(_wmgr.dequeue(dtokp, 0, 0), r, dtokp));
return r;
}
}
@@ -306,7 +306,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.dequeue(dtokp, xid.data(), xid.size()), r));
+ while (handle_aio_wait(_wmgr.dequeue(dtokp, xid.data(), xid.size()), r, dtokp));
return r;
}
}
@@ -318,7 +318,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.abort(dtokp, xid.data(), xid.size()), r));
+ while (handle_aio_wait(_wmgr.abort(dtokp, xid.data(), xid.size()), r, dtokp));
return r;
}
}
@@ -330,7 +330,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.commit(dtokp, xid.data(), xid.size()), r));
+ while (handle_aio_wait(_wmgr.commit(dtokp, xid.data(), xid.size()), r, dtokp));
return r;
}
}
@@ -438,12 +438,13 @@
}
const bool
-jcntl::handle_aio_wait(const iores res, iores& resout)
+jcntl::handle_aio_wait(const iores res, iores& resout, const data_tok* dtp)
{
+ // TODO: factor out the common while loops below into a common fn
+ u_int32_t cnt = 0;
resout = res;
- if (res == RHM_IORES_AIO_WAIT)
+ if (res == RHM_IORES_PAGE_AIOWAIT)
{
- u_int32_t cnt = 0;
while (_wmgr.curr_pg_blocked())
{
_wmgr.get_events(pmgr::UNUSED);
@@ -457,6 +458,25 @@
}
return true;
}
+ else if (res == RHM_IORES_FILE_AIOWAIT)
+ {
+ while (_wmgr.curr_file_blocked())
+ {
+ _wmgr.get_events(pmgr::UNUSED);
+ if (cnt++ > MAX_AIO_CMPL_SLEEPS)
+ {
+ // TODO: Log this!
+ std::cout << "**** JERR_JCNTL_AIOCMPLWAIT *** " << _wmgr.status_str() << std::endl;
+ throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "handle_aio_wait");
+ }
+ ::usleep(AIO_CMPL_SLEEP);
+ }
+ _wrfc.reset();
+ resout = RHM_IORES_SUCCESS;
+ data_tok::write_state ws = dtp->wstate();
+ return ws == data_tok::ENQ_PART || ws == data_tok::DEQ_PART || ws == data_tok::ABORT_PART ||
+ ws == data_tok::COMMIT_PART;
+ }
return false;
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -605,7 +605,7 @@
* \brief Call that blocks until at least one message returns; used to wait for
* AIO wait conditions to clear.
*/
- const bool handle_aio_wait(const iores res, iores& resout);
+ const bool handle_aio_wait(const iores res, iores& resout, const data_tok* dtp);
/**
* \brief Analyze journal for recovery.
Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -55,11 +55,12 @@
_rd_cmpl_cnt_dblks(0),
#ifdef RHM_RDONLY
_wr_subm_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1)),
- _wr_cmpl_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1))
+ _wr_cmpl_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1)),
#else
_wr_subm_cnt_dblks(0),
- _wr_cmpl_cnt_dblks(0)
+ _wr_cmpl_cnt_dblks(0),
#endif
+ _aio_cnt(0)
{}
nlfh::nlfh(const std::string& fbasename, const u_int16_t fid, const u_int32_t jfsize_sblks,
@@ -74,11 +75,12 @@
_rd_cmpl_cnt_dblks(0),
#ifdef RHM_RDONLY
_wr_subm_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1)),
- _wr_cmpl_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1))
+ _wr_cmpl_cnt_dblks(JRNL_SBLK_SIZE * (jfsize_dblks + 1)),
#else
_wr_subm_cnt_dblks(0),
- _wr_cmpl_cnt_dblks(0)
+ _wr_cmpl_cnt_dblks(0),
#endif
+ _aio_cnt(0)
{
initialize(fbasename, fid, jfsize_sblks, ro);
open_fh();
@@ -221,7 +223,8 @@
}
#ifndef RHM_WRONLY
// Journal overflow test - checks if the file to be reset still contains enqueued records
- if (_rec_enqcnt)
+ // or outstanding aios
+ if (_rec_enqcnt || _aio_cnt)
return false;
#endif
#ifndef RHM_RDONLY
@@ -320,6 +323,15 @@
return _wr_cmpl_cnt_dblks;
}
+const u_int16_t
+nlfh::decr_aio_cnt()
+{
+ if(_aio_cnt == 0)
+ throw jexception(jerrno::JERR__UNDERFLOW, "Decremented _aio_cnt when already zero", "nlfh",
+ "decr_aio_cnt");
+ return --_aio_cnt;
+}
+
// Debug function
const std::string
nlfh::status_str() const
@@ -327,6 +339,7 @@
std::ostringstream oss;
oss << "fid=" << _fid << " ws=" << _wr_subm_cnt_dblks << " wc=" << _wr_cmpl_cnt_dblks;
oss << " rs=" << _rd_subm_cnt_dblks << " rc=" << _rd_cmpl_cnt_dblks;
+ oss << " ec=" << _rec_enqcnt << " ac=" << _aio_cnt;
return oss.str();
}
Modified: store/trunk/cpp/lib/jrnl/nlfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -66,6 +66,7 @@
u_int32_t _rd_cmpl_cnt_dblks; ///< Read file count (data blocks) for completed AIO
u_int32_t _wr_subm_cnt_dblks; ///< Write file count (data blocks) for submitted AIO
u_int32_t _wr_cmpl_cnt_dblks; ///< Write file count (data blocks) for completed AIO
+ u_int16_t _aio_cnt; ///< Outstanding AIO operations on this file
public:
nlfh(const u_int32_t jfsize_sblks);
@@ -104,6 +105,10 @@
inline const size_t wr_cmpl_offs() const { return _wr_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
const u_int32_t add_wr_cmpl_cnt_dblks(u_int32_t a);
+ inline const u_int16_t aio_cnt() const { return _aio_cnt; }
+ inline const u_int16_t incr_aio_cnt() { return ++_aio_cnt; }
+ const u_int16_t decr_aio_cnt();
+
// Derived helper functions
inline const bool rd_empty() const { return _wr_cmpl_cnt_dblks == 0; }
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -91,7 +91,7 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
aio_cycle();
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
@@ -185,7 +185,7 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
aio_cycle();
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
@@ -225,7 +225,7 @@
if (dtokp->rstate() == data_tok::SKIP_PART)
{
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
const iores res = skip(dtokp);
if (res != RHM_IORES_SUCCESS)
{
@@ -256,7 +256,7 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
aio_cycle();
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
@@ -476,7 +476,7 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
aio_cycle(); // check if any AIOs have returned
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
// Read data from this page, first block will have header and data size.
@@ -493,7 +493,7 @@
{
dtokp->set_rstate(data_tok::READ_PART);
dtokp->set_dsize(_enq_rec.data_size());
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
rptr = (void*)((char*)_page_ptr_arr[_pg_index]);
@@ -584,7 +584,7 @@
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
dtokp->set_rstate(data_tok::SKIP_PART);
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
}
}
else
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -128,7 +128,7 @@
return res;
bool cont = false;
- if (_enq_busy) // If enqueue() exited last time with RHM_IORES_FULL or RHM_IORES_AIO_WAIT
+ if (_enq_busy) // If enqueue() exited last time with RHM_IORES_FULL or RHM_IORES_PAGE_AIOWAIT
{
if (dtokp->wstate() == data_tok::ENQ_PART)
cont = true;
@@ -223,7 +223,7 @@
if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
{
- res = RHM_IORES_AIO_WAIT;
+ res = RHM_IORES_PAGE_AIOWAIT;
done = true;
}
@@ -262,7 +262,7 @@
return res;
bool cont = false;
- if (_deq_busy) // If dequeue() exited last time with RHM_IORES_FULL or RHM_IORES_AIO_WAIT
+ if (_deq_busy) // If dequeue() exited last time with RHM_IORES_FULL or RHM_IORES_PAGE_AIOWAIT
{
if (dtokp->wstate() == data_tok::DEQ_PART)
cont = true;
@@ -366,7 +366,7 @@
if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
{
- res = RHM_IORES_AIO_WAIT;
+ res = RHM_IORES_PAGE_AIOWAIT;
done = true;
}
@@ -405,7 +405,7 @@
return res;
bool cont = false;
- if (_abort_busy) // If abort() exited last time with RHM_IORES_FULL or RHM_IORES_AIO_WAIT
+ if (_abort_busy) // If abort() exited last time with RHM_IORES_FULL or RHM_IORES_PAGE_AIOWAIT
{
if (dtokp->wstate() == data_tok::ABORT_PART)
cont = true;
@@ -507,7 +507,7 @@
if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
{
- res = RHM_IORES_AIO_WAIT;
+ res = RHM_IORES_PAGE_AIOWAIT;
done = true;
}
@@ -546,7 +546,7 @@
return res;
bool cont = false;
- if (_commit_busy) // If commit() exited last time with RHM_IORES_FULL or RHM_IORES_AIO_WAIT
+ if (_commit_busy) // If commit() exited last time with RHM_IORES_FULL or RHM_IORES_PAGE_AIOWAIT
{
if (dtokp->wstate() == data_tok::COMMIT_PART)
cont = true;
@@ -644,7 +644,7 @@
if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
{
- res = RHM_IORES_AIO_WAIT;
+ res = RHM_IORES_PAGE_AIOWAIT;
done = true;
}
@@ -690,7 +690,7 @@
if (_cached_offset_dblks)
{
if (_page_cb_arr[_pg_index]._state == AIO_PENDING)
- res = RHM_IORES_AIO_WAIT;
+ res = RHM_IORES_PAGE_AIOWAIT;
else
{
if (_page_cb_arr[_pg_index]._state != IN_USE)
@@ -718,6 +718,7 @@
if (::io_submit(_ioctx, 1, &this_iocb_ptr) < 0)
throw jexception(jerrno::JERR__AIO, "wmgr", "write_flush");
_wrfc.add_subm_cnt_dblks(_cached_offset_dblks);
+ _wrfc.incr_aio_cnt();
_aio_evt_rem++;
_cached_offset_dblks = 0;
@@ -735,10 +736,8 @@
const iores
wmgr::rotate_file()
{
- if (!_wrfc.rotate())
- return RHM_IORES_FULL;
_pg_cntr = 0;
- return RHM_IORES_SUCCESS;
+ return _wrfc.rotate();
}
const u_int32_t
@@ -861,6 +860,7 @@
// NOTE: We cannot use _wrfc here, as it may have rotated since submitting count.
// Use stored pointer to nlfh in the pcb instead.
pcbp->_wfh->add_wr_cmpl_cnt_dblks(pcbp->_wdblks);
+ pcbp->_wfh->decr_aio_cnt();
// Clean up this pcb's data_tok list
pcbp->_pdtokl->clear();
@@ -951,7 +951,7 @@
if (_page_cb_arr[_pg_index]._state == UNUSED)
_page_cb_arr[_pg_index]._state = IN_USE;
else if (_page_cb_arr[_pg_index]._state == AIO_PENDING)
- return RHM_IORES_AIO_WAIT;
+ return RHM_IORES_PAGE_AIOWAIT;
else
{
std::ostringstream oss;
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -113,7 +113,9 @@
const iores flush();
const u_int32_t get_events(page_state state);
const bool is_txn_synced(const std::string& xid);
- inline const bool curr_pg_blocked() const { return _page_cb_arr[_pg_index]._state != UNUSED; }
+ inline const bool curr_pg_blocked() const
+ { return _page_cb_arr[_pg_index]._state != UNUSED; }
+ inline const bool curr_file_blocked() const { return _wrfc.aio_cnt() > 0; }
// Debug aid
const std::string status_str() const;
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -84,7 +84,7 @@
_enq_cap_offs_dblks = _fsize_dblks;
}
-bool
+const iores
wrfc::rotate()
{
if (!_nfiles)
@@ -96,7 +96,11 @@
_owi = !_owi;
}
_curr_fh = _fh_arr[_fh_index];
- return reset(); //Checks if file is still in use (ie not fully dequeued yet)
+ if (_curr_fh->aio_cnt())
+ return RHM_IORES_FILE_AIOWAIT;
+ if (!reset()) //Checks if file is still in use (ie not fully dequeued yet)
+ return RHM_IORES_FULL;
+ return RHM_IORES_SUCCESS;
}
const bool
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -39,6 +39,7 @@
}
}
+#include <jrnl/enums.hpp>
#include <jrnl/rrfc.hpp>
namespace rhm
@@ -80,7 +81,7 @@
* \brief Rotate active file handle to next file in rotating file group.
* \exception jerrno::JERR__NINIT if called before calling initialize().
*/
- bool rotate();
+ const iores rotate();
inline const u_int64_t rid() const { return _rid; }
inline const u_int64_t get_incr_rid() { return _rid++; }
@@ -102,6 +103,10 @@
inline const u_int32_t add_cmpl_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_wr_cmpl_cnt_dblks(a); }
+ inline const u_int16_t aio_cnt() const { return _curr_fh->aio_cnt(); }
+ inline const u_int16_t incr_aio_cnt() { return _curr_fh->incr_aio_cnt(); }
+ inline const u_int16_t decr_aio_cnt() { return _curr_fh->decr_aio_cnt(); }
+
inline const bool empty() const { return _curr_fh->wr_empty(); }
inline const u_int32_t remaining_dblks() const { return _curr_fh->wr_remaining_dblks(); }
inline const bool is_full() const { return _curr_fh->is_wr_full(); };
Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -119,12 +119,13 @@
jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
jrnl_init(jc);
unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS * JRNL_SBLK_SIZE,
- MSG_REC_SIZE_DBLKS);
+ MSG_REC_SIZE_DBLKS, true);
for (unsigned m=0; m<3*2*n; m+=2) // overwrite files 3 times
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
deq_msg(jc, m);
}
+ jc.stop(true);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -35,7 +35,7 @@
#define NUM_TEST_JFILES 4
#define NUM_DEFAULT_JFILES 8
#define JRNL_DEFAULT_FSIZE 24 // Multiples of JRNL_RMGR_PAGE_SIZE
-#define TEST_JFSIZE_SBLKS 96
+#define TEST_JFSIZE_SBLKS 128
#define DEFAULT_JFSIZE_SBLKS (JRNL_DEFAULT_FSIZE * JRNL_RMGR_PAGE_SIZE)
#define NUM_MSGS 5
#define MSG_REC_SIZE_DBLKS 2
@@ -67,7 +67,7 @@
handle_jcntl_response(const iores res, jcntl& jc, unsigned& aio_sleep_cnt, const std::string& ctxt,
const iores exp_ret)
{
- if (res == RHM_IORES_AIO_WAIT)
+ if (res == RHM_IORES_PAGE_AIOWAIT)
{
if (++aio_sleep_cnt <= MAX_AIO_SLEEPS)
{
@@ -102,9 +102,8 @@
ctxt << "enq_msg(" << rid << ")";
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.enqueue_data_record(msg.c_str(), msg.size(), msg.size(),
- dtp, transient), jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+ check_iores(ctxt.str(), jc.enqueue_data_record(msg.c_str(), msg.size(), msg.size(), dtp,
+ transient), exp_ret);
return dtp->rid();
}
@@ -116,9 +115,7 @@
ctxt << "enq_extern_msg(" << rid << ")";
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.enqueue_extern_data_record(msg_size, dtp, transient), jc,
- aio_sleep_cnt, ctxt.str(), exp_ret));
+ check_iores(ctxt.str(), jc.enqueue_extern_data_record(msg_size, dtp, transient), exp_ret);
return dtp->rid();
}
@@ -130,9 +127,8 @@
ctxt << "enq_txn_msg(" << rid << ")";
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.enqueue_txn_data_record(msg.c_str(), msg.size(), msg.size(),
- dtp, xid, transient), jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+ check_iores(ctxt.str(), jc.enqueue_txn_data_record(msg.c_str(), msg.size(), msg.size(), dtp,
+ xid, transient), exp_ret);
return dtp->rid();
}
@@ -144,9 +140,8 @@
ctxt << "enq_extern_txn_msg(" << rid << ")";
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.enqueue_extern_txn_data_record(msg_size, dtp, xid, transient),
- jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+ check_iores(ctxt.str(), jc.enqueue_extern_txn_data_record(msg_size, dtp, xid, transient),
+ exp_ret);
return dtp->rid();
}
@@ -159,9 +154,7 @@
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
dtp->set_wstate(data_tok::ENQ);
dtp->set_rid(drid);
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.dequeue_data_record(dtp), jc, aio_sleep_cnt, ctxt.str(),
- exp_ret));
+ check_iores(ctxt.str(), jc.dequeue_data_record(dtp), exp_ret);
return dtp->rid();
}
@@ -175,9 +168,7 @@
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
dtp->set_wstate(data_tok::ENQ);
dtp->set_rid(drid);
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.dequeue_txn_data_record(dtp, xid), jc, aio_sleep_cnt,
- ctxt.str(), exp_ret));
+ check_iores(ctxt.str(), jc.dequeue_txn_data_record(dtp, xid), exp_ret);
return dtp->rid();
}
@@ -186,9 +177,7 @@
{
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
-
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.txn_abort(dtp, xid), jc, aio_sleep_cnt, "txn_abort", exp_ret));
+ check_iores("txn_abort", jc.txn_abort(dtp, xid), exp_ret);
return dtp->rid();
}
@@ -197,10 +186,7 @@
{
data_tok* dtp = new data_tok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
-
- unsigned aio_sleep_cnt = 0;
- while (handle_jcntl_response(jc.txn_commit(dtp, xid), jc, aio_sleep_cnt, "txn_commit",
- exp_ret));
+ check_iores("txn_commit", jc.txn_commit(dtp, xid), exp_ret);
return dtp->rid();
}
@@ -237,23 +223,26 @@
const u_int32_t
num_msgs_to_full(const u_int16_t num_files, const u_int32_t file_size_dblks,
- const u_int32_t msg_rec_size_dblks)
+ const u_int32_t msg_rec_size_dblks, bool include_deq)
{
- return u_int32_t(::floor(1.0 * num_files * file_size_dblks / msg_rec_size_dblks));
+ u_int32_t rec_size_dblks = msg_rec_size_dblks;
+ if (include_deq)
+ rec_size_dblks++;
+ return u_int32_t(::floor(1.0 * num_files * file_size_dblks / rec_size_dblks));
}
const u_int32_t
num_msgs_to_threshold(const u_int16_t num_files, const u_int32_t file_size_dblks,
const u_int32_t msg_rec_size_dblks)
{
- return u_int32_t(::floor(1.0 * num_files * file_size_dblks * JRNL_ENQ_THRESHOLD /
+ return u_int32_t(::floor(1.0 * num_files * file_size_dblks * JRNL_ENQ_THRESHOLD /
msg_rec_size_dblks / 100));
}
const u_int32_t
num_dequeues_rem(const u_int16_t num_files, const u_int32_t file_size_sblks)
{
- return u_int32_t(::ceil(num_files * file_size_sblks * (1 - (1.0 * JRNL_ENQ_THRESHOLD / 100))));
+ return u_int32_t(::ceil(num_files * file_size_sblks * (1 - (1.0 * JRNL_ENQ_THRESHOLD / 100))));
}
const string&
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-03-17 21:11:19 UTC (rev 1771)
@@ -279,7 +279,7 @@
dptr = 0;
xptr = 0;
break;
- case rhm::journal::RHM_IORES_AIO_WAIT:
+ case rhm::journal::RHM_IORES_PAGE_AIOWAIT:
if (get_rd_events() == 0)
{
rhm::journal::slock sl(&_rd_aio_mutex);
Modified: store/trunk/cpp/tests/jrnl/run-journal-tests
===================================================================
--- store/trunk/cpp/tests/jrnl/run-journal-tests 2008-03-07 16:53:30 UTC (rev 1770)
+++ store/trunk/cpp/tests/jrnl/run-journal-tests 2008-03-17 21:11:19 UTC (rev 1771)
@@ -3,23 +3,23 @@
. ../setup
fail=0
-num_jrnls=3
+num_jrnls=1
# Run jtt using default test set
echo
-echo "***** Mode 1: New journal instance, no recover *****"
+echo "===== Mode 1: New journal instance, no recover ====="
rm -rf /tmp/test_0*
$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --format-chk --num-jrnls $num_jrnls || fail = 1
echo
-echo "***** Mode 2: Re-use journal instance, no recover *****"
+echo "===== Mode 2: Re-use journal instance, no recover ====="
rm -rf /tmp/test_0*
$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --format-chk --num-jrnls $num_jrnls || fail = 1
echo
-echo "***** Mode 3: New journal instance, recover previous test journal *****"
+echo "===== Mode 3: New journal instance, recover previous test journal ====="
rm -rf /tmp/test_0*
$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --recover-mode --format-chk --num-jrnls $num_jrnls || fail = 1
echo
-echo "***** Mode 4: Re-use journal instance, recover previous test journal *****"
+echo "===== Mode 4: Re-use journal instance, recover previous test journal ====="
rm -rf /tmp/test_0*
$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --recover-mode --format-chk --num-jrnls $num_jrnls || fail = 1
echo
16 years, 9 months
rhmessaging commits: r1770 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-07 11:53:30 -0500 (Fri, 07 Mar 2008)
New Revision: 1770
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/brokergroup.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/forms.strings
Log:
Convert the single object forms to use fields and field forms. As a
result, we can remove some duplicate html.
Make input item sets produce html lists of inputs.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-07 16:53:30 UTC (rev 1770)
@@ -596,37 +596,31 @@
return not len(nerrs) and not len(aerrs)
-class BrokerEdit(CuminForm, Frame):
+class BrokerEdit(CuminFieldForm):
def __init__(self, app, name):
super(BrokerEdit, self).__init__(app, name)
- self.broker_name = TextInput(app, "name", self)
- self.add_child(self.broker_name)
+ self.broker_name = NameField(app, "name", self)
+ self.add_field(self.broker_name)
- self.groups = BrokerGroupInputSet(app, "groups", self)
- self.add_child(self.groups)
+ self.groups = BrokerGroupCheckboxField(app, "groups", self)
+ self.add_field(self.groups)
def get_title(self, session, reg):
return "Edit Broker '%s'" % reg.name
- def validate(self, session):
- error = None
-
- name = self.broker_name.get(session)
-
- if name == "":
- error = EmptyInputError(self.broker_name)
- self.broker_name.add_error(session, error)
-
- return error is None
-
def process_cancel(self, session, reg):
branch = session.branch()
- self.frame().show_view(branch)
+ self.page().pop_current_frame(branch)
+ self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, reg):
- if self.validate(session):
+ errors = self.validate(session)
+
+ if errors:
+ pass
+ else:
action = self.app.model.broker_registration.edit
args = {"name": self.broker_name.get(session)}
action.invoke(reg, args)
@@ -692,4 +686,4 @@
def render_item_content(self, session, id):
return "Unregister Broker '%s'" % BrokerRegistration.get(id).name
-from brokergroup import BrokerGroupInputSet
+from brokergroup import BrokerGroupCheckboxField
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/broker.strings 2008-03-07 16:53:30 UTC (rev 1770)
@@ -202,34 +202,6 @@
[BrokerSetForm.group_html]
<option value="{group_value}" {group_selected_attr}>{group_name}</option>
-[BrokerEdit.html]
-<form id="{id}" class="mform" method="post" action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <span class="legend">Name</span>
- <fieldset>{name}</fieldset>
-
- <span class="legend">Groups</span>
- <fieldset>{groups}</fieldset>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- <a class="help action" href="{href}" target="help">Help</a>
- {submit}
- {cancel}
- </div>
-</form>
-<script defer="defer">
-(function() {
- var elem = wooly.doc().elembyid("{id}").node.elements[1];
- elem.focus();
- elem.select();
-}())
-</script>
-
[BrokerGroupInputSet.item_html]
<div class="field">
<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/brokergroup.py 2008-03-07 16:53:30 UTC (rev 1770)
@@ -59,6 +59,18 @@
def render_item_checked_attr(self, session, group):
return group in self.param.get(session) and "checked=\"checked\""
+class BrokerGroupCheckboxField(FormField):
+ def __init__(self, app, name, form):
+ super(BrokerGroupCheckboxField, self).__init__(app, name, form)
+
+ self.__inputs = BrokerGroupInputSet(app, "inputs", form)
+ self.add_child(self.__inputs)
+
+ self.set_parameter(self.__inputs.get_parameter())
+
+ def get_title(self, session, object):
+ return "Broker Groups"
+
class BrokerGroupFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerGroupFrame, self).__init__(app, name)
@@ -125,12 +137,12 @@
return "where exists (%s)" % subquery
-class BrokerGroupForm(CuminForm, Frame):
+class BrokerGroupForm(CuminFieldForm):
def __init__(self, app, name):
super(BrokerGroupForm, self).__init__(app, name)
- self.group_name = TextInput(app, "name", self)
- self.add_child(self.group_name)
+ self.group_name = NameField(app, "name", self)
+ self.add_field(self.group_name)
class BrokerGroupAdd(BrokerGroupForm):
def get_title(self, session, model):
@@ -138,35 +150,45 @@
def process_cancel(self, session, model):
branch = session.branch()
- self.frame().frame().show_view(branch)
self.page().pop_current_frame(branch)
self.page().pop_current_frame(branch)
+ self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, model):
- args = {"name": self.group_name.get(session)}
- method = self.app.model.broker_group.add
- method.invoke(None, args)
+ errors = self.validate(session)
- self.process_cancel(session, model)
+ if errors:
+ pass
+ else:
+ args = {"name": self.group_name.get(session)}
+ method = self.app.model.broker_group.add
+ method.invoke(None, args)
+ self.process_cancel(session, model)
+
class BrokerGroupEdit(BrokerGroupForm):
def get_title(self, session, group):
return "Edit Group '%s'" % group.name
def process_cancel(self, session, group):
branch = session.branch()
- self.frame().show_view(branch)
self.page().pop_current_frame(branch)
+ self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, group):
- args = {"name": self.group_name.get(session)}
- method = self.app.model.broker_group.edit
- method.invoke(group, args)
+ errors = self.validate(session)
- self.process_cancel(session, group)
+ if errors:
+ pass
+ else:
+ args = {"name": self.group_name.get(session)}
+ method = self.app.model.broker_group.edit
+ method.invoke(group, args)
+ self.process_cancel(session, group)
+
def process_display(self, session, group):
self.group_name.set(session, group.name)
Modified: mgmt/cumin/python/cumin/brokergroup.strings
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.strings 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/brokergroup.strings 2008-03-07 16:53:30 UTC (rev 1770)
@@ -42,28 +42,3 @@
</table>
{tabs}
-
-[BrokerGroupForm.html]
-<form id="{id}" class="mform" method="post" action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <span class="legend">Name</span>
- <fieldset>{name}</fieldset>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- <a class="help action" href="{href}" target="help">Help</a>
- {submit}
- {cancel}
- </div>
-</form>
-<script defer="defer">
-(function() {
- var elem = wooly.doc().elembyid("{id}").node.elements[1];
- elem.focus();
- elem.select();
-}())
-</script>
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/queue.py 2008-03-07 16:53:30 UTC (rev 1770)
@@ -298,7 +298,7 @@
def render_item_name(self, session, binding):
return binding.exchange.name or "<em>Default</em>"
-class QueueForm(CuminFieldForm, Frame):
+class QueueForm(CuminFieldForm):
def __init__(self, app, name):
super(QueueForm, self).__init__(app, name)
@@ -309,6 +309,13 @@
self.add_field(self.durable)
class QueueAdd(QueueForm):
+ def process_cancel(self, session, object):
+ branch = session.branch()
+ self.page().pop_current_frame(branch)
+ self.page().pop_current_frame(branch)
+ self.page().get_current_frame(branch).show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
def process_submit(self, session, object):
errors = self.validate(session)
@@ -323,11 +330,7 @@
print "XXX add queue", name, self.durable.get(session)
- branch = session.branch()
- #self.frame().frame().show_queue(branch, queue).show_view(branch)
- self.page().pop_current_frame(branch)
- self.page().pop_current_frame(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.process_cancel(session, object)
def get_title(self, session, object):
reg = self.frame().frame().get_object(session, None)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-07 16:53:30 UTC (rev 1770)
@@ -149,7 +149,7 @@
def render_content(self, session, object):
return self.parent.render_submit_content(session, object)
-class CuminFieldForm(CuminForm, FieldForm):
+class CuminFieldForm(CuminForm, FieldForm, Frame):
pass
class CuminConfirmForm(CuminForm):
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/wooly/forms.py 2008-03-07 16:53:30 UTC (rev 1770)
@@ -307,7 +307,7 @@
self.__input = input
return input
- def render_content(self, session, object):
+ def render_inputs(self, session, object):
return self.__input.render(session, object)
class StringField(ScalarField):
@@ -339,7 +339,7 @@
self.options.append(option)
self.add_child(option)
- def render_content(self, session, object):
+ def render_inputs(self, session, object):
writer = Writer()
for option in self.options:
Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings 2008-03-07 04:59:23 UTC (rev 1769)
+++ mgmt/cumin/python/wooly/forms.strings 2008-03-07 16:53:30 UTC (rev 1770)
@@ -11,18 +11,22 @@
<input type="radio" name="{name}" value="{value}" tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
[CheckboxInputSet.html]
-{items}
+<ul>{items}</ul>
[CheckboxInputSet.item_html]
-<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
-{item_content}
+<li>
+ <input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
+ {item_content}
+</li>
[RadioInputSet.html]
-{items}
+<ul>{items}</ul>
[RadioInputSet.item_html]
-<input type="radio" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
-{item_content}
+<li>
+ <input type="radio" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
+ {item_content}
+</li>
[OptionInputSet.html]
<select name="{name}" tabindex="{tab_index}" {disabled_attr}>{items}</select>
@@ -47,7 +51,7 @@
margin: 0 0 1em 0;
}
-div.field div.content {
+div.field div.inputs {
margin: 0 0 1em 1em;
}
@@ -55,7 +59,7 @@
<div class="field">
<div class="title">{title}</div>
{errors}
- <div class="content">{content}</div>
+ <div class="inputs">{inputs}</div>
</div>
[FormFieldErrors.html]
16 years, 9 months
rhmessaging commits: r1769 - in mgmt: cumin/python/cumin and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-06 23:59:23 -0500 (Thu, 06 Mar 2008)
New Revision: 1769
Modified:
mgmt/Makefile
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/__init__.strings
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/forms.strings
mgmt/cumin/python/wooly/server.py
mgmt/misc/boneyard.py
mgmt/misc/boneyard.strings
Log:
Phase 1 of the form overhaul.
Takes the error attr and error renderering off of Widget. That was
dubious idea to start with.
Introduces form fields, a type of form in put with a title, a slot for
errors, and which can server in a special kind of field-oriented form.
Moves some dead code to the boneyard.
Modified: mgmt/Makefile
===================================================================
--- mgmt/Makefile 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/Makefile 2008-03-07 04:59:23 UTC (rev 1769)
@@ -1,5 +1,8 @@
-.PHONY: dist clean
+.PHONY: help dist clean
+help:
+ @echo Targets: dist, clean, tags
+
dist: clean
mkdir -p dist/lib/python/mint
mkdir -p dist/lib/python/wooly
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -143,9 +143,6 @@
self.add_mode(self.remove)
self.set_remove_mode(self.remove)
- self.prop = BrokerConfigPropertyForm(app, "prop")
- self.add_mode(self.prop)
-
self.queue = QueueFrame(app, "queue")
self.add_mode(self.queue)
@@ -161,11 +158,6 @@
self.clients_close = ClientSetClose(app, "clientsclose")
self.add_mode(self.clients_close)
- def show_config_property(self, session, prop):
- self.prop.set_config_property(session, prop)
- self.page().set_current_frame(session, self.prop)
- return self.show_mode(session, self.prop)
-
def show_queue(self, session, queue):
self.queue.set_object(session, queue)
self.page().set_current_frame(session, self.queue)
@@ -192,87 +184,6 @@
def get_title(self, session, broker):
return "Broker '%s'" % broker.name
-class BrokerConfigPropertyForm(CuminForm, Frame):
- def __init__(self, app, name):
- super(BrokerConfigPropertyForm, self).__init__(app, name)
-
- self.param = ConfigPropertyParameter(app, "param")
- self.add_parameter(self.param)
-
- self.source = Parameter(app, "source")
- self.source.set_default("local")
- self.add_parameter(self.source)
-
- self.profile = RadioInput(app, "profile", self)
- self.profile.set_parameter(self.source)
- self.profile.set_value("profile")
- self.add_child(self.profile)
-
- self.pvalue = TextInput(app, "profile_value", self)
- self.pvalue.set_disabled(True)
- self.add_child(self.pvalue)
-
- self.broker = RadioInput(app, "broker", self)
- self.broker.set_parameter(self.source)
- self.broker.set_value("broker")
- self.add_child(self.broker)
-
- self.svalue = TextInput(app, "broker_value", self)
- self.svalue.set_disabled(True)
- self.add_child(self.svalue)
-
- self.local = RadioInput(app, "local", self)
- self.local.set_parameter(self.source)
- self.local.set_value("local")
- self.add_child(self.local)
-
- self.lvalue = TextInput(app, "local_value", self)
- self.add_child(self.lvalue)
-
- def get_title(self, session, prop):
- return "Edit Property '%s'" % prop.name
-
- def get_object(self, session, object):
- return self.param.get(session)
-
- def set_config_property(self, session, prop):
- return self.param.set(session, prop)
-
- def process_cancel(self, session, prop):
- branch = session.branch()
- self.page().show_broker(branch, prop.get_broker()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
-
- def process_submit(self, session, prop):
- source = self.source.get(session)
-
- if source == "profile":
- prop.value = get_profile_value(prop)
- elif source == "broker":
- prop.value = prop.broker_value
- elif source == "local":
- prop.value = self.lvalue.get(session)
- else:
- raise Exception()
-
- self.process_cancel(session, prop)
-
- def process_display(self, session, prop):
- self.pvalue.set(session, get_profile_value(prop))
- self.svalue.set(session, prop.broker_value)
- self.lvalue.set(session, prop.value)
-
-def get_profile_value(prop):
- profile = prop.get_broker().get_broker_profile()
- value = None
-
- if profile:
- for p in profile.config_property_items():
- if p.name == prop.name:
- value = p.value
-
- return value
-
class BrokerStatus(CuminStatus):
pass
@@ -297,10 +208,6 @@
self.tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
self.tabs.add_tab(self.BrokerClientTab(app, "clients"))
- #self.config = self.BrokerConfigTab(app, "config")
- #self.tabs.add_tab(self.config)
- #self.tabs.add_tab(self.BrokerStatsTab(app, "stats"))
- #self.tabs.add_tab(self.BrokerLogTab(app, "log"))
self.missing = self.BrokerMissing(app, "missing")
self.body.add_mode(self.missing)
@@ -319,8 +226,7 @@
def do_process(self, session, reg):
if reg.broker:
- vhost = Vhost.selectBy(broker=reg.broker, name="/")[0]
- self.vhost.set(session, vhost)
+ self.vhost.set(session, reg.getDefaultVhost())
else:
self.body.show_mode(session, self.missing)
@@ -363,15 +269,25 @@
else:
return fmt_none()
- class BrokerQueueTab(QueueSet):
+ class BrokerQueueTab(Widget):
+ def __init__(self, app, name):
+ super(BrokerView.BrokerQueueTab, self).__init__(app, name)
+
+ self.__queues = QueueSet(app, "items")
+ self.add_child(self.__queues)
+
def get_object(self, session, reg):
return self.parent.parent.parent.vhost.get(session)
- def get_title(self, session, broker):
- vhost = self.parent.parent.parent.vhost.get(session)
- return super(BrokerView.BrokerQueueTab, self).get_title \
- (session, vhost)
+ def get_title(self, session, reg):
+ vhost = reg.getDefaultVhost()
+ return "Queues %s" % fmt_count(vhost.queues.count())
+ def render_add_queue_href(self, session, object):
+ branch = session.branch()
+ self.frame().show_queue(branch, None).show_add(branch)
+ return branch.marshal()
+
class BrokerExchangeTab(ExchangeSet):
def get_object(self, session, reg):
return self.parent.parent.parent.vhost.get(session)
@@ -390,33 +306,6 @@
return super(BrokerView.BrokerClientTab, self).get_title \
(session, vhost)
- class BrokerConfigTab(ConfigPropertySet):
- def get_title(self, session, broker):
- return "Configuration"
-
- def do_get_items(self, session, broker):
- return broker.properties
-
- def maybe_highlight(self, value, comparedto):
- if str(value) != str(comparedto):
- value = "<span class=\"BrokerConfigTab diff\">%s</span>" \
- % value
-
- return value
-
- def render_item_broker_value(self, session, prop):
- return self.maybe_highlight(prop.broker_value, prop.value)
-
- def render_item_profile_value(self, session, prop):
- value = get_profile_value(prop)
- return self.maybe_highlight(value, prop.value)
-
- def render_item_edit_href(self, session, prop):
- branch = session.branch()
- frame = self.page().show_broker(branch, prop.get_broker())
- frame.show_config_property(branch, prop)
- return branch.marshal()
-
class BrokerStatsTab(Widget):
def get_title(self, session, broker):
return "Statistics"
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/broker.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -39,87 +39,6 @@
{hidden_inputs}
</form>
-[BrokerConfigTab.css]
-.BrokerConfigTab.diff {
- background-color: #ff9;
-}
-
-[BrokerSetGroupInput.html]
-<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="getElementById('{submit_id}').click()">
- <option value="">Choose Group...</option>
- {items}
-</select>
-
-[BrokerConfigTab.html]
-<ul class="actions">
- <li><a class="nav" href="{href}">Add Property</a></li>
- <li><a href="{href}">Apply Configuration to Broker</a></li>
-</ul>
-
-<table class="mobjects">
- <tr>
- <th>Name</th>
- <th>Configured Value</th>
- <th>Broker Value</th>
- <th>Profile Value</th>
- <th></th>
- </tr>
-
- {items}
-</table>
-
-[BrokerConfigTab.item_html]
-<tr>
- <td>{item_name}</td>
- <td>{item_value}</td>
- <td>{item_broker_value}</td>
- <td>{item_profile_value}</td>
- <td><a class="action" href="{item_edit_href}">Edit</a></td>
-</tr>
-
-[BrokerConfigPropertyForm.css]
-.BrokerConfigPropertyForm div.value {
- margin: 1em 2em;
-}
-
-[BrokerConfigPropertyForm.html]
-<form id="{id}" class="BrokerConfigPropertyForm mform" method="post" action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <span class="legend">Value</span>
- <fieldset>
- <div class="field">
- {profile} Use the value from the broker profile
- <div class="value">{profile_value}</div>
- </div>
- <div class="field">
- {broker} Use the value currently set on the broker
- <div class="value">{broker_value}</div>
- </div>
- <div class="field">
- {local} Set a new value
- <div class="value">{local_value}</div>
- </div>
- </fieldset>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- <div style="float: left;"><button>Help</button></div>
- {submit}
- {cancel}
- </div>
-</form>
-<script defer="defer">
-(function() {
- var elem = wooly.doc().elembyid("{id}").node.elements[1];
- elem.focus();
- elem.select();
-}())
-</script>
-
[BrokerView.javascript]
function updateBroker(data) {
var model = data.objectify();
@@ -172,6 +91,13 @@
window.setInterval(updateTimer, 1000);
</script>
+[BrokerQueueTab.html]
+<ul class="actions">
+ <li><a class="nav" href="{add_queue_href}">Add Queue</a></li>
+</ul>
+
+{items}
+
[BrokerBrowser.html]
<table class="browser">
<tr>
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/queue.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -1,3 +1,5 @@
+import pdb
+
from mint import *
from wooly import *
from wooly.widgets import *
@@ -58,7 +60,7 @@
self.add_child(self.__purge)
def get_title(self, session, vhost):
- return "Queues %s" % fmt_count(vhost.queues.count())
+ return "Queues %s" % fmt_count(Queue.select().count())
def render_sql_where(self, session, vhost):
elems = list()
@@ -167,6 +169,10 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.add = QueueAdd(app, "add")
+ self.add_mode(self.add)
+ self.set_add_mode(self.add)
+
self.purge = QueuePurge(app, "purge")
self.add_mode(self.purge)
@@ -181,7 +187,10 @@
return queue
def get_title(self, session, queue):
- return "Queue '%s'" % queue.name
+ if queue:
+ return "Queue '%s'" % queue.name
+ else:
+ return "Queue"
class QueueStatus(CuminStatus):
def render_consumers(self, session, queue):
@@ -289,124 +298,41 @@
def render_item_name(self, session, binding):
return binding.exchange.name or "<em>Default</em>"
-class QueueForm(CuminForm):
+class QueueForm(CuminFieldForm, Frame):
def __init__(self, app, name):
super(QueueForm, self).__init__(app, name)
- self.queue_name = TextInput(app, "queue_name", self)
- self.add_child(self.queue_name)
+ self.namef = NameField(app, "name", self)
+ self.add_field(self.namef)
- self.latency_priority = Parameter(app, "tuning")
- self.latency_priority.set_default("m")
- self.add_parameter(self.latency_priority)
+ self.durable = DurabilityField(app, "durable", self)
+ self.add_field(self.durable)
- self.latency = RadioInput(app, "latency", self)
- self.latency.set_parameter(self.latency_priority)
- self.latency.set_value("h")
- self.add_child(self.latency)
-
- self.balanced = RadioInput(app, "balanced", self)
- self.balanced.set_parameter(self.latency_priority)
- self.balanced.set_value("m")
- self.add_child(self.balanced)
-
- self.throughput = RadioInput(app, "throughput", self)
- self.throughput.set_parameter(self.latency_priority)
- self.throughput.set_value("l")
- self.add_child(self.throughput)
-
- def validate(self, session):
- error = None
-
- name = self.queue_name.get(session)
-
- if name == "":
- error = EmptyInputError(self.queue_name)
- self.queue_name.add_error(session, error)
- elif " " in name:
- error = Error("""
- The queue name is invalid; allowed characters are
- letters, digits, ".", and "_"
- """)
- self.queue_name.add_error(session, error)
-
- return error is None
-
class QueueAdd(QueueForm):
- def process_cancel(self, session, vhost):
- branch = session.branch()
- self.page().show_broker(branch, vhost.broker).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ def process_submit(self, session, object):
+ errors = self.validate(session)
- def process_submit(self, session, vhost):
- if self.validate(session):
- queue = Queue()
- queue.name = self.queue_name.get(session)
+ if errors:
+ pass
+ else:
+ reg = self.frame().frame().get_object(session, None)
+ vhost = reg.getDefaultVhost()
- vhost.addQueue(queue)
+ name = self.namef.get(session)
+ durable = self.durable.get(session)
+
+ print "XXX add queue", name, self.durable.get(session)
branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
+ #self.frame().frame().show_queue(branch, queue).show_view(branch)
+ self.page().pop_current_frame(branch)
+ self.page().pop_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
- def get_title(self, session, vhost):
- return "Add Queue to Host Template '%s'" % vhost.name
-
-class QueueEdit(QueueForm):
- def process_cancel(self, session, queue):
- branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ def get_title(self, session, object):
+ reg = self.frame().frame().get_object(session, None)
+ return "Add Queue to Broker '%s'" % reg.name
- def process_submit(self, session, queue):
- if self.validate(session):
- queue.lock()
- try:
- queue.name = self.queue_name.get(session)
- queue.latency_priority = self.latency_priority.get(session)
- finally:
- queue.unlock()
-
- branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
- self.process_cancel(session, queue)
-
- def process_display(self, session, queue):
- self.queue_name.set(session, queue.name)
- self.latency_priority.set(session, queue.latency_priority)
-
- def get_title(self, session, queue):
- return "Edit Queue '%s'" % queue.name
-
-class QueueRemove(CuminConfirmForm):
- def get_title(self, session, queue):
- return "Remove Queue '%s'" % queue.name
-
- def process_cancel(self, session, queue):
- branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
-
- def process_submit(self, session, queue):
- vhost = queue.get_virtual_host()
-
- queue.remove()
-
- branch = session.branch()
- self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
-
- def render_submit_content(self, session, queue):
- return "Yes, Remove Queue '%s'" % queue.name
-
- def render_cancel_content(self, session, queue):
- return "No, Cancel"
-
-def doit(error, args):
- pass
- #print error, args
- #print "did it!"
-
class QueuePurge(CuminConfirmForm):
def get_title(self, session, queue):
return "Purge Queue '%s'" % queue.name
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/queue.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -59,50 +59,6 @@
{hidden_inputs}
</form>
-[QueueForm.html]
-<form id="{id}" class="mform" method="post" action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <span class="legend">Name</span>
- <fieldset>
- <div class="field">{queue_name}</div>
- </fieldset>
-
- <span class="legend">Latency Tuning</span>
- <fieldset>
- <div class="field">
- {latency}
- <em>Lower Latency:</em> Tune for shorter delays, with reduced volume
- </div>
- <div class="field">
- {balanced}
- <em>Balanced</em>
- </div>
- <div class="field">
- {throughput}
- <em>Higher Throughput:</em> Tune for increased volume, with longer
- delays
- </div>
- </fieldset>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- <div style="display: block; float: left;"><button>Help</button></div>
- {submit}
- {cancel}
- </div>
-</form>
-<script defer="defer">
-(function() {
- var elem = wooly.doc().elembyid("{id}").node.elements[1];
- elem.focus();
- elem.select();
-}())
-</script>
-
[QueueStatus.javascript]
function updateQueueStatus(id, queue) {
updateStatus(id, queue);
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -149,6 +149,9 @@
def render_content(self, session, object):
return self.parent.render_submit_content(session, object)
+class CuminFieldForm(CuminForm, FieldForm):
+ pass
+
class CuminConfirmForm(CuminForm):
def __init__(self, app, name):
super(CuminConfirmForm, self).__init__(app, name)
@@ -526,3 +529,59 @@
def render_elem_name(self, session, object):
return self.column.ids.path()
+
+class NameField(StringField):
+ def __init__(self, app, name, form):
+ super(NameField, self).__init__(app, name, form)
+
+ self.required = True
+ self.illegal_chars = ""
+ self.legal_chars_desc = None
+
+ def get_title(self, session, object):
+ return "Name"
+
+ def do_validate(self, session, errors):
+ name = self.get(session)
+
+ if name == "":
+ errors.append(MissingValueError())
+ else:
+ for char in self.illegal_chars:
+ if char in name:
+ msg = "The name contains illegal characters"
+ if self.legal_chars_desc:
+ msg = msg + "; " + self.legal_chars_desc
+
+ errors.append(Error(msg))
+
+ break
+
+class DurabilityField(RadioField):
+ def __init__(self, app, name, form):
+ super(DurabilityField, self).__init__(app, name, form)
+
+ param = Parameter(app, "param")
+ param.default = "durable"
+ self.add_parameter(param)
+ self.set_parameter(param)
+
+ self.add_option(self.Durable(app, "durable", form))
+ self.add_option(self.Transient(app, "transient", form))
+
+ def get_title(self, session, object):
+ return "Durable?"
+
+ class Durable(RadioFieldOption):
+ def get_value(self, session, object):
+ return "durable"
+
+ def get_title(self, session, object):
+ return "Durable"
+
+ class Transient(RadioFieldOption):
+ def get_value(self, session, object):
+ return "transient"
+
+ def get_title(self, session, object):
+ return "Transient"
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -1,3 +1,17 @@
+[CuminFieldForm.html]
+<form id="{id}" class="mform" method="post" action="?">
+ <div class="head">{title}</div>
+ <div class="body">{fields}</div>
+ <div class="foot">
+ {submit}
+ {cancel}
+ </div>
+ {hidden_inputs}
+</form>
+<script>
+ wooly.doc().elembyid("{id}").node.elements[0].focus();
+</script>
+
[CuminConfirmForm.html]
<form id="{id}" class="mform" method="post" action="?">
<div class="head">
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -101,12 +101,7 @@
self.html_class = None
self.__main_tmpl = Template(self, "html")
- self.__errors_tmpl = Template(self, "errors_html")
- self.__error_message_tmpl = Template(self, "error_message_html")
- self.__errors = self.ErrorsAttribute(app, "errors")
- self.add_attribute(self.__errors)
-
self.args = self.ArgsAttribute(app, "args")
self.add_attribute(self.args)
@@ -123,10 +118,6 @@
if cls is Widget:
break
- class ErrorsAttribute(Attribute):
- def get_default(self, session):
- return list()
-
class ArgsAttribute(Attribute):
def get_default(self, session):
if self.widget.parent:
@@ -219,12 +210,6 @@
if str:
return str
- def get_errors(self, session):
- return self.__errors.get(session)
-
- def add_error(self, session, error):
- self.__errors.get(session).append(error)
-
def get(self, session, name):
return self.args.get(session).get(name)
@@ -306,25 +291,6 @@
return writer.to_string()
- def render_errors(self, session, object):
- writer = Writer()
-
- if self.get_errors(session):
- self.__errors_tmpl.render(session, object, writer)
-
- return writer.to_string()
-
- def render_error_messages(self, session, object):
- writer = Writer()
-
- for error in self.get_errors(session):
- self.__error_message_tmpl.render(session, error, writer)
-
- return writer.to_string()
-
- def render_error_message(self, session, error):
- return error.message
-
def prt(self):
print self
@@ -666,6 +632,13 @@
return "%s(trunk=%s,app=%s)" % \
(self.__class__.__name__, self.trunk, self.app)
+class Error(object):
+ def __init__(self, message=None):
+ self.message = message
+
+ def get_message(self, session):
+ return self.message
+
class StringIOWriter(object):
def __init__(self):
self.writer = StringIO()
@@ -693,10 +666,6 @@
class Writer(StringIOWriter):
pass
-class Error(object):
- def __init__(self, message):
- self.message = message
-
class Template(object):
def __init__(self, widget, key):
self.widget = widget
Modified: mgmt/cumin/python/wooly/__init__.strings
===================================================================
--- mgmt/cumin/python/wooly/__init__.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/wooly/__init__.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -1,8 +1,2 @@
[Widget.html]
{content}
-
-[Widget.errors_html]
-<ul class="errors">{error_messages}</ul>
-
-[Widget.error_message_html]
-<li>{error_message}</li>
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/wooly/forms.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -74,7 +74,7 @@
return self.param.get_default(session)
def set_default(self, default):
- self.param.set_default(default)
+ return self.param.set_default(default)
def set_tab_index(self, tab_index):
self.tab_index = tab_index
@@ -94,12 +94,17 @@
def render_disabled_attr(self, session, object):
return self.disabled and "disabled=\"disabled\"" or None
+class MissingValueError(Error):
+ def get_message(self, session):
+ return "This value is required"
+
class EmptyInputError(Error):
- def __init__(self, input):
- message = "Input '%s' is empty; it is required" % input.name
+ def __init__(self):
+ message = "This value is required"
super(EmptyInputError, self).__init__(message)
+# XXX rename to ScalarInput. it's less confusing v-a-v StringInput
class TextInput(FormInput):
def __init__(self, app, name, form):
super(TextInput, self).__init__(app, name, form)
@@ -151,16 +156,20 @@
self.value = None
- def set_value(self, value):
+ def xxx_set_value(self, value):
self.value = value
+ def get_value(self, session, object):
+ pass
+
def render_value(self, session, object):
- return self.value
+ return self.get_value(session, object)
def render_checked_attr(self, session, object):
value = self.get(session)
- return value and value == self.value and "checked=\"checked\""
+ if value and value == self.get_value(session, object):
+ return "checked=\"checked\""
class FormButton(FormInput):
def __init__(self, app, name, form):
@@ -205,3 +214,170 @@
def render_item_selected_attr(self, session, object):
return None
+
+class FieldSet(Widget):
+ def __init__(self, app, name):
+ super(FieldSet, self).__init__(app, name)
+
+ self.fields = list()
+
+ def add_field(self, field):
+ assert isinstance(field, FormField)
+
+ self.fields.append(field)
+ self.add_child(field)
+
+ def render_fields(self, session, object):
+ writer = Writer()
+
+ for field in self.fields:
+ writer.write(field.render(session, object))
+
+ return writer.to_string()
+
+class FormField(Widget):
+ def __init__(self, app, name, form):
+ super(FormField, self).__init__(app, name)
+
+ self.__form = form
+ self.__param = None
+
+ self.__errors = FormFieldErrors(app, "errors")
+ self.add_child(self.__errors)
+
+ def get_parameter(self):
+ return self.__param
+
+ def set_parameter(self, param):
+ assert isinstance(param, Parameter)
+
+ self.__param = param
+ return param
+
+ def get(self, session):
+ return self.__param.get(session)
+
+ def set(self, session, value):
+ return self.__param.set(session, value)
+
+ def validate(self, session):
+ errors = self.__errors.attr.get(session)
+
+ self.do_validate(session, errors)
+
+ return errors
+
+ def do_validate(self, session, errors):
+ pass
+
+ def render_errors(self, session, object):
+ if self.__errors.attr.get(session):
+ return self.__errors.render(session, object)
+
+class FormFieldErrors(ItemSet):
+ def __init__(self, app, name):
+ super(FormFieldErrors, self).__init__(app, name)
+
+ self.attr = self.Errors(app, "attr")
+ self.add_attribute(self.attr)
+
+ def get_items(self, session, object):
+ return self.attr.get(session)
+
+ def render_item_content(self, session, item):
+ return item.get_message(session)
+
+ class Errors(Attribute):
+ def get_default(self, session):
+ return list()
+
+class ScalarField(FormField):
+ def __init__(self, app, name, form):
+ super(ScalarField, self).__init__(app, name, form)
+
+ self.__input = None
+
+ def get_input(self):
+ return self.__input
+
+ def set_input(self, input):
+ assert isinstance(input, FormInput)
+
+ self.set_parameter(input.get_parameter())
+ self.__input = input
+ return input
+
+ def render_content(self, session, object):
+ return self.__input.render(session, object)
+
+class StringField(ScalarField):
+ def __init__(self, app, name, form):
+ super(StringField, self).__init__(app, name, form)
+
+ input = TextInput(app, "input", form)
+ self.add_child(input)
+ self.set_input(input)
+
+class IntegerField(ScalarField):
+ def __init__(self, app, name, form):
+ super(IntegerInputField, self).__init__(app, name, form)
+
+ input = Integer(app, "input", form)
+ self.add_child(input)
+ self.set_input(input)
+
+class RadioField(FormField):
+ def __init__(self, app, name, form):
+ super(RadioField, self).__init__(app, name, form)
+
+ self.options = list()
+
+ def add_option(self, option):
+ assert isinstance(option, RadioFieldOption)
+
+ option.set_parameter(self.get_parameter())
+ self.options.append(option)
+ self.add_child(option)
+
+ def render_content(self, session, object):
+ writer = Writer()
+
+ for option in self.options:
+ writer.write(option.render(session, object))
+
+ return writer.to_string()
+
+class RadioFieldOption(RadioInput):
+ pass
+
+class ButtonForm(Form):
+ def __init__(self, app, name):
+ super(ButtonForm. self).__init__(app, name)
+
+ self.buttons = list()
+
+ def add_button(self, button):
+ assert type(button) is FormButton
+
+ self.buttons.append(button)
+ self.add_child(button)
+
+ def render_buttons(self, session, object):
+ writer = Writer()
+
+ for button in self.buttons:
+ writer.write(button.render(session, object))
+
+ return writer.to_string()
+
+class FieldForm(Form, FieldSet):
+ def __init__(self, app, name):
+ super(FieldForm, self).__init__(app, name)
+
+ def validate(self, session):
+ errors = list()
+
+ for field in self.fields:
+ errors.extend(field.validate(session))
+
+ return errors
Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/wooly/forms.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -2,7 +2,6 @@
<button class="{class}" id="{id}" type="submit" name="{name}" value="{value}" tabindex="{tab_index}" {disabled_attr}>{content}</button>
[TextInput.html]
-{errors}
<input type="text" name="{name}" value="{value}" tabindex="{tab_index}" {disabled_attr} size="{size}"/>
[CheckboxInput.html]
@@ -12,22 +11,67 @@
<input type="radio" name="{name}" value="{value}" tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
[CheckboxInputSet.html]
-{errors}{items}
+{items}
[CheckboxInputSet.item_html]
<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
{item_content}
[RadioInputSet.html]
-{errors}{items}
+{items}
[RadioInputSet.item_html]
<input type="radio" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr} {disabled_attr}/>
{item_content}
[OptionInputSet.html]
-{errors}
<select name="{name}" tabindex="{tab_index}" {disabled_attr}>{items}</select>
[OptionInputSet.item_html]
<option value="{item_value}" {item_selected_attr}>{item_content}</option>
+
+[FieldSet.html]
+<div class="fieldset">
+ <div class="title">{title}</div>
+ <div class="fields">{fields}</div>
+</div>
+
+[FormField.css]
+div.field {
+ padding: 0;
+ margin: 0;
+}
+
+div.field div.title {
+ font-weight: bold;
+ margin: 0 0 1em 0;
+}
+
+div.field div.content {
+ margin: 0 0 1em 1em;
+}
+
+[FormField.html]
+<div class="field">
+ <div class="title">{title}</div>
+ {errors}
+ <div class="content">{content}</div>
+</div>
+
+[FormFieldErrors.html]
+<ul class="errors">{items}</ul>
+
+[FormFieldErrors.item_html]
+<li>{item_content}</li>
+
+[RadioFieldOption.html]
+<div>
+ <input type="radio" name="{name}" value="{value}"
+ tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
+ {title}
+</div>
+
+[FieldForm.html]
+<form id="{id}">
+ {fields}
+</form>
Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/cumin/python/wooly/server.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -32,11 +32,6 @@
self.__server.stop()
def service(self, env, respond):
- if False and env["PATH_INFO"].endswith(".html"):
- print "------------------------------------"
- for key in sorted(env):
- print key, env[key]
-
session = Session(self.app)
session.unmarshal_page(env["PATH_INFO"])
session.unmarshal_url_vars(env["QUERY_STRING"])
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/misc/boneyard.py 2008-03-07 04:59:23 UTC (rev 1769)
@@ -138,3 +138,111 @@
def render_none(self, session, model):
return none()
+
+class BrokerConfigPropertyForm(CuminForm, Frame):
+ def __init__(self, app, name):
+ super(BrokerConfigPropertyForm, self).__init__(app, name)
+
+ self.param = ConfigPropertyParameter(app, "param")
+ self.add_parameter(self.param)
+
+ self.source = Parameter(app, "source")
+ self.source.set_default("local")
+ self.add_parameter(self.source)
+
+ self.profile = RadioInput(app, "profile", self)
+ self.profile.set_parameter(self.source)
+ self.profile.set_value("profile")
+ self.add_child(self.profile)
+
+ self.pvalue = TextInput(app, "profile_value", self)
+ self.pvalue.set_disabled(True)
+ self.add_child(self.pvalue)
+
+ self.broker = RadioInput(app, "broker", self)
+ self.broker.set_parameter(self.source)
+ self.broker.set_value("broker")
+ self.add_child(self.broker)
+
+ self.svalue = TextInput(app, "broker_value", self)
+ self.svalue.set_disabled(True)
+ self.add_child(self.svalue)
+
+ self.local = RadioInput(app, "local", self)
+ self.local.set_parameter(self.source)
+ self.local.set_value("local")
+ self.add_child(self.local)
+
+ self.lvalue = TextInput(app, "local_value", self)
+ self.add_child(self.lvalue)
+
+ def get_title(self, session, prop):
+ return "Edit Property '%s'" % prop.name
+
+ def get_object(self, session, object):
+ return self.param.get(session)
+
+ def set_config_property(self, session, prop):
+ return self.param.set(session, prop)
+
+ def process_cancel(self, session, prop):
+ branch = session.branch()
+ self.page().show_broker(branch, prop.get_broker()).show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session, prop):
+ source = self.source.get(session)
+
+ if source == "profile":
+ prop.value = get_profile_value(prop)
+ elif source == "broker":
+ prop.value = prop.broker_value
+ elif source == "local":
+ prop.value = self.lvalue.get(session)
+ else:
+ raise Exception()
+
+ self.process_cancel(session, prop)
+
+ def process_display(self, session, prop):
+ self.pvalue.set(session, get_profile_value(prop))
+ self.svalue.set(session, prop.broker_value)
+ self.lvalue.set(session, prop.value)
+
+class BrokerConfigTab(ConfigPropertySet):
+ def get_title(self, session, broker):
+ return "Configuration"
+
+ def do_get_items(self, session, broker):
+ return broker.properties
+
+ def maybe_highlight(self, value, comparedto):
+ if str(value) != str(comparedto):
+ value = "<span class=\"BrokerConfigTab diff\">%s</span>" \
+ % value
+
+ return value
+
+ def render_item_broker_value(self, session, prop):
+ return self.maybe_highlight(prop.broker_value, prop.value)
+
+ def render_item_profile_value(self, session, prop):
+ value = get_profile_value(prop)
+ return self.maybe_highlight(value, prop.value)
+
+ def render_item_edit_href(self, session, prop):
+ branch = session.branch()
+ frame = self.page().show_broker(branch, prop.get_broker())
+ frame.show_config_property(branch, prop)
+ return branch.marshal()
+
+def get_profile_value(prop):
+ profile = prop.get_broker().get_broker_profile()
+ value = None
+
+ if profile:
+ for p in profile.config_property_items():
+ if p.name == prop.name:
+ value = p.value
+
+ return value
Modified: mgmt/misc/boneyard.strings
===================================================================
--- mgmt/misc/boneyard.strings 2008-03-07 00:34:26 UTC (rev 1768)
+++ mgmt/misc/boneyard.strings 2008-03-07 04:59:23 UTC (rev 1769)
@@ -80,3 +80,84 @@
[ClusterBrowser.item_html]
<li>{item_link}</li>
+
+[BrokerConfigTab.css]
+.BrokerConfigTab.diff {
+ background-color: #ff9;
+}
+
+[BrokerSetGroupInput.html]
+<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="getElementById('{submit_id}').click()">
+ <option value="">Choose Group...</option>
+ {items}
+</select>
+
+[BrokerConfigTab.html]
+<ul class="actions">
+ <li><a class="nav" href="{href}">Add Property</a></li>
+ <li><a href="{href}">Apply Configuration to Broker</a></li>
+</ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Name</th>
+ <th>Configured Value</th>
+ <th>Broker Value</th>
+ <th>Profile Value</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[BrokerConfigTab.item_html]
+<tr>
+ <td>{item_name}</td>
+ <td>{item_value}</td>
+ <td>{item_broker_value}</td>
+ <td>{item_profile_value}</td>
+ <td><a class="action" href="{item_edit_href}">Edit</a></td>
+</tr>
+
+[BrokerConfigPropertyForm.css]
+.BrokerConfigPropertyForm div.value {
+ margin: 1em 2em;
+}
+
+[BrokerConfigPropertyForm.html]
+<form id="{id}" class="BrokerConfigPropertyForm mform" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <span class="legend">Value</span>
+ <fieldset>
+ <div class="field">
+ {profile} Use the value from the broker profile
+ <div class="value">{profile_value}</div>
+ </div>
+ <div class="field">
+ {broker} Use the value currently set on the broker
+ <div class="value">{broker_value}</div>
+ </div>
+ <div class="field">
+ {local} Set a new value
+ <div class="value">{local_value}</div>
+ </div>
+ </fieldset>
+
+ {hidden_inputs}
+ </div>
+ <div class="foot">
+ <div style="float: left;"><button>Help</button></div>
+ {submit}
+ {cancel}
+ </div>
+</form>
+<script defer="defer">
+(function() {
+ var elem = wooly.doc().elembyid("{id}").node.elements[1];
+ elem.focus();
+ elem.select();
+}())
+</script>
16 years, 9 months
rhmessaging commits: r1768 - mgmt/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-06 19:34:26 -0500 (Thu, 06 Mar 2008)
New Revision: 1768
Modified:
mgmt/cumin/bin/cumin
Log:
Turn ssl off by default and provide a command line option to enable it
Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin 2008-03-06 21:57:28 UTC (rev 1767)
+++ mgmt/cumin/bin/cumin 2008-03-07 00:34:26 UTC (rev 1768)
@@ -12,11 +12,12 @@
--data URL Connect to database at URL
(default postgesql://cumin@localhost/cumin)
--port PORT Run web server on port PORT (default 80)
+ --ssl yes Serve pages using SSL
--debug Enable debugging"""
sys.exit(1)
-def do_main(home, data, spec, port, debug):
+def do_main(home, data, spec, port, ssl, debug):
app = Cumin(home, data, spec)
if debug:
@@ -35,14 +36,23 @@
host = socket.gethostname()
server = CuminServer(app, host, port)
- cpath = os.path.join(home, "etc", "cumin.crt")
- kpath = os.path.join(home, "etc", "cumin.key")
+ if ssl:
+ cpath = os.path.join(home, "etc", "cumin.crt")
+ kpath = os.path.join(home, "etc", "cumin.key")
- if os.path.isfile(cpath):
- server.set_ssl_cert_path(cpath)
+ if os.path.isfile(cpath):
+ server.set_ssl_cert_path(cpath)
+ else:
+ print "Error: SSL certificate file '%s' not found" % cpath
+ print "Files '%s' and '%s' are required for SSL" % (cpath, kpath)
+ sys.exit(1)
- if os.path.isfile(kpath):
- server.set_ssl_key_path(kpath)
+ if os.path.isfile(kpath):
+ server.set_ssl_key_path(kpath)
+ else:
+ print "Error: SSL key file '%s' not found" % kpath
+ print "Files '%s' and '%s' are required for SSL" % (cpath, kpath)
+ sys.exit(1)
try:
server.start()
@@ -63,6 +73,7 @@
config.add_param("data", "s", "postgresql://cumin@localhost/cumin")
config.add_param("spec", "s", spec)
config.add_param("port", "i", 80)
+ config.add_param("ssl", "b", False)
config.add_param("debug", "b", False)
config.load_file(os.path.join(home, "etc", "cumin.conf"))
@@ -75,9 +86,10 @@
data = config.get("data")
spec = config.get("spec")
port = config.get("port")
+ ssl = config.get("ssl")
debug = config.get("debug")
- do_main(home, data, spec, port, debug)
+ do_main(home, data, spec, port, ssl, debug)
if __name__ == "__main__":
try:
16 years, 9 months
rhmessaging commits: r1767 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-03-06 16:57:28 -0500 (Thu, 06 Mar 2008)
New Revision: 1767
Modified:
store/trunk/cpp/tests/clean.sh
Log:
Added executable property to clean script
Property changes on: store/trunk/cpp/tests/clean.sh
___________________________________________________________________
Name: svn:executable
+ *
16 years, 9 months
rhmessaging commits: r1766 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-03-06 16:35:41 -0500 (Thu, 06 Mar 2008)
New Revision: 1766
Added:
store/trunk/cpp/tests/clean.sh
Modified:
store/trunk/cpp/tests/Makefile.am
Log:
Additional clean script added to make sure no old data can hang the unit and system tests
Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am 2008-03-06 21:14:07 UTC (rev 1765)
+++ store/trunk/cpp/tests/Makefile.am 2008-03-06 21:35:41 UTC (rev 1766)
@@ -9,6 +9,7 @@
SUBDIRS = jrnl
TESTS = \
+ clean.sh \
SimpleTest \
OrderingTest \
TransactionalTest \
@@ -37,7 +38,7 @@
> $@-t
mv $@-t $@
-EXTRA_DIST = system_test.sh persistence.py MessageUtils.h setup .vg-supp
+EXTRA_DIST = clean.sh system_test.sh persistence.py MessageUtils.h setup .vg-supp
TESTS_ENVIRONMENT = \
QPID_DIR=$(QPID_DIR) \
Added: store/trunk/cpp/tests/clean.sh
===================================================================
--- store/trunk/cpp/tests/clean.sh (rev 0)
+++ store/trunk/cpp/tests/clean.sh 2008-03-06 21:35:41 UTC (rev 1766)
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Red Hat Software
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+# This scrip cleans up any previous database and journal files, and should
+# be run prior to the store system tests, as these are prone to crashing or
+# hanging under some circumstances if the database is old or inconsistent.
+
+WORKING_DIR=/tmp
+
+if [ -d ${WORKING_DIR}/rhm ]; then
+ rm -rf ${WORKING_DIR}/rhm/*
+fi
16 years, 9 months