rhmessaging commits: r1028 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 15:56:46 -0400 (Fri, 12 Oct 2007)
New Revision: 1028
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Improves the styling of group types a bit and adds a remove-group
link.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-12 19:42:02 UTC (rev 1027)
+++ mgmt/cumin/python/cumin/server.py 2007-10-12 19:56:46 UTC (rev 1028)
@@ -155,6 +155,13 @@
self.param.set(branch, None)
return link(branch.marshal(), "All Servers", class_)
+ def render_remove_group_link(self, session, model):
+ group = self.param.get(session)
+
+ if group:
+ branch = session.branch()
+ return "<li>%s</li>" % link(branch.marshal(), "Remove This Group")
+
class BrowserGroups(Widget):
def __init__(self, app, name):
super(ServerBrowser.BrowserGroups, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-12 19:42:02 UTC (rev 1027)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-12 19:56:46 UTC (rev 1028)
@@ -80,8 +80,12 @@
}
.ServerBrowser.groups h2 {
- color: #afbf27;
+ color: #564979;
font-weight: bold;
+ font-size: 0.9em;
+ border-bottom: 1px dotted #ddd;
+ width: 80%;
+ margin: 0 0 0.5em 0;
}
.ServerBrowser.servers {
@@ -97,6 +101,7 @@
<ul class="actions">
<li><a href="">Add Server</a></li>
<li><a href="">Shutdown Servers</a></li>
+ {remove_group_link}
</ul>
{servers}
17 years, 2 months
rhmessaging commits: r1027 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 15:42:02 -0400 (Fri, 12 Oct 2007)
New Revision: 1027
Added:
mgmt/cumin/python/cumin/util.py
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Makes the server browser view (with group dimensions) the default
server view. Adds a utility function for sorting objects by their
attributes.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-12 18:13:33 UTC (rev 1026)
+++ mgmt/cumin/python/cumin/page.py 2007-10-12 19:42:02 UTC (rev 1027)
@@ -7,6 +7,7 @@
from server import *
from cluster import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -123,9 +124,6 @@
self.server = ServerFrame(app, "server")
self.add_child(self.server)
- self.sgroup = ServerGroupFrame(app, "sgroup")
- self.add_child(self.sgroup)
-
self.cluster = ClusterFrame(app, "cluster")
self.add_child(self.cluster)
@@ -143,10 +141,6 @@
self.server.set_server(session, server)
return self.show_mode(session, self.server)
- def show_server_group(self, session, sgroup):
- self.sgroup.set_server_group(session, sgroup)
- return self.show_mode(session, self.sgroup)
-
def show_cluster(self, session, cluster):
self.cluster.set_cluster(session, cluster)
return self.show_mode(session, self.cluster)
@@ -167,19 +161,9 @@
def render_title(self, session, model):
return "Red Hat Messaging"
- class ServerTab(TabSet):
- def __init__(self, app, name):
- super(MainView.ServerTab, self).__init__(app, name)
+ class ServerTab(ServerBrowser):
+ pass
- self.groups = ServerGroupTree(app, "groups")
- self.add_child(self.groups)
-
- self.servers = ServerBrowser(app, "servers")
- self.add_child(self.servers)
-
- def render_title(self, session, model):
- return "Servers (%i)" % len(model.get_servers())
-
class ClusterTab(Widget):
def __init__(self, app, name):
super(MainView.ClusterTab, self).__init__(app, name)
@@ -189,65 +173,3 @@
def render_title(self, session, model):
return self.clusters.render_title(session, model)
-
-class ServerBrowser(Widget):
- def __init__(self, app, name):
- super(ServerBrowser, self).__init__(app, name)
-
- self.param = ServerGroupParameter(app, "param")
- self.add_parameter(self.param)
-
- self.groups = self.BrowserGroups(app, "groups")
- self.add_child(self.groups)
-
- self.servers = self.BrowserServers(app, "servers")
- self.add_child(self.servers)
-
- def render_title(self, session, model):
- return "Servers (%i)" % len(model.get_servers())
-
- def render_show_all_link(self, session, model):
- class_ = self.param.get(session) is None and "selected"
-
- branch = session.branch()
- self.param.set(branch, None)
- return link(branch.marshal(), "Show All", class_)
-
- class BrowserGroups(ItemSet):
- def __init__(self, app, name):
- super(ServerBrowser.BrowserGroups, self).__init__(app, name)
-
- def get_items(self, session, model):
- return sorted(model.get_server_groups(), cmp, lambda x: x.name)
-
- def render_items(self, session, model):
- writer = Writer()
-
- last_type = None
- groups = self.get_items(session, model)
-
- if groups:
- for group in groups:
- if group.get_type() is not last_type:
- pass
-
- self.item_tmpl.render(session, group, writer)
-
- return writer.to_string()
-
- def render_item_content(self, session, group):
- branch = session.branch()
- self.parent.param.set(branch, group)
-
- selected = self.parent.param.get(session) is group
-
- return mlink(branch.marshal(), "ServerGroup", group.name, selected)
-
- class BrowserServers(ServerSet):
- def get_items(self, session, model):
- group = self.parent.param.get(session)
-
- if group:
- return sorted(group.server_items(), cmp, lambda x: x.name)
- else:
- return sorted(model.get_servers(), cmp, lambda x: x.name)
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-12 18:13:33 UTC (rev 1026)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-12 19:42:02 UTC (rev 1027)
@@ -390,33 +390,9 @@
{tabs}
</div>
-[ServerTab.html]
-<ul class="radiotabs tabs">{tabs}</ul>
-<div class="mode">{mode}</div>
-
[ClusterTab.html]
<ul class="actions">
<li><a href="">Add Cluster</a></li>
</ul>
{clusters}
-
-[ServerBrowser.css]
-.ServerBrowser.groups {
- float: left;
- width: 20%;
-}
-
-.ServerBrowser.servers {
- width: 80%;
-}
-
-[ServerBrowser.html]
-<div class="ServerBrowser groups">
- {show_all_link}
-
- <br/><br/>
-
- {groups}
-</div>
-<div class="ServerBrowser servers">{servers}</div>
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-12 18:13:33 UTC (rev 1026)
+++ mgmt/cumin/python/cumin/server.py 2007-10-12 19:42:02 UTC (rev 1027)
@@ -3,6 +3,7 @@
from virtualhost import *
from widgets import *
+from util import *
strings = StringCatalog(__file__)
@@ -86,9 +87,6 @@
def __init__(self, app, name):
super(ServerView, self).__init__(app, name)
- self.groups = self.ServerServerGroups(app, "groups")
- self.add_child(self.groups)
-
self.tabs = TabSet(app, "tabs")
self.add_child(self.tabs)
@@ -115,10 +113,6 @@
return html
- class ServerServerGroups(ServerGroupSet):
- def get_items(self, session, server):
- return sorted(server.server_group_items(), cmp, lambda x: x.name)
-
class VirtualHostTab(VirtualHostSet):
def render_title(self, session, server):
return "Functional Hosts (%i)" % len(server.virtual_host_items())
@@ -138,30 +132,75 @@
def render_title(self, session, server):
return "Log Messages"
-class ServerGroupTree(ItemTree):
- def render_title(self, session, model):
- return "Groups (%i)" % len(model.get_server_groups())
+class ServerBrowser(Widget):
+ def __init__(self, app, name):
+ super(ServerBrowser, self).__init__(app, name)
+
+ self.param = ServerGroupParameter(app, "param")
+ self.add_parameter(self.param)
- def get_items(self, session, model):
- roots = list()
+ self.groups = self.BrowserGroups(app, "groups")
+ self.add_child(self.groups)
- for group in model.get_server_groups():
- if not group.parent_items():
- roots.append(group)
+ self.servers = self.BrowserServers(app, "servers")
+ self.add_child(self.servers)
- return roots
+ def render_title(self, session, model):
+ return "Servers (%i)" % len(model.get_servers())
- def get_child_items(self, session, group):
- return group.child_items()
+ def render_all_servers_link(self, session, model):
+ class_ = self.param.get(session) is None and "selected"
- def render_item_href(self, session, group):
branch = session.branch()
- self.page().show_server_group(branch, group).show_view(branch)
- return branch.marshal()
+ self.param.set(branch, None)
+ return link(branch.marshal(), "All Servers", class_)
- def render_item_name(self, session, group):
- return group.name
+ class BrowserGroups(Widget):
+ def __init__(self, app, name):
+ super(ServerBrowser.BrowserGroups, self).__init__(app, name)
+ self.type_tmpl = Template(self, "type_html")
+ self.group_tmpl = Template(self, "group_html")
+
+ def get_items(self, session, model):
+ return sorted(model.get_server_group_types(), cmp, lambda x: x.name)
+
+ def render_types(self, session, model):
+ writer = Writer()
+
+ for type in self.get_items(session, model):
+ self.type_tmpl.render(session, type, writer)
+
+ return writer.to_string()
+
+ def render_type_name(self, session, type):
+ return type.name
+
+ def render_groups(self, session, type):
+ writer = Writer()
+
+ for group in csorted(type.server_group_items()):
+ self.group_tmpl.render(session, group, writer)
+
+ return writer.to_string()
+
+ def render_group_link(self, session, group):
+ branch = session.branch()
+ self.parent.param.set(branch, group)
+
+ selected = self.parent.param.get(session) is group
+
+ return mlink(branch.marshal(), "ServerGroup", group.name, selected)
+
+ class BrowserServers(ServerSet):
+ def get_items(self, session, model):
+ group = self.parent.param.get(session)
+
+ if group:
+ return sorted(group.server_items(), cmp, lambda x: x.name)
+ else:
+ return sorted(model.get_servers(), cmp, lambda x: x.name)
+
class ServerGroupParameter(Parameter):
def do_unmarshal(self, string):
return self.app.model.get_server_group(int(string))
@@ -186,9 +225,6 @@
def show_view(self, session):
self.show_mode(session, self.view)
- def render_title(self, session, group):
- return "Server Group '%s'" % group.name
-
class ServerGroupView(Widget):
def __init__(self, app, name):
super(ServerGroupView, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-12 18:13:33 UTC (rev 1026)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-12 19:42:02 UTC (rev 1027)
@@ -28,7 +28,6 @@
<dl class="properties">
<dt>Name</dt><dd>{name}</dd>
<dt>Cluster</dt><dd>{cluster_link}</dd>
- <dt>Server Groups</dt><dd>{groups}</dd>
</dl>
<ul class="actions">
@@ -66,36 +65,53 @@
}
</pre>
-[ServerGroupTree.css]
-ul.ServerGroupTree, ul.ServerGroupTree ul {
- list-style: square;
- color: #ccc;
- padding: 0 0 0 2em;
+[ServerBrowser.css]
+.ServerBrowser.groups {
+ float: left;
+ width: 20%;
}
-ul.ServerGroupTree {
- padding: 0 0 0 1em;
+.ServerBrowser.groups a.selected {
+ font-weight: bold;
}
-[ServerGroupTree.html]
-<ul class="ServerGroupTree">{items}</ul>
+.ServerBrowser.groups ul {
+ margin: 0 0 1em 0;
+}
-[ServerGroupTree.item_html]
-<li><a href="{item_href}">{item_name}</a></li>
-<ul>{child_items}</ul>
+.ServerBrowser.groups h2 {
+ color: #afbf27;
+ font-weight: bold;
+}
-[ServerGroupView.html]
-<div class="oblock">
- <h1>{title}</h1>
+.ServerBrowser.servers {
+ width: 80%;
+}
- <dl class="properties">
- <dt>Parent Groups</dt><dd>{parent_groups}</dd>
- </dl>
-
+[ServerBrowser.html]
+<div class="ServerBrowser groups">
+ <ul><li>{all_servers_link}</li></ul>
+ {groups}
+</div>
+<div class="ServerBrowser servers">
<ul class="actions">
<li><a href="">Add Server</a></li>
- <li><a href="">Shutdown Servers in This Group</a></li>
+ <li><a href="">Shutdown Servers</a></li>
</ul>
- {tabs}
+ {servers}
</div>
+
+[BrowserGroups.html]
+{types}
+
+<ul class="actions">
+ <li><a href="">Add Group</a>
+</ul>
+
+[BrowserGroups.type_html]
+<h2>{type_name}</h2>
+<ul>{groups}</ul>
+
+[BrowserGroups.group_html]
+<li>{group_link}</li>
Added: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py (rev 0)
+++ mgmt/cumin/python/cumin/util.py 2007-10-12 19:42:02 UTC (rev 1027)
@@ -0,0 +1,2 @@
+def csorted(seq, attr="name"):
+ return sorted(seq, cmp, lambda x: getattr(x, attr))
17 years, 2 months
rhmessaging commits: r1026 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-10-12 14:13:33 -0400 (Fri, 12 Oct 2007)
New Revision: 1026
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
Integration adjustments
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-12 17:42:24 UTC (rev 1025)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-12 18:13:33 UTC (rev 1026)
@@ -511,7 +511,7 @@
_emap.insert_fid(itr->_rid, itr->_fid);
else // txn dequeue
{
- u_int16_t fid = _emap.get_remove_fid(h._rid);
+ u_int16_t fid = _emap.get_remove_fid(h._rid, true);
_wrfc.decr_enqcnt(fid);
}
}
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 17:42:24 UTC (rev 1025)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 18:13:33 UTC (rev 1026)
@@ -262,8 +262,10 @@
dtokp->set_dblocks_written(0); // Reset dblks_written from previous op
}
+ // TODO: Tidy this up!
u_int64_t rid = initialize_rid(cont, dtokp);
- _deq_rec.reset(rid, dtokp->rid(), xid_ptr, xid_len);
+ u_int64_t dequeue_rid = dtokp->getSourceMessage() ? dtokp->dequeue_rid() : dtokp->rid();
+ _deq_rec.reset(rid, dequeue_rid, xid_ptr, xid_len);
if (!cont)
{
if (xid_len)
17 years, 2 months
rhmessaging commits: r1025 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: cctrieloff
Date: 2007-10-12 13:42:24 -0400 (Fri, 12 Oct 2007)
New Revision: 1025
Modified:
store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
logic correction
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 16:24:51 UTC (rev 1024)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 17:42:24 UTC (rev 1025)
@@ -855,7 +855,7 @@
return false;
// Check for outstanding commit/aborts
std::set<std::string>::iterator it = _txn_pending_set.find(xid);
- return it != _txn_pending_set.end();
+ return it == _txn_pending_set.end();
}
void
17 years, 2 months
rhmessaging commits: r1024 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 12:24:51 -0400 (Fri, 12 Oct 2007)
New Revision: 1024
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/wooly/__init__.py
Log:
Moves frame handling to wooly.Page and off of cumin.CuminPage
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-12 15:53:43 UTC (rev 1023)
+++ mgmt/cumin/python/cumin/page.py 2007-10-12 16:24:51 UTC (rev 1024)
@@ -33,21 +33,6 @@
def get_default(self, session):
return list()
- class FrameParameter(Parameter):
- def do_marshal(self, frame):
- return frame.path()
-
- def do_unmarshal(self, path):
- return self.app.get_widget(path)
-
- def set_frame(self, session, frame):
- self.frame.set(session, frame)
-
- return frame
-
- def get_frame(self, session):
- return self.frame.get(session)
-
def set_modal(self, session, modal):
self.modal.set(session, modal)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-12 15:53:43 UTC (rev 1023)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-12 16:24:51 UTC (rev 1024)
@@ -160,6 +160,84 @@
def __str__(self):
return "%s '%s'" % (self.__class__.__name__, self.path())
+class Attribute(object):
+ def __init__(self, app, name):
+ self.app = app
+ self.name = name
+ self.widget = None
+ self.default = None
+ self.is_required = True
+
+ def path(self):
+ if not self.widget:
+ raise Exception("Parameter has no widget")
+
+ if not self.widget.parent:
+ return self.name
+ else:
+ path = self.widget.path() + "." + self.name
+
+ return path
+
+ def set_required(self, is_required):
+ self.is_required = is_required
+
+ def validate(self, session):
+ value = self.get(session)
+
+ if value == None and self.is_required:
+ raise Exception("%s not set" % str(self))
+
+ def get(self, session):
+ value = session.get(self.path())
+
+ # Use strict test because empty collections are False
+ if value == None:
+ default = self.get_default(session)
+
+ if default != None:
+ value = self.set(session, default)
+
+ return value
+
+ def add(self, session, value):
+ self.set(session, value)
+
+ def set(self, session, value):
+ return session.set(self.path(), value)
+
+ def get_default(self, session):
+ return self.default
+
+ def set_default(self, default):
+ self.default = default
+
+ def __str__(self):
+ return "%s '%s'" % (self.__class__.__name__, self.path())
+
+class Parameter(Attribute):
+ def __init__(self, app, name):
+ super(Parameter, self).__init__(app, name)
+
+ app.add_parameter(self)
+
+ def marshal(self, object):
+ if object == None:
+ string = ""
+ else:
+ string = self.do_marshal(object)
+
+ return string
+
+ def do_marshal(self, object):
+ return str(object)
+
+ def unmarshal(self, string):
+ return self.do_unmarshal(string)
+
+ def do_unmarshal(self, string):
+ return string
+
class Page(Widget):
xml_content_type = "text/xml"
html_content_type = "text/html"
@@ -170,6 +248,9 @@
def __init__(self, app, name):
super(Page, self).__init__(app, name)
+ self.frame = self.FrameParameter(app, "frame")
+ self.add_parameter(self.frame)
+
def get_last_modified(self, session):
return datetime.utcnow()
@@ -179,6 +260,21 @@
def save_session(self, session):
pass
+ def set_frame(self, session, frame):
+ self.frame.set(session, frame)
+
+ return frame
+
+ def get_frame(self, session):
+ return self.frame.get(session)
+
+ class FrameParameter(Parameter):
+ def do_marshal(self, frame):
+ return frame.path()
+
+ def do_unmarshal(self, path):
+ return self.app.get_widget(path)
+
class Frame(Widget):
def __init__(self, app, name):
super(Frame, self).__init__(app, name)
@@ -269,84 +365,6 @@
def clear_caches(self):
self.cached_css = None
-class Attribute(object):
- def __init__(self, app, name):
- self.app = app
- self.name = name
- self.widget = None
- self.default = None
- self.is_required = True
-
- def path(self):
- if not self.widget:
- raise Exception("Parameter has no widget")
-
- if not self.widget.parent:
- return self.name
- else:
- path = self.widget.path() + "." + self.name
-
- return path
-
- def set_required(self, is_required):
- self.is_required = is_required
-
- def validate(self, session):
- value = self.get(session)
-
- if value == None and self.is_required:
- raise Exception("%s not set" % str(self))
-
- def get(self, session):
- value = session.get(self.path())
-
- # Use strict test because empty collections are False
- if value == None:
- default = self.get_default(session)
-
- if default != None:
- value = self.set(session, default)
-
- return value
-
- def add(self, session, value):
- self.set(session, value)
-
- def set(self, session, value):
- return session.set(self.path(), value)
-
- def get_default(self, session):
- return self.default
-
- def set_default(self, default):
- self.default = default
-
- def __str__(self):
- return "%s '%s'" % (self.__class__.__name__, self.path())
-
-class Parameter(Attribute):
- def __init__(self, app, name):
- super(Parameter, self).__init__(app, name)
-
- app.add_parameter(self)
-
- def marshal(self, object):
- if object == None:
- string = ""
- else:
- string = self.do_marshal(object)
-
- return string
-
- def do_marshal(self, object):
- return str(object)
-
- def unmarshal(self, string):
- return self.do_unmarshal(string)
-
- def do_unmarshal(self, string):
- return string
-
class Session(object):
def __init__(self, app, trunk=None):
self.app = app
17 years, 2 months
rhmessaging commits: r1023 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 11:53:43 -0400 (Fri, 12 Oct 2007)
New Revision: 1023
Modified:
mgmt/cumin/python/wooly/widgets.py
Log:
Removes an extraneous println.
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-10-12 15:44:10 UTC (rev 1022)
+++ mgmt/cumin/python/wooly/widgets.py 2007-10-12 15:53:43 UTC (rev 1023)
@@ -138,8 +138,6 @@
items = self.get_items(session, object)
writer = Writer()
- print items
-
for item in items:
self.item_tmpl.render(session, item, writer)
17 years, 2 months
rhmessaging commits: r1022 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 11:44:10 -0400 (Fri, 12 Oct 2007)
New Revision: 1022
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
Log:
Introduces a frame param on cuminpage. This is used to control when
state is preserved and when it is discarded. As it's currently
configured, the state you used to drill down to a specific object is
saved so that when you return tabs, etc., are as you left them.
Also removes render_hrefs from specific cumin frames and uses the
definition on CuminFrame.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -71,11 +71,6 @@
self.vhost.set_virtual_host(session, vhost)
return self.show_mode(session, self.vhost)
- def render_href(self, session, cluster):
- branch = session.branch()
- self.page().show_cluster(branch, cluster).show_view(branch)
- return branch.marshal()
-
def render_title(self, session, cluster):
return "Cluster '%s'" % cluster.name
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/exchange.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -72,11 +72,6 @@
def show_view(self, session):
return self.show_mode(session, self.view)
- def render_href(self, session, exchange):
- branch = session.branch()
- self.show_view(branch)
- return branch.marshal()
-
def render_title(self, session, exchange):
return "Exchange '%s'" % exchange.name
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/page.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -17,6 +17,9 @@
self.frames = self.FramesAttribute(app, "frames")
self.add_attribute(self.frames)
+ self.frame = self.FrameParameter(app, "frame")
+ self.add_parameter(self.frame)
+
self.modal = Attribute(app, "modal")
self.add_attribute(self.modal)
@@ -30,6 +33,21 @@
def get_default(self, session):
return list()
+ class FrameParameter(Parameter):
+ def do_marshal(self, frame):
+ return frame.path()
+
+ def do_unmarshal(self, path):
+ return self.app.get_widget(path)
+
+ def set_frame(self, session, frame):
+ self.frame.set(session, frame)
+
+ return frame
+
+ def get_frame(self, session):
+ return self.frame.get(session)
+
def set_modal(self, session, modal):
self.modal.set(session, modal)
@@ -45,13 +63,15 @@
else:
frame = self.main.show_server(session, server)
- return frame
+ return self.set_frame(session, frame)
def show_server_group(self, session, sgroup):
- return self.main.show_server_group(session, sgroup)
+ frame = self.main.show_server_group(session, sgroup)
+ return self.set_frame(session, frame)
def show_cluster(self, session, cluster):
- return self.main.show_cluster(session, cluster)
+ frame = self.main.show_cluster(session, cluster)
+ return self.set_frame(session, frame)
def show_virtual_host(self, session, vhost):
server = vhost.get_server()
@@ -64,15 +84,18 @@
else:
frame = self.main
- return frame.show_virtual_host(session, vhost)
+ frame = frame.show_virtual_host(session, vhost)
+ return self.set_frame(session, frame)
def show_queue(self, session, queue):
frame = self.show_virtual_host(session, queue.virtual_host)
- return frame.show_queue(session, queue)
+ frame = frame.show_queue(session, queue)
+ return self.set_frame(session, frame)
def show_exchange(self, session, exchange):
frame = self.show_virtual_host(session, exchange.virtual_host)
- return frame.show_exchange(session, exchange)
+ frame = frame.show_exchange(session, exchange)
+ return self.set_frame(session, frame)
def render_title(self, session, object):
return "Cumin"
@@ -143,11 +166,6 @@
self.cluster.set_cluster(session, cluster)
return self.show_mode(session, self.cluster)
- def render_href(self, session, model):
- branch = session.branch()
- self.show_view(branch)
- return branch.marshal()
-
def render_title(self, session, model):
return "<img src=\"resource?name=logo.png\"/>"
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -75,11 +75,6 @@
def show_view(self, session):
return self.show_mode(session, self.view)
- def render_href(self, session, queue):
- branch = session.branch()
- self.show_view(branch)
- return branch.marshal()
-
def render_title(self, session, queue):
return "Queue '%s'" % queue.name
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/server.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -69,11 +69,6 @@
vhost = self.show_virtual_host(session, exchange.virtual_host)
return vhost.show_exchange(session, exchange)
- def render_href(self, session, server):
- branch = session.branch()
- self.show_mode(branch, self.view)
- return branch.marshal()
-
def render_title(self, session, server):
return "Server '%s'" % server.name
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/virtualhost.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -60,11 +60,6 @@
return self.show_mode(session, self.exchange)
- def render_href(self, session, vhost):
- branch = session.branch()
- self.show_view(branch)
- return branch.marshal()
-
class VirtualHostFrame(BaseVirtualHostFrame):
def __init__(self, app, name):
super(VirtualHostFrame, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -15,11 +15,26 @@
return "<span class=\"none\">None</span>"
class CuminFrame(Frame, ModeSet):
+ def save_parameters(self, session):
+ frame = self.page().get_frame(session)
+
+ if not frame or self is frame or self in frame.ancestors():
+ super(CuminFrame, self).save_parameters(session)
+
def do_process(self, session, object):
self.page().get_frames(session).append(self)
super(CuminFrame, self).do_process(session, object)
+ def show_view(self, session):
+ pass
+
+ def render_href(self, session, vhost):
+ branch = session.branch()
+ self.page().set_frame(branch, self)
+ self.show_view(branch)
+ return branch.marshal()
+
class CuminForm(Form):
def __init__(self, app, name):
super(CuminForm, self).__init__(app, name)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-12 15:08:10 UTC (rev 1021)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-12 15:44:10 UTC (rev 1022)
@@ -19,6 +19,7 @@
self.parameters = list()
self.template = Template(self, "html")
+ self.cached_ancestors = None
self.cached_path = None
self.cached_page = None
self.child_index = None
@@ -27,6 +28,17 @@
self.strings = None
+ def ancestors(self):
+ if not self.cached_ancestors:
+ if not self.parent:
+ self.cached_ancestors = tuple()
+ else:
+ ancs = list(self.parent.ancestors())
+ ancs.append(self)
+ self.cached_ancestors = tuple(ancs)
+
+ return self.cached_ancestors
+
def path(self):
if not self.cached_path:
if not self.parent:
17 years, 2 months
rhmessaging commits: r1021 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-10-12 11:08:10 -0400 (Fri, 12 Oct 2007)
New Revision: 1021
Modified:
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
Log:
Corrected is_txn_synced() to take into account the commit/abort record as well as the enqueues and dequeues
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-12 14:07:24 UTC (rev 1020)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-10-12 15:08:10 UTC (rev 1021)
@@ -59,7 +59,7 @@
}
void
-enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid, bool locked) throw (jexception)
+enq_map::insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked) throw (jexception)
{
fid_lock_pair rec(fid, locked);
pthread_mutex_lock(&_mutex);
@@ -95,7 +95,7 @@
}
const u_int16_t
-enq_map::get_remove_fid(const u_int64_t rid, const bool tx_flag) throw (jexception)
+enq_map::get_remove_fid(const u_int64_t rid, const bool txn_flag) throw (jexception)
{
pthread_mutex_lock(&_mutex);
emap_itr itr = _map.find(rid);
@@ -106,7 +106,7 @@
ss << std::hex << "rid=0x" << rid;
throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "enq_map", "get_remove_fid");
}
- if (itr->second.second && !tx_flag) // locked
+ if (itr->second.second && !txn_flag) // locked, but not a commit/abort
{
pthread_mutex_unlock(&_mutex);
std::stringstream ss;
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-12 14:07:24 UTC (rev 1020)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-10-12 15:08:10 UTC (rev 1021)
@@ -72,9 +72,11 @@
~enq_map();
void insert_fid(const u_int64_t rid, const u_int16_t fid) throw (jexception);
- void insert_fid(const u_int64_t rid, const u_int16_t fid, bool locked) throw (jexception);
+ void insert_fid(const u_int64_t rid, const u_int16_t fid, const bool locked)
+ throw (jexception);
const u_int16_t get_fid(const u_int64_t rid) throw (jexception);
- const u_int16_t get_remove_fid(const u_int64_t rid, const bool tx_flag=false) throw (jexception);
+ const u_int16_t get_remove_fid(const u_int64_t rid, const bool txn_flag = false)
+ throw (jexception);
void lock(const u_int64_t rid) throw (jexception);
void unlock(const u_int64_t rid) throw (jexception);
const bool is_locked(const u_int64_t rid) throw (jexception);
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-12 14:07:24 UTC (rev 1020)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-12 15:08:10 UTC (rev 1021)
@@ -257,7 +257,7 @@
const bool
jcntl::is_txn_synced(const std::string& xid) throw (jexception)
{
- return _tmap.is_txn_synced(xid);
+ return _wmgr.is_txn_synced(xid);
}
const u_int32_t
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 14:07:24 UTC (rev 1020)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-12 15:08:10 UTC (rev 1021)
@@ -54,7 +54,8 @@
_enq_busy(false),
_deq_busy(false),
_abort_busy(false),
- _commit_busy(false)
+ _commit_busy(false),
+ _txn_pending_set()
{}
wmgr::wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc, std::deque<data_tok*>* const dtokl,
@@ -70,7 +71,8 @@
_enq_busy(false),
_deq_busy(false),
_abort_busy(false),
- _commit_busy(false)
+ _commit_busy(false),
+ _txn_pending_set()
{}
wmgr::~wmgr()
@@ -438,6 +440,13 @@
if (itr->_enq_flag)
_wrfc.decr_enqcnt(itr->_fid);
}
+ std::pair<std::set<std::string>::iterator, bool> res = _txn_pending_set.insert(xid);
+ if (!res.second)
+ {
+ std::stringstream ss;
+ ss << std::hex << "_txn_pending_set: xid=\"" << xid << "\"";
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "wmgr", "abort");
+ }
#endif
done = true;
@@ -573,6 +582,13 @@
_wrfc.decr_enqcnt(fid);
}
}
+ std::pair<std::set<std::string>::iterator, bool> res = _txn_pending_set.insert(xid);
+ if (!res.second)
+ {
+ std::stringstream ss;
+ ss << std::hex << "_txn_pending_set: xid=\"" << xid << "\"";
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, ss.str(), "wmgr", "commit");
+ }
#endif
done = true;
@@ -747,23 +763,44 @@
for (u_int32_t k=0; k<s; k++)
{
data_tok* dtp = pcbp->_pdtokl->at(k);
+ std::set<std::string>::iterator it;
switch (dtp->wstate())
{
case data_tok::ENQ_SUBM:
assert(dtp->wstate() == data_tok::ENQ_SUBM);
dtp->set_wstate(data_tok::ENQ);
+ if (dtp->has_xid())
+ _tmap.set_aio_compl(dtp->xid(), dtp->rid());
break;
case data_tok::DEQ_SUBM:
assert(dtp->wstate() == data_tok::DEQ_SUBM);
dtp->set_wstate(data_tok::DEQ);
+ if (dtp->has_xid())
+ _tmap.set_aio_compl(dtp->xid(), dtp->rid());
break;
case data_tok::ABORT_SUBM:
assert(dtp->wstate() == data_tok::ABORT_SUBM);
dtp->set_wstate(data_tok::ABORTED);
+ it = _txn_pending_set.find(dtp->xid());
+ if (it == _txn_pending_set.end())
+ {
+ std::stringstream ss;
+ ss << std::hex << "_txn_pending_set: abort xid=\"" << dtp->xid() << "\"";
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "wmgr", "get_events");
+ }
+ _txn_pending_set.erase(it);
break;
case data_tok::COMMIT_SUBM:
assert(dtp->wstate() == data_tok::COMMIT_SUBM);
dtp->set_wstate(data_tok::COMMITTED);
+ it = _txn_pending_set.find(dtp->xid());
+ if (it == _txn_pending_set.end())
+ {
+ std::stringstream ss;
+ ss << std::hex << "_txn_pending_set: commit xid=\"" << dtp->xid() << "\"";
+ throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str(), "wmgr", "get_events");
+ }
+ _txn_pending_set.erase(it);
break;
default:
std::stringstream ss;
@@ -771,8 +808,6 @@
throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, ss.str(), "wmgr",
"get_events");
}
- if (dtp->has_xid())
- _tmap.set_aio_compl(dtp->xid(), dtp->rid());
_dtokl->push_back(dtp);
}
tot_data_toks += s;
@@ -805,6 +840,24 @@
return tot_data_toks;
}
+const bool
+wmgr::is_txn_synced(const std::string& xid) throw (jexception)
+{
+ bool is_synced = true;
+ // Check for outstanding enqueues/dequeues
+ try { is_synced = _tmap.is_txn_synced(xid); }
+ catch (jexception e)
+ {
+ if (e.err_code() != jerrno::JERR_MAP_NOTFOUND)
+ throw e;
+ }
+ if (!is_synced)
+ return false;
+ // Check for outstanding commit/aborts
+ std::set<std::string>::iterator it = _txn_pending_set.find(xid);
+ return it != _txn_pending_set.end();
+}
+
void
wmgr::initialize() throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-12 14:07:24 UTC (rev 1020)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-12 15:08:10 UTC (rev 1021)
@@ -43,6 +43,7 @@
#include <jrnl/pmgr.hpp>
#include <jrnl/wrfc.hpp>
+#include <set>
namespace rhm
{
@@ -90,6 +91,7 @@
enq_rec _enq_rec; ///< Enqueue record used for encoding/decoding
deq_rec _deq_rec; ///< Dequeue record used for encoding/decoding
txn_rec _txn_rec; ///< Transaction record used for encoding/decoding
+ std::set<std::string> _txn_pending_set; ///< Set containing xids of pending commits/aborts
aio_cb _cb; ///< Callback function pointer for AIO events
public:
@@ -112,6 +114,7 @@
throw (jexception);
const iores flush();
const u_int32_t get_events(page_state state) throw (jexception);
+ const bool is_txn_synced(const std::string& xid) throw (jexception);
private:
void initialize() throw (jexception);
17 years, 2 months
rhmessaging commits: r1020 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 10:07:24 -0400 (Fri, 12 Oct 2007)
New Revision: 1020
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
Removes the save_parameters on Frame until I figure out the proper way
to do it.
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-12 14:06:33 UTC (rev 1019)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-12 14:07:24 UTC (rev 1020)
@@ -180,10 +180,6 @@
if self.object:
return self.object.get(session)
- def save_parameters(self, session):
- if self.get_object(session) != None:
- super(Frame, self).save_parameters(session)
-
def do_process(self, session, object):
new_object = self.get_object(session)
super(Frame, self).do_process(session, new_object)
17 years, 2 months
rhmessaging commits: r1019 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-12 10:06:33 -0400 (Fri, 12 Oct 2007)
New Revision: 1019
Modified:
mgmt/cumin/python/wooly/widgets.py
Log:
Moves the check and rendering for empty itemsets outside the
render_items call.
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-10-12 13:46:08 UTC (rev 1018)
+++ mgmt/cumin/python/wooly/widgets.py 2007-10-12 14:06:33 UTC (rev 1019)
@@ -124,21 +124,27 @@
def get_items(self, session, object):
return None
- def render_items(self, session, object):
+ def do_render(self, session, object):
items = self.get_items(session, object)
if items:
- writer = Writer()
-
- for item in items:
- self.item_tmpl.render(session, item, writer)
-
- html = writer.to_string()
+ html = super(ItemSet, self).do_render(session, object)
else:
html = self.render_none(session, object)
return html
+ def render_items(self, session, object):
+ items = self.get_items(session, object)
+ writer = Writer()
+
+ print items
+
+ for item in items:
+ self.item_tmpl.render(session, item, writer)
+
+ return writer.to_string()
+
def render_item_content(self, session, item):
return None
17 years, 2 months