rhmessaging commits: r2817 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-17 09:13:02 -0500 (Mon, 17 Nov 2008)
New Revision: 2817
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
Fix to allow 0 arguments to be passed in when there are no input arguments required.
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-11-17 03:28:49 UTC (rev 2816)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-11-17 14:13:02 UTC (rev 2817)
@@ -158,7 +158,8 @@
actualArgs = " actualArgs = list()\n"
for arg in elem.query["arg"]:
formalArgs += "%s, " % (arg["@name"])
- actualArgs += " actualArgs.append(%s)\n" % (arg["@name"])
+ actualArgs += " if %s:\n" % (arg["@name"])
+ actualArgs += " actualArgs.append(%s)\n" % (arg["@name"])
if (formalArgs != ", "):
formalArgs = formalArgs[:-2]
16 years, 1 month
rhmessaging commits: r2816 - mgmt/trunk/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 22:28:49 -0500 (Sun, 16 Nov 2008)
New Revision: 2816
Modified:
mgmt/trunk/cumin/Makefile
Log:
Use -f when creating the links, so that a re-install works
Modified: mgmt/trunk/cumin/Makefile
===================================================================
--- mgmt/trunk/cumin/Makefile 2008-11-16 16:24:12 UTC (rev 2815)
+++ mgmt/trunk/cumin/Makefile 2008-11-17 03:28:49 UTC (rev 2816)
@@ -21,8 +21,8 @@
install -pm 0644 LICENSE COPYING ${doc}
install -d ${share}/resources
install -pm 0644 resources/* ${share}/resources
- ln -s ../wooly/resources ${share}/resources-wooly
- ln -s ../mint/sql ${share}/sql
+ ln -sf ../wooly/resources ${share}/resources-wooly
+ ln -sf ../mint/sql ${share}/sql
install -d ${etc}
install -pm 0644 etc/* ${etc}
install -d ${log}
16 years, 1 month
rhmessaging commits: r2815 - mgmt/trunk/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 11:24:12 -0500 (Sun, 16 Nov 2008)
New Revision: 2815
Modified:
mgmt/trunk/cumin/Makefile
Log:
Use relative paths to avoid path trouble in rpms
Modified: mgmt/trunk/cumin/Makefile
===================================================================
--- mgmt/trunk/cumin/Makefile 2008-11-16 16:13:29 UTC (rev 2814)
+++ mgmt/trunk/cumin/Makefile 2008-11-16 16:24:12 UTC (rev 2815)
@@ -21,7 +21,8 @@
install -pm 0644 LICENSE COPYING ${doc}
install -d ${share}/resources
install -pm 0644 resources/* ${share}/resources
- ln -s ${SHARE_DIR}/wooly/resources ${share}/resources-wooly
+ ln -s ../wooly/resources ${share}/resources-wooly
+ ln -s ../mint/sql ${share}/sql
install -d ${etc}
install -pm 0644 etc/* ${etc}
install -d ${log}
16 years, 1 month
rhmessaging commits: r2814 - mgmt/trunk/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 11:13:29 -0500 (Sun, 16 Nov 2008)
New Revision: 2814
Modified:
mgmt/trunk/wooly/Makefile
Log:
Add missing dir add
Modified: mgmt/trunk/wooly/Makefile
===================================================================
--- mgmt/trunk/wooly/Makefile 2008-11-16 15:46:31 UTC (rev 2813)
+++ mgmt/trunk/wooly/Makefile 2008-11-16 16:13:29 UTC (rev 2814)
@@ -13,6 +13,7 @@
install: build
install -d ${lib}
install -pm 0644 python/wooly/*.py python/wooly/*.pyc python/wooly/*.strings ${PYTHON_LIB_DIR}/wooly
+ install -d ${doc}
install -pm 0644 LICENSE* COPYING* ${doc}
install -d ${share}/resources
install -pm 0644 resources/* ${share}/resources
16 years, 1 month
rhmessaging commits: r2813 - in mgmt/trunk: bin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 10:46:31 -0500 (Sun, 16 Nov 2008)
New Revision: 2813
Removed:
mgmt/trunk/bin/cumin-rpm-build
Modified:
mgmt/trunk/Makefile
Log:
Remove makefile rules and helper scripts that are now obsolete
Modified: mgmt/trunk/Makefile
===================================================================
--- mgmt/trunk/Makefile 2008-11-16 15:35:36 UTC (rev 2812)
+++ mgmt/trunk/Makefile 2008-11-16 15:46:31 UTC (rev 2813)
@@ -1,4 +1,4 @@
-.PHONY: help dist clean cumin mint tags check-devel-env
+.PHONY: help tags check-devel-env
version := 0.1.$(shell svn info | fgrep "Revision:" | cut -d " " -f 2)
@@ -6,38 +6,7 @@
@echo "Targets:"
@echo " help Print this message"
@echo " tags Rebuild the tag index"
- @echo " dist Create a dist tarball"
- @echo " clean Remove software installed at $$DEVEL_HOME/install"
-dist: clean
- mkdir -p dist/lib/python/mint
- mkdir -p dist/lib/python/wooly
- mkdir -p dist/lib/python/cumin
- mkdir -p dist/bin
- mkdir -p dist/resources
- mkdir -p dist/etc
- mkdir -p dist/sql
- mkdir -p dist/doc
- mkdir -p dist/log
- cp -a mint/python/mint/* dist/lib/python/mint
- cp -a mint/sql/* dist/sql
- cp -a cumin/python/wooly/* dist/lib/python/wooly
- cp -a cumin/python/cumin/* dist/lib/python/cumin
- cp -a cumin/bin/* dist/bin
- cp -a cumin/resources/* dist/resources
- cp -a cumin/etc/* dist/etc
- cp LICENSE COPYING dist/doc
- tar -cvzf cumin-${version}.tar.gz dist
-
-source-tarball:
- svn export . /tmp/cumin-${version}
- tar -C /tmp -czf cumin-${version}.tar.gz cumin-${version}
- rm -rf /tmp/cumin-${version}
-
-clean: check-devel-env
- rm -rf dist
- rm -rf "${DEVEL_HOME}"/install
-
tags: check-devel-env
find "${DEVEL_HOME}" -name \*.py -print \
| etags --output="${DEVEL_HOME}/etc/devel.tags" -
Deleted: mgmt/trunk/bin/cumin-rpm-build
===================================================================
--- mgmt/trunk/bin/cumin-rpm-build 2008-11-16 15:35:36 UTC (rev 2812)
+++ mgmt/trunk/bin/cumin-rpm-build 2008-11-16 15:46:31 UTC (rev 2813)
@@ -1,26 +0,0 @@
-#!/bin/bash -e
-
-if [ -z "$1" ]; then
- echo "Usage: cumin-rpm-build SOURCE-TARBALL"
- exit 1
-fi
-
-tarball=$1
-topdir="/tmp/cumin-rpm-build-${RANDOM}"
-
-echo "Building in tmp dir $topdir"
-
-mkdir "$topdir"
-cd "$topdir"
-mkdir SPECS SRPMS SOURCES RPMS BUILD
-
-cp "$tarball" "${topdir}/SOURCES"
-
-wget "http://cvs.devel.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/rpms/cumin/RHEL..." -O cumin.spec.in
-
-version=$(basename "$tarball" | cut -d . -f 3)
-#version=$(expr match "$tarball" '\(.[0-9]+\)')
-
-sed -e "$(printf 's/^Version:.*$/Version: 0.1.%s/' "$version")" cumin.spec.in > SPECS/cumin.spec
-
-rpmbuild --define "_topdir $topdir" -ba SPECS/cumin.spec
16 years, 1 month
rhmessaging commits: r2812 - mgmt/trunk.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 10:35:36 -0500 (Sun, 16 Nov 2008)
New Revision: 2812
Removed:
mgmt/trunk/cumin.spec
Log:
This spec file is no longer used
Deleted: mgmt/trunk/cumin.spec
===================================================================
--- mgmt/trunk/cumin.spec 2008-11-16 15:34:25 UTC (rev 2811)
+++ mgmt/trunk/cumin.spec 2008-11-16 15:35:36 UTC (rev 2812)
@@ -1,109 +0,0 @@
-# svn revision: $Rev$
-
-Summary: management component of MRG
-Name: cumin
-Version: 0.1
-Release: 6%{?dist}
-License: LGPL
-Group: System Environment/Libraries
-URL: http://redhat.com/mrg
-Source0: %{name}-%{version}.tar.gz
-# svn co http://anonsvn.jboss.org/repos/rhmessaging/mgmt mgmt
-# cd mgmt; make dist
-# tar -cvzhf cumin-0.1.tar.gz dist
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-BuildRequires: python >= 2.4
-BuildRequires: python-devel >= 2.4
-
-Requires: python >= 2.4
-Requires: postgresql >= 8.1.9
-Requires: postgresql-server >= 8.1.9
-Requires: python-sqlobject >= 0.9.2
-Requires: python-psycopg2 >= 2.0.6
-Requires: python-qpid
-
-%description
-Cumin is the management component of MRG - Messaging, Realtime and Grid.
-Provides a unified management interface for the Messaging, Realtime and Grid
-components of MRG.
-
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
-%pre
-getent group cumin >/dev/null || groupadd -r cumin
-getent passwd cumin >/dev/null || \
- useradd -r -m -g cumin -d %{_datadir}/cumin -s /sbin/nologin \
- -c "Owner of Cumin Daemons" cumin
-exit 0
-
-%prep
-%setup -q -n dist
-
-%build
-#empty
-
-%install
-rm -rf $RPM_BUILD_ROOT
-CUMIN_HOME=%{_datadir}/cumin
-install -d ${RPM_BUILD_ROOT}${CUMIN_HOME}
-
-install -d ${RPM_BUILD_ROOT}${CUMIN_HOME}/resources
-install -pm 0644 resources/* ${RPM_BUILD_ROOT}${CUMIN_HOME}/resources
-
-install -d ${RPM_BUILD_ROOT}${CUMIN_HOME}/sql
-install -pm 0644 sql/* ${RPM_BUILD_ROOT}${CUMIN_HOME}/sql
-
-install -d ${RPM_BUILD_ROOT}${CUMIN_HOME}/doc
-install -pm 0644 doc/* ${RPM_BUILD_ROOT}${CUMIN_HOME}/doc
-
-install -d ${RPM_BUILD_ROOT}%{_bindir}
-install -pm 0755 bin/* $RPM_BUILD_ROOT%{_bindir}
-
-install -d ${RPM_BUILD_ROOT}%{_sysconfdir}
-install -pm 0644 etc/* $RPM_BUILD_ROOT%{_sysconfdir}
-ln -s %{_sysconfdir} ${RPM_BUILD_ROOT}${CUMIN_HOME}/etc
-
-install -d ${RPM_BUILD_ROOT}${CUMIN_HOME}/lib/python
-cd lib/python
-for dir in cumin mint wooly; do
- install -d $RPM_BUILD_ROOT%{python_sitelib}/$dir
- install -pm 0644 $dir/* $RPM_BUILD_ROOT%{python_sitelib}/$dir
- ln -s %{python_sitelib}/$dir ${RPM_BUILD_ROOT}${CUMIN_HOME}/lib/python/$dir
-done
-cd ../..
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,cumin,cumin,-)
-%doc doc/*
-%{_bindir}/cumin*
-%{_sysconfdir}/*cumin*
-%{_datadir}/cumin
-%{python_sitelib}/cumin
-%{python_sitelib}/mint
-%{python_sitelib}/wooly
-
-
-%changelog
-* Mon Mar 31 2008 Nuno Santos <nsantos(a)redhat.com> - 0.1-6
-- Create cumin user/group
-
-* Mon Feb 11 2008 Nuno Santos <nsantos(a)redhat.com> - 0.1-5
-- Fix for multiple broker registrations
-
-* Mon Feb 11 2008 Rafael Schloming <rafaels(a)redhat.com> - 0.1-4
-- Bumped for Beta 3 update
-
-* Fri Jan 25 2008 Nuno Santos <nsantos(a)redhat.com> - 0.1-3
-- Workaround to fix charts issue
-
-* Thu Jan 24 2008 Nuno Santos <nsantos(a)redhat.com> - 0.1-2
-- Fix data url in /etc/cumin.conf; work around query divide-by-zero issues
-- Add dependency on postgresql-server
-
-* Fri Jan 18 2008 Nuno Santos <nsantos(a)redhat.com> - 0.1-1
-- Initial build.
16 years, 1 month
rhmessaging commits: r2811 - in mgmt/trunk: cumin/python/cumin and 4 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 10:34:25 -0500 (Sun, 16 Nov 2008)
New Revision: 2811
Added:
mgmt/trunk/cumin-test-0/resources-wooly
mgmt/trunk/wooly/resources/
mgmt/trunk/wooly/resources/wooly.js
Removed:
mgmt/trunk/cumin/resources/wooly.js
Modified:
mgmt/trunk/cumin/Makefile
mgmt/trunk/cumin/python/cumin/__init__.py
mgmt/trunk/wooly/Makefile
Log:
Move the wooly resources into the wooly project; fix up makefiles; add another resource dir, the wooly one, to the Cumin resource finder
Modified: mgmt/trunk/cumin/Makefile
===================================================================
--- mgmt/trunk/cumin/Makefile 2008-11-16 15:16:32 UTC (rev 2810)
+++ mgmt/trunk/cumin/Makefile 2008-11-16 15:34:25 UTC (rev 2811)
@@ -3,7 +3,6 @@
include ../etc/Makefile.common
name := cumin
-
lib := ${PYTHON_LIB_DIR}/${name}
etc := ${ETC_DIR}/${name}
doc := ${DOC_DIR}/${name}
@@ -14,16 +13,15 @@
../bin/python-compile python
install: build
- install -d ${PYTHON_LIB_DIR}/wooly
- install -pm 0644 python/wooly/*.py python/wooly/*.pyc python/wooly/*.strings ${PYTHON_LIB_DIR}/wooly
install -d ${lib}
install -pm 0644 python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
install -d ${BIN_DIR}
install -pm 0755 bin/* ${BIN_DIR}
install -d ${doc}
- install -pm 0644 LICENSE* COPYING* ${doc}
+ install -pm 0644 LICENSE COPYING ${doc}
install -d ${share}/resources
install -pm 0644 resources/* ${share}/resources
+ ln -s ${SHARE_DIR}/wooly/resources ${share}/resources-wooly
install -d ${etc}
install -pm 0644 etc/* ${etc}
install -d ${log}
Modified: mgmt/trunk/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/__init__.py 2008-11-16 15:16:32 UTC (rev 2810)
+++ mgmt/trunk/cumin/python/cumin/__init__.py 2008-11-16 15:34:25 UTC (rev 2811)
@@ -33,9 +33,8 @@
if self.config.debug:
self.enable_debug()
- #home, data_uri, spec_path):
-
self.home = self.config.home
+ self.add_resource_dir(os.path.join(self.home, "resources-wooly"))
self.add_resource_dir(os.path.join(self.home, "resources"))
self.model = CuminModel(self, self.config.data, self.config.spec)
Deleted: mgmt/trunk/cumin/resources/wooly.js
===================================================================
--- mgmt/trunk/cumin/resources/wooly.js 2008-11-16 15:16:32 UTC (rev 2810)
+++ mgmt/trunk/cumin/resources/wooly.js 2008-11-16 15:34:25 UTC (rev 2811)
@@ -1,522 +0,0 @@
-var wooly;
-
-(function() {
- wooly = new Wooly();
-
- function assert() {
- for (var i = 0; i < arguments.length; i++) {
- if (!arguments[i]) {
- throw new Error("Assertion failure in " +
- arguments.callee.caller.prototype);
- }
- }
- }
-
- function log() {
- if (wooly.console) {
- wooly.console.log.apply(wooly.console, arguments);
- }
- }
-
- function dir() {
- if (wooly.console) {
- wooly.console.dir.apply(wooly.console, arguments);
- }
- }
-
- function translate(node, parent) {
- //log("node", node.nodeType, node, "parent", parent);
-
- var first = node.firstChild;
- var name = node.nodeName;
-
- if (first && first.nodeType == 3 && parent) {
- parent[name] = first.nodeValue;
-
- return null;
- }
-
- var object = new Object();
- var attrs = node.attributes;
-
- if (parent) {
- var keyattr = null;
-
- if (attrs) {
- keyattr = attrs.getNamedItem("id");
-
- if (keyattr == null) {
- keyattr = attrs.getNamedItem("key");
- }
-
- if (keyattr == null) {
- keyattr = attrs.getNamedItem("name");
- }
-
- if (keyattr) {
- var key = keyattr.nodeValue;
- var extant = parent[name];
-
- if (extant == null) {
- extant = new Object();
- parent[name] = extant;
- }
-
- extant[key] = object;
- }
- }
-
- if (keyattr == null) {
- var extant = parent[name];
-
- if (extant == null) {
- parent[name] = object;
- } else {
- var array;
-
- if (extant instanceof Array) {
- array = extant;
- } else {
- array = new Array();
- array.push(extant);
-
- parent[name] = array;
- }
-
- array.push(object);
- }
- }
- }
-
- var attr;
-
- for (var i = 0; i < attrs.length; i++) {
- attr = attrs[i];
- object[attr.nodeName] = attr.nodeValue;
- }
-
- var childs = node.childNodes;
-
- for (var i = 0; i < childs.length; i++) {
- translate(childs[i], object);
- }
-
- return object;
- }
-
- function update(elem, elems, object) {
- //log("update", "elem", elem, "elems", elems, "object", object);
-
- if (typeof(object) == "string") {
- if (elem.firstChild.nodeType == 3) {
- elem.firstChild.data = object;
- }
- } else if (object instanceof Array) {
- for (var i = 0; i < object.length; i++) {
- update(elems[i], elems, object[i]);
- }
- } else {
- for (var child in object) {
- var elems = elem.getElementsByTagName(child);
- update(elems[0], elems, object[child]);
- }
- }
- }
-
- function descendant(elem, path) {
- var names = path.split(".");
- var node = elem;
-
- for (var i = 0; i < names.length; i++) {
- var elems = elem.getElementsByTagName(names[i]);
-
- if (elems.length) {
- node = elems[0];
- } else {
- break;
- }
- }
-
- return node;
- }
-
- function findexpr(found, limit, node, expr) {
- var result = document.evaluate
- (expr, node, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
-
- var node = result.iterateNext();
-
- for (var i = 0; node != null && i < limit; i++) {
- found.push(node);
- node = result.iterateNext();
- }
-
- return found;
- }
-
- function find(found, limit,
- node, nodeType, nodeName,
- attr, attrValue) {
- //log("find", found, limit, node, nodeType, nodeName, attr, attrValue);
-
- /*
- assert(found);
- assert(found instanceof Array);
- assert(node);
- assert(nodeType);
- */
-
- var children = node.childNodes;
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var candidate = child;
-
- if (child.nodeType != nodeType) {
- candidate = null;
- } else if (nodeName != null && child.nodeName.toLowerCase() != nodeName) {
- candidate = null;
- } else if (attr != null && child.nodeType == 1) {
- var value = child.getAttribute(attr);
-
- if (!value) {
- candidate = null;
- } else if (attrValue != null && value != attrValue) {
- candidate = null;
- }
- }
-
- if (candidate) {
- found.push(candidate);
-
- if (found.length == limit) {
- return;
- }
- } else if (child.nodeType == 1) {
- find(found, limit, child, nodeType, nodeName, attr, attrValue);
- }
- }
- }
-
- function Wooly() {
- this.getNewRequest = function() {
- var request;
- if (window.XMLHttpRequest) {
- request = new XMLHttpRequest();
- }
- else {
- if (window.ActiveXObject) {
- try {
- request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- request = new ActiveXObject("Msxml2.XMLHTTP");
- }
- }
- }
- return request;
- }
-
- this.assert = assert;
- this.log = log;
- this.dir = dir;
- this.updater_ids = [];
-
- if (window.console) {
- this.console = window.console;
- }
-
-
- this.deferredUpdate = function(url, callback, passback) {
- var req = this.getNewRequest();
-
- req.open("get", url, true);
- req.onreadystatechange = update;
- req.send(null);
-
- function update() {
- try {
- if (req.readyState == 4 && req.status == 200) {
- data = wooly.doc(req.responseXML);
- var obj = data.objectify();
- callback(obj, passback);
- }
- } catch (e) {
- log(e);
- throw e;
- }
- }
- }
-
- this.setIntervalUpdate = function(url, callback, interval) {
- var req = this.getNewRequest();
-
- function fetch() {
- req.open("get", url, true);
- req.onreadystatechange = update;
- req.send(null);
- }
-
- var id = window.setInterval(fetch, interval);
-
- this.updater_ids.push(id);
-
- function update() {
- try {
- if (req.readyState == 4 && req.status == 200) {
- //dir(req);
-
- callback(wooly.doc(req.responseXML));
- }
- } catch (e) {
- log(e);
- // XXX might want to retry for a bit before we do
- // this
- window.clearInterval(id);
- throw e;
- }
- }
- }
-
- this.clearUpdates = function() {
- for (var i = 0; i < this.updater_ids.length; i++) {
- window.clearInterval(this.updater_ids[i])
- }
- }
-
- this._doc = new WoolyDocument(document);
-
- this.doc = function(doc) {
- if (doc) {
- return new WoolyDocument(doc);
- } else {
- return this._doc;
- }
- }
- }
-
- function WoolyDocument(node) {
- assert(node);
-
- this.node = node;
-
- this.root = function() {
- return new WoolyElement(this, node.documentElement);
- }
-
- // XXX rename to id
- this.elembyid = function(id) {
- var node = this.node.getElementById(id);
-
- if (node) {
- return new WoolyElement(this, node);
- }
- }
-
- this.elems = function(name, start) {
- if (start == null) {
- start = 0;
- }
-
- var nodes = this.node.getElementsByTagName(name);
- var coll = new WoolyCollection(this, nodes, WoolyElement);
-
- for (var i = 0; i < start; i++) {
- coll.next();
- }
-
- return coll;
- }
-
- this.elem = function(name, n) {
- return this.elems(name, n).next();
- }
-
- this.objectify = function() {
- return this.root().object();
- }
- }
-
- function WoolyCollection(doc, nodes, nodeClass) {
- assert(doc);
- assert(nodes);
- assert(nodeClass);
-
- this.doc = doc;
- this.nodes = nodes;
- this.nodeClass = nodeClass;
-
- this.pos = 0;
-
- this.next = function() {
- var node = this.nodes[this.pos++];
-
- if (node) {
- return new this.nodeClass(this.doc, node);
- } else {
- return null;
- }
- }
-
- this.get = function(index) {
- var node = this.nodes[index];
-
- if (node) {
- return new this.nodeClass(this.doc, node);
- } else {
- return null;
- }
- }
- }
-
- function WoolyElement(doc, node) {
- assert(doc);
- assert(doc instanceof WoolyDocument);
- assert(node);
- // assert(node instanceof Node); IE pukes on this
- assert(node.nodeType == 1);
-
- this.doc = doc;
- this.node = node;
-
- this.clear = function() {
- var child = this.node.firstChild;
- var next;
-
- while (child) {
- next = child.nextSibling;
- this.node.removeChild(child);
- child = next;
- }
-
- return this;
- }
-
- this.add = function(content) {
- assert(content);
-
- if (typeof content == "string") {
- // XXX flatten this out
- this.add(new WoolyText(this.doc, null).set(content));
- } else if (content.hasOwnProperty("node")) {
- this.node.appendChild(content.node);
- } else {
- throw new Error("Content is of unexpected type");
- }
-
- return this;
- }
-
- this.set = function(content) {
- this.clear().add(content);
-
- return this;
- }
-
- this.getattr = function(name) {
- return this.node.getAttribute(name);
- }
-
- this.setattr = function(name, value) {
- this.node.setAttribute(name, value);
-
- return value
- }
-
- this.dict = function(name, kattr, vattr) {
- var dict = new Object();
- var elems = this.elems(name);
- var elem = elems.next();
-
- while (elem != null) {
- dict[elem.getattr(kattr)] = elem.getattr(vattr);
- elem = elems.next();
- }
-
- return dict;
- }
-
- // XXX Rename to objectify
- this.object = function() {
- return translate(this.node, null);
- }
-
- this.update = function(data) {
- update(this.node, null, data);
- }
-
- this.descendant = function(path) {
- var node = descendant(this.node, path);
-
- return new WoolyElement(this.doc, node);
- }
-
- this.elems = function(name, attr, attrValue, start, limit) {
- if (start == null) {
- start = 0;
- }
-
- var nodes = new Array();
-
- find(nodes, limit, this.node, 1, name, attr, attrValue);
-
- var coll = new WoolyCollection(this.doc, nodes, WoolyElement);
-
- for (var i = 0; i < start; i++) {
- coll.next();
- }
-
- return coll;
- }
-
- this.elem = function(name, attr, attrValue) {
- return this.elems(name, attr, attrValue, 0, 1).next();
- }
-
- this.texts = function(start, limit) {
- var nodes = new Array();
-
- find(nodes, limit, this.node, 3);
-
- var coll = new WoolyCollection(this.doc, nodes, WoolyText);
-
- for (var i = 0; i < start; i++) {
- coll.next();
- }
-
- return coll;
- }
-
- this.text = function() {
- return this.texts(0, 1).next();
- }
- }
-
- function WoolyText(doc, node) {
- assert(doc);
- assert(doc instanceof WoolyDocument);
- if (node) {
- //assert(node instanceof Node);
- assert(node.nodeType == 3);
- }
-
- this.doc = doc;
-
- if (node == null) {
- this.node = doc.node.createTextNode("");
- } else {
- this.node = node;
- }
-
- this.get = function() {
- return this.node.data
- }
-
- this.set = function(data) {
- assert(typeof data == "string");
-
- this.node.data = data
-
- return this;
- }
- }
-}())
Added: mgmt/trunk/cumin-test-0/resources-wooly
===================================================================
--- mgmt/trunk/cumin-test-0/resources-wooly (rev 0)
+++ mgmt/trunk/cumin-test-0/resources-wooly 2008-11-16 15:34:25 UTC (rev 2811)
@@ -0,0 +1 @@
+link ../wooly/resources
\ No newline at end of file
Property changes on: mgmt/trunk/cumin-test-0/resources-wooly
___________________________________________________________________
Name: svn:special
+ *
Modified: mgmt/trunk/wooly/Makefile
===================================================================
--- mgmt/trunk/wooly/Makefile 2008-11-16 15:16:32 UTC (rev 2810)
+++ mgmt/trunk/wooly/Makefile 2008-11-16 15:34:25 UTC (rev 2811)
@@ -4,10 +4,15 @@
name := wooly
lib := ${PYTHON_LIB_DIR}/${name}
+doc := ${DOC_DIR}/${name}
+share := ${SHARE_DIR}/${name}
build:
../bin/python-compile python
install: build
install -d ${lib}
- install python/wooly/*.py python/wooly/*.pyc ${lib}
+ install -pm 0644 python/wooly/*.py python/wooly/*.pyc python/wooly/*.strings ${PYTHON_LIB_DIR}/wooly
+ install -pm 0644 LICENSE* COPYING* ${doc}
+ install -d ${share}/resources
+ install -pm 0644 resources/* ${share}/resources
Copied: mgmt/trunk/wooly/resources/wooly.js (from rev 2809, mgmt/trunk/cumin/resources/wooly.js)
===================================================================
--- mgmt/trunk/wooly/resources/wooly.js (rev 0)
+++ mgmt/trunk/wooly/resources/wooly.js 2008-11-16 15:34:25 UTC (rev 2811)
@@ -0,0 +1,522 @@
+var wooly;
+
+(function() {
+ wooly = new Wooly();
+
+ function assert() {
+ for (var i = 0; i < arguments.length; i++) {
+ if (!arguments[i]) {
+ throw new Error("Assertion failure in " +
+ arguments.callee.caller.prototype);
+ }
+ }
+ }
+
+ function log() {
+ if (wooly.console) {
+ wooly.console.log.apply(wooly.console, arguments);
+ }
+ }
+
+ function dir() {
+ if (wooly.console) {
+ wooly.console.dir.apply(wooly.console, arguments);
+ }
+ }
+
+ function translate(node, parent) {
+ //log("node", node.nodeType, node, "parent", parent);
+
+ var first = node.firstChild;
+ var name = node.nodeName;
+
+ if (first && first.nodeType == 3 && parent) {
+ parent[name] = first.nodeValue;
+
+ return null;
+ }
+
+ var object = new Object();
+ var attrs = node.attributes;
+
+ if (parent) {
+ var keyattr = null;
+
+ if (attrs) {
+ keyattr = attrs.getNamedItem("id");
+
+ if (keyattr == null) {
+ keyattr = attrs.getNamedItem("key");
+ }
+
+ if (keyattr == null) {
+ keyattr = attrs.getNamedItem("name");
+ }
+
+ if (keyattr) {
+ var key = keyattr.nodeValue;
+ var extant = parent[name];
+
+ if (extant == null) {
+ extant = new Object();
+ parent[name] = extant;
+ }
+
+ extant[key] = object;
+ }
+ }
+
+ if (keyattr == null) {
+ var extant = parent[name];
+
+ if (extant == null) {
+ parent[name] = object;
+ } else {
+ var array;
+
+ if (extant instanceof Array) {
+ array = extant;
+ } else {
+ array = new Array();
+ array.push(extant);
+
+ parent[name] = array;
+ }
+
+ array.push(object);
+ }
+ }
+ }
+
+ var attr;
+
+ for (var i = 0; i < attrs.length; i++) {
+ attr = attrs[i];
+ object[attr.nodeName] = attr.nodeValue;
+ }
+
+ var childs = node.childNodes;
+
+ for (var i = 0; i < childs.length; i++) {
+ translate(childs[i], object);
+ }
+
+ return object;
+ }
+
+ function update(elem, elems, object) {
+ //log("update", "elem", elem, "elems", elems, "object", object);
+
+ if (typeof(object) == "string") {
+ if (elem.firstChild.nodeType == 3) {
+ elem.firstChild.data = object;
+ }
+ } else if (object instanceof Array) {
+ for (var i = 0; i < object.length; i++) {
+ update(elems[i], elems, object[i]);
+ }
+ } else {
+ for (var child in object) {
+ var elems = elem.getElementsByTagName(child);
+ update(elems[0], elems, object[child]);
+ }
+ }
+ }
+
+ function descendant(elem, path) {
+ var names = path.split(".");
+ var node = elem;
+
+ for (var i = 0; i < names.length; i++) {
+ var elems = elem.getElementsByTagName(names[i]);
+
+ if (elems.length) {
+ node = elems[0];
+ } else {
+ break;
+ }
+ }
+
+ return node;
+ }
+
+ function findexpr(found, limit, node, expr) {
+ var result = document.evaluate
+ (expr, node, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
+
+ var node = result.iterateNext();
+
+ for (var i = 0; node != null && i < limit; i++) {
+ found.push(node);
+ node = result.iterateNext();
+ }
+
+ return found;
+ }
+
+ function find(found, limit,
+ node, nodeType, nodeName,
+ attr, attrValue) {
+ //log("find", found, limit, node, nodeType, nodeName, attr, attrValue);
+
+ /*
+ assert(found);
+ assert(found instanceof Array);
+ assert(node);
+ assert(nodeType);
+ */
+
+ var children = node.childNodes;
+
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var candidate = child;
+
+ if (child.nodeType != nodeType) {
+ candidate = null;
+ } else if (nodeName != null && child.nodeName.toLowerCase() != nodeName) {
+ candidate = null;
+ } else if (attr != null && child.nodeType == 1) {
+ var value = child.getAttribute(attr);
+
+ if (!value) {
+ candidate = null;
+ } else if (attrValue != null && value != attrValue) {
+ candidate = null;
+ }
+ }
+
+ if (candidate) {
+ found.push(candidate);
+
+ if (found.length == limit) {
+ return;
+ }
+ } else if (child.nodeType == 1) {
+ find(found, limit, child, nodeType, nodeName, attr, attrValue);
+ }
+ }
+ }
+
+ function Wooly() {
+ this.getNewRequest = function() {
+ var request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ else {
+ if (window.ActiveXObject) {
+ try {
+ request = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e) {
+ request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ }
+ }
+ return request;
+ }
+
+ this.assert = assert;
+ this.log = log;
+ this.dir = dir;
+ this.updater_ids = [];
+
+ if (window.console) {
+ this.console = window.console;
+ }
+
+
+ this.deferredUpdate = function(url, callback, passback) {
+ var req = this.getNewRequest();
+
+ req.open("get", url, true);
+ req.onreadystatechange = update;
+ req.send(null);
+
+ function update() {
+ try {
+ if (req.readyState == 4 && req.status == 200) {
+ data = wooly.doc(req.responseXML);
+ var obj = data.objectify();
+ callback(obj, passback);
+ }
+ } catch (e) {
+ log(e);
+ throw e;
+ }
+ }
+ }
+
+ this.setIntervalUpdate = function(url, callback, interval) {
+ var req = this.getNewRequest();
+
+ function fetch() {
+ req.open("get", url, true);
+ req.onreadystatechange = update;
+ req.send(null);
+ }
+
+ var id = window.setInterval(fetch, interval);
+
+ this.updater_ids.push(id);
+
+ function update() {
+ try {
+ if (req.readyState == 4 && req.status == 200) {
+ //dir(req);
+
+ callback(wooly.doc(req.responseXML));
+ }
+ } catch (e) {
+ log(e);
+ // XXX might want to retry for a bit before we do
+ // this
+ window.clearInterval(id);
+ throw e;
+ }
+ }
+ }
+
+ this.clearUpdates = function() {
+ for (var i = 0; i < this.updater_ids.length; i++) {
+ window.clearInterval(this.updater_ids[i])
+ }
+ }
+
+ this._doc = new WoolyDocument(document);
+
+ this.doc = function(doc) {
+ if (doc) {
+ return new WoolyDocument(doc);
+ } else {
+ return this._doc;
+ }
+ }
+ }
+
+ function WoolyDocument(node) {
+ assert(node);
+
+ this.node = node;
+
+ this.root = function() {
+ return new WoolyElement(this, node.documentElement);
+ }
+
+ // XXX rename to id
+ this.elembyid = function(id) {
+ var node = this.node.getElementById(id);
+
+ if (node) {
+ return new WoolyElement(this, node);
+ }
+ }
+
+ this.elems = function(name, start) {
+ if (start == null) {
+ start = 0;
+ }
+
+ var nodes = this.node.getElementsByTagName(name);
+ var coll = new WoolyCollection(this, nodes, WoolyElement);
+
+ for (var i = 0; i < start; i++) {
+ coll.next();
+ }
+
+ return coll;
+ }
+
+ this.elem = function(name, n) {
+ return this.elems(name, n).next();
+ }
+
+ this.objectify = function() {
+ return this.root().object();
+ }
+ }
+
+ function WoolyCollection(doc, nodes, nodeClass) {
+ assert(doc);
+ assert(nodes);
+ assert(nodeClass);
+
+ this.doc = doc;
+ this.nodes = nodes;
+ this.nodeClass = nodeClass;
+
+ this.pos = 0;
+
+ this.next = function() {
+ var node = this.nodes[this.pos++];
+
+ if (node) {
+ return new this.nodeClass(this.doc, node);
+ } else {
+ return null;
+ }
+ }
+
+ this.get = function(index) {
+ var node = this.nodes[index];
+
+ if (node) {
+ return new this.nodeClass(this.doc, node);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ function WoolyElement(doc, node) {
+ assert(doc);
+ assert(doc instanceof WoolyDocument);
+ assert(node);
+ // assert(node instanceof Node); IE pukes on this
+ assert(node.nodeType == 1);
+
+ this.doc = doc;
+ this.node = node;
+
+ this.clear = function() {
+ var child = this.node.firstChild;
+ var next;
+
+ while (child) {
+ next = child.nextSibling;
+ this.node.removeChild(child);
+ child = next;
+ }
+
+ return this;
+ }
+
+ this.add = function(content) {
+ assert(content);
+
+ if (typeof content == "string") {
+ // XXX flatten this out
+ this.add(new WoolyText(this.doc, null).set(content));
+ } else if (content.hasOwnProperty("node")) {
+ this.node.appendChild(content.node);
+ } else {
+ throw new Error("Content is of unexpected type");
+ }
+
+ return this;
+ }
+
+ this.set = function(content) {
+ this.clear().add(content);
+
+ return this;
+ }
+
+ this.getattr = function(name) {
+ return this.node.getAttribute(name);
+ }
+
+ this.setattr = function(name, value) {
+ this.node.setAttribute(name, value);
+
+ return value
+ }
+
+ this.dict = function(name, kattr, vattr) {
+ var dict = new Object();
+ var elems = this.elems(name);
+ var elem = elems.next();
+
+ while (elem != null) {
+ dict[elem.getattr(kattr)] = elem.getattr(vattr);
+ elem = elems.next();
+ }
+
+ return dict;
+ }
+
+ // XXX Rename to objectify
+ this.object = function() {
+ return translate(this.node, null);
+ }
+
+ this.update = function(data) {
+ update(this.node, null, data);
+ }
+
+ this.descendant = function(path) {
+ var node = descendant(this.node, path);
+
+ return new WoolyElement(this.doc, node);
+ }
+
+ this.elems = function(name, attr, attrValue, start, limit) {
+ if (start == null) {
+ start = 0;
+ }
+
+ var nodes = new Array();
+
+ find(nodes, limit, this.node, 1, name, attr, attrValue);
+
+ var coll = new WoolyCollection(this.doc, nodes, WoolyElement);
+
+ for (var i = 0; i < start; i++) {
+ coll.next();
+ }
+
+ return coll;
+ }
+
+ this.elem = function(name, attr, attrValue) {
+ return this.elems(name, attr, attrValue, 0, 1).next();
+ }
+
+ this.texts = function(start, limit) {
+ var nodes = new Array();
+
+ find(nodes, limit, this.node, 3);
+
+ var coll = new WoolyCollection(this.doc, nodes, WoolyText);
+
+ for (var i = 0; i < start; i++) {
+ coll.next();
+ }
+
+ return coll;
+ }
+
+ this.text = function() {
+ return this.texts(0, 1).next();
+ }
+ }
+
+ function WoolyText(doc, node) {
+ assert(doc);
+ assert(doc instanceof WoolyDocument);
+ if (node) {
+ //assert(node instanceof Node);
+ assert(node.nodeType == 3);
+ }
+
+ this.doc = doc;
+
+ if (node == null) {
+ this.node = doc.node.createTextNode("");
+ } else {
+ this.node = node;
+ }
+
+ this.get = function() {
+ return this.node.data
+ }
+
+ this.set = function(data) {
+ assert(typeof data == "string");
+
+ this.node.data = data
+
+ return this;
+ }
+ }
+}())
16 years, 1 month
rhmessaging commits: r2810 - in mgmt/trunk: cumin and 4 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-11-16 10:16:32 -0500 (Sun, 16 Nov 2008)
New Revision: 2810
Added:
mgmt/trunk/wooly/
mgmt/trunk/wooly/COPYING
mgmt/trunk/wooly/COPYING-for-wsgiserver
mgmt/trunk/wooly/LICENSE
mgmt/trunk/wooly/LICENSE-for-wsgiserver
mgmt/trunk/wooly/Makefile
mgmt/trunk/wooly/python/
mgmt/trunk/wooly/python/wooly/
Removed:
mgmt/trunk/cumin/COPYING-for-wsgiserver
mgmt/trunk/cumin/LICENSE-for-wsgiserver
mgmt/trunk/cumin/python/wooly/
Modified:
mgmt/trunk/etc/devel.profile
mgmt/trunk/etc/devel.profile.tcsh
mgmt/trunk/etc/devel.profile.zsh
Log:
Move wooly into its own project, out of the cumin project. This commit shifts everything over except for wooly resources, which I'll move in a subsequent commit.
Deleted: mgmt/trunk/cumin/COPYING-for-wsgiserver
===================================================================
--- mgmt/trunk/cumin/COPYING-for-wsgiserver 2008-11-15 22:36:31 UTC (rev 2809)
+++ mgmt/trunk/cumin/COPYING-for-wsgiserver 2008-11-16 15:16:32 UTC (rev 2810)
@@ -1,2 +0,0 @@
-Copyright (c) 2004-2007, CherryPy Team (team(a)cherrypy.org)
-All rights reserved.
Deleted: mgmt/trunk/cumin/LICENSE-for-wsgiserver
===================================================================
--- mgmt/trunk/cumin/LICENSE-for-wsgiserver 2008-11-15 22:36:31 UTC (rev 2809)
+++ mgmt/trunk/cumin/LICENSE-for-wsgiserver 2008-11-16 15:16:32 UTC (rev 2810)
@@ -1,22 +0,0 @@
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of the CherryPy Team nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Modified: mgmt/trunk/etc/devel.profile
===================================================================
--- mgmt/trunk/etc/devel.profile 2008-11-15 22:36:31 UTC (rev 2809)
+++ mgmt/trunk/etc/devel.profile 2008-11-16 15:16:32 UTC (rev 2810)
@@ -1,5 +1,5 @@
export DEVEL_HOME="$PWD"
-export DEVEL_MODULES="mint cumin basil parsley"
+export DEVEL_MODULES="mint cumin basil parsley wooly"
# PYTHONPATH
Modified: mgmt/trunk/etc/devel.profile.tcsh
===================================================================
--- mgmt/trunk/etc/devel.profile.tcsh 2008-11-15 22:36:31 UTC (rev 2809)
+++ mgmt/trunk/etc/devel.profile.tcsh 2008-11-16 15:16:32 UTC (rev 2810)
@@ -1,5 +1,5 @@
setenv DEVEL_HOME "$PWD"
-set DEVEL_MODULES=(mint cumin basil parsley)
+set DEVEL_MODULES=(mint cumin basil parsley wooly)
# PYTHONPATH
Modified: mgmt/trunk/etc/devel.profile.zsh
===================================================================
--- mgmt/trunk/etc/devel.profile.zsh 2008-11-15 22:36:31 UTC (rev 2809)
+++ mgmt/trunk/etc/devel.profile.zsh 2008-11-16 15:16:32 UTC (rev 2810)
@@ -1,5 +1,5 @@
export DEVEL_HOME="$PWD"
-export DEVEL_MODULES="mint cumin basil parsley"
+export DEVEL_MODULES="mint cumin basil parsley wooly"
# PYTHONPATH
Added: mgmt/trunk/wooly/COPYING
===================================================================
--- mgmt/trunk/wooly/COPYING (rev 0)
+++ mgmt/trunk/wooly/COPYING 2008-11-16 15:16:32 UTC (rev 2810)
@@ -0,0 +1,15 @@
+Copyright (C) 2007 Red Hat Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Copied: mgmt/trunk/wooly/COPYING-for-wsgiserver (from rev 2809, mgmt/trunk/cumin/COPYING-for-wsgiserver)
===================================================================
--- mgmt/trunk/wooly/COPYING-for-wsgiserver (rev 0)
+++ mgmt/trunk/wooly/COPYING-for-wsgiserver 2008-11-16 15:16:32 UTC (rev 2810)
@@ -0,0 +1,2 @@
+Copyright (c) 2004-2007, CherryPy Team (team(a)cherrypy.org)
+All rights reserved.
Added: mgmt/trunk/wooly/LICENSE
===================================================================
--- mgmt/trunk/wooly/LICENSE (rev 0)
+++ mgmt/trunk/wooly/LICENSE 2008-11-16 15:16:32 UTC (rev 2810)
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
Copied: mgmt/trunk/wooly/LICENSE-for-wsgiserver (from rev 2809, mgmt/trunk/cumin/LICENSE-for-wsgiserver)
===================================================================
--- mgmt/trunk/wooly/LICENSE-for-wsgiserver (rev 0)
+++ mgmt/trunk/wooly/LICENSE-for-wsgiserver 2008-11-16 15:16:32 UTC (rev 2810)
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the CherryPy Team nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Added: mgmt/trunk/wooly/Makefile
===================================================================
--- mgmt/trunk/wooly/Makefile (rev 0)
+++ mgmt/trunk/wooly/Makefile 2008-11-16 15:16:32 UTC (rev 2810)
@@ -0,0 +1,13 @@
+.PHONY: build install
+
+include ../etc/Makefile.common
+
+name := wooly
+lib := ${PYTHON_LIB_DIR}/${name}
+
+build:
+ ../bin/python-compile python
+
+install: build
+ install -d ${lib}
+ install python/wooly/*.py python/wooly/*.pyc ${lib}
Copied: mgmt/trunk/wooly/python/wooly (from rev 2809, mgmt/trunk/cumin/python/wooly)
16 years, 1 month
rhmessaging commits: r2809 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-15 17:36:31 -0500 (Sat, 15 Nov 2008)
New Revision: 2809
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/pool.strings
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Added ability to click on Slot vis element and show the running job.
Changed the Show All Slots button on the slot vis to a StateSwitch.
Consolidate so shared code between the system slot vis and the pool slot vis.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-15 22:34:09 UTC (rev 2808)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-15 22:36:31 UTC (rev 2809)
@@ -548,6 +548,72 @@
stat.title = "Load Avg"
stat.category = "general"
+class Visualization(CuminAction):
+ def __init__(self, cls, name):
+ super(Visualization, self).__init__(cls, name)
+
+ self.itemset = None
+
+ def get_xml_response(self, session, object, *args):
+ boxes = self.get_boxes(session, object, *args)
+ fields = self.get_field_tuples(session)
+
+ writer = Writer()
+ writer.write("<%ss>" % self.itemset.name)
+ for box in boxes:
+ writer.write("<%s id='%s'" % (self.itemset.name, str(box["id"])))
+ for field, desc in fields:
+ writer.write(" %s='%s'" % (field, box[field]))
+ if fields:
+ extra = self.get_extra(session, box)
+ for name, value in extra:
+ writer.write(" %s='%s'" % (name, value))
+ writer.write(" color='%s'/>" % self.get_color(session, box))
+ writer.write("</%ss>" %self.itemset.name)
+ return writer.to_string()
+
+ def get_boxes(self, session, object, *args):
+ if args:
+ self.itemset.set_args(session, *args)
+ cursor = self.itemset.get_items(session, object)
+ box_list = self.itemset.cursor_to_rows(cursor)
+ return box_list
+
+ def get_color(self, session, box):
+ return ""
+
+ def get_extra(self, session, box):
+ return list()
+
+ def get_colors(self):
+ return list()
+
+class SlotVisualization(Visualization):
+ # list of status/colors in the order we want them displayed
+ # in the legend
+ load_colors = [("Idle", "clear"),
+ ("Busy", "green"),
+ ("Suspended", "red"),
+ ("Vacating", "orange"),
+ ("Killing", "blue"),
+ ("Benchmarking", "yellow")]
+
+ def get_field_tuples(self, session):
+ return [("name", "Name"), ("machine", "Machine"), ("job_id", "Job")]
+
+ def get_extra(self, session, slot):
+ return [("jid", slot["jid"])]
+
+ def get_color(self, session, slot):
+ activity = slot["activity"]
+ for status, color in self.load_colors:
+ if status == activity:
+ return color
+ return "black"
+
+ def get_colors(self):
+ return self.load_colors
+
from system import SystemSlotSet
class CuminSystem(RemoteClass):
def __init__(self, model):
@@ -572,7 +638,7 @@
prop = CuminProperty(self, "machine")
prop.title = "Architecture"
- action = self.VisSlots(self, "slots")
+ action = self.SystemSlotVisualization(self, "slots")
action.navigable = False
#action = CuminAction(self, "ping")
@@ -591,56 +657,18 @@
def get_object_name(self, object):
return object.nodeName
- class VisSlots(CuminAction):
- # list of status/colors in the order we want them displayed
- # in the legend
- load_colors = [("Idle", "clear"),
- ("Busy", "green"),
- ("Suspended", "red"),
- ("Vacating", "red"),
- ("Killing", "blue"),
- ("Benchmarking", "yellow")]
-
+ class SystemSlotVisualization(SlotVisualization):
def __init__(self, cls, name):
- super(CuminSystem.VisSlots, self).__init__(cls, name)
+ super(CuminSystem.SystemSlotVisualization, self).__init__(cls, name)
- self.slot_set = self.ModelSystemSlotSet(cls.model.app, name)
+ self.itemset = self.ModelSystemSlotSet(cls.model.app, "slot")
- def get_xml_response(self, session, system, *args):
- slots = self.get_slots(session, system)
- writer = Writer()
- writer.write("<slots>")
- for slot in slots:
- writer.write("<slot id='%i' name='%s' machine='%s' job='%s' color='%s'/>" % \
- (slot["id"],
- slot["name"],
- slot["machine"],
- slot["job_id"],
- self.get_color(slot)))
- writer.write("</slots>")
- return writer.to_string()
-
- def get_slots(self, session, system):
- cursor = self.slot_set.do_get_items(session, system)
- slot_list = self.slot_set.cursor_to_rows(cursor)
- return slot_list
-
class ModelSystemSlotSet(SystemSlotSet):
def render_sql_limit(self, session, *args):
pass
def render_sql_orderby(self, session, *args):
- return "order by name asc"
-
- def get_color(self, slot):
- activity = slot["activity"]
- for status, color in self.load_colors:
- if status == activity:
- return color
- return "black"
-
- def get_colors(self):
- return self.load_colors
+ return "order by machine, name asc"
class SystemIdProperty(CuminProperty):
def value(self, session, object):
@@ -1841,43 +1869,6 @@
return Pool(coll)
get = classmethod(get)
-
-
-class Visualization(CuminAction):
- def __init__(self, cls, name, itemset):
- super(Visualization, self).__init__(cls, name)
-
- assert itemset
- self.itemset = itemset
-
- def get_xml_response(self, session, object, *args):
- boxes = self.get_boxes(session, object, *args)
- fields = self.get_field_tuples(session)
-
- writer = Writer()
- writer.write("<%ss>" % self.itemset.name)
- for box in boxes:
- writer.write("<%s id='%s'" % (self.itemset.name, str(box["id"])))
- for field, desc in fields:
- writer.write(" %s='%s'" % (field, box[field]))
- if fields:
- writer.write(" color='%s'/>" % self.get_color(box))
- writer.write("</%ss>" %self.itemset.name)
- return writer.to_string()
-
- def get_boxes(self, session, object, *args):
- if args:
- self.itemset.set_args(session, *args)
- cursor = self.itemset.get_items(session, object)
- box_list = self.itemset.cursor_to_rows(cursor)
- return box_list
-
- def get_color(self, box):
- return ""
-
- def get_colors(self):
- return list()
-
from job import JobSet
from pool import PoolSlotSet, PoolMachineSet
@@ -1907,7 +1898,7 @@
stat = self.JobsPercentStat(self, "Jobs")
stat.title = "Total Jobs"
- action = self.VisSlots(self, "slots")
+ action = self.PoolSlotVisualization(self, "slots")
action.navigable = False
action = self.VisMachine(self, "machines")
@@ -1999,33 +1990,22 @@
return "(job.deletion_time is not null and job_status = %i)" % \
JobStatusInfo.get_status_int("Idle")
- class VisSlots(Visualization):
- # list of status/colors in the order we want them displayed
- # in the legend
- load_colors = [("Idle", "clear"),
- ("Busy", "green"),
- ("Suspended", "red"),
- ("Vacating", "orange"),
- ("Killing", "blue"),
- ("Benchmarking", "yellow")]
-
+ class PoolSlotVisualization(SlotVisualization):
def __init__(self, cls, name):
- self.slot_set = self.ModelPoolSlotSet(cls.model.app, "slot")
- super(CuminPool.VisSlots, self).__init__(cls, name, self.slot_set)
+ super(CuminPool.PoolSlotVisualization, self).__init__(cls, name)
+
+ self.itemset = self.ModelPoolSlotSet(cls.model.app, "slot")
- def get_field_tuples(self, session):
- return [("name", "Name"), ("machine", "Machine"), ("job_id", "Job")]
-
def set_machine(self, session, machine):
- self.slot_set.set_machine(session, machine)
+ self.itemset.set_machine(session, machine)
def get_machine(self, session):
- return self.slot_set.get_machine(session)
+ return self.itemset.get_machine(session)
class ModelPoolSlotSet(PoolSlotSet):
def __init__(self, app, name):
- super(CuminPool.VisSlots.ModelPoolSlotSet, self).__init__(app, name)
-
+ super(CuminPool.PoolSlotVisualization.ModelPoolSlotSet, self).__init__(app, name)
+
self.__machine = None
def set_args(self, session, machine):
@@ -2042,33 +2022,24 @@
elems.append("s.pool = %(pool)s")
if self.__machine:
elems.append("machine = %(machine)s")
-
+
return "where %s" % " and ".join(elems)
-
+
def get_sql_values(self, session, pool):
values = {"pool": pool.id}
machine = self.__machine
if machine:
values["machine"] = machine
return values
-
+
def render_sql_limit(self, session, *args):
pass
def render_sql_orderby(self, session, *args):
- return "order by name asc"
+ return "order by machine, name asc"
+
- def get_color(self, slot):
- activity = slot["activity"]
- for status, color in self.load_colors:
- if status == activity:
- return color
- return "black"
-
- def get_colors(self):
- return self.load_colors
-
- class VisMachine(VisSlots):
+ class VisMachine(Visualization):
load_colors = [("Idle", "clear"),
("> 0%", "green"),
("> 25%", "yellow"),
@@ -2076,13 +2047,14 @@
("> 75%", "green3")]
def __init__(self, cls, name):
- machine_set = PoolMachineSet(cls.model.app, "machine")
- super(CuminPool.VisSlots, self).__init__(cls, name, machine_set)
+ super(CuminPool.VisMachine, self).__init__(cls, name)
+ self.itemset = PoolMachineSet(cls.model.app, "machine")
+
def get_field_tuples(self, session):
return [("machine", "Machine"), ("busy", "Busy Slots"), ("idle", "Idle Slots")]
- def get_color(self, machine):
+ def get_color(self, session, machine):
total = float(machine["total"])
busy = float(machine["busy"])
work = total > 0.0 and busy / total or 0.0
@@ -2093,6 +2065,9 @@
return self.load_colors[i][1]
return "black"
+ def get_colors(self):
+ return self.load_colors
+
class CuminLimit(CuminClass):
def __init__(self, model):
super(CuminLimit, self).__init__ \
@@ -2430,8 +2405,8 @@
return self.got_data
try:
- job.GetAd(self.model.data, completion, self.job_ads)
- except:
+ job.GetAd(self.model.data, completion, None)
+ except Exception, e:
return self.job_ads
# wait for up to 20 seconds for completion to be called
@@ -2819,8 +2794,8 @@
return self.got_data
try:
- negotiator.GetLimits(self.model.data, completion, self.lim)
- except:
+ negotiator.GetLimits(self.model.data, completion, None)
+ except Exception, e:
return self.lim
# wait for up to 5 seconds for completion to be called
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-11-15 22:34:09 UTC (rev 2808)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-15 22:36:31 UTC (rev 2809)
@@ -297,25 +297,18 @@
self.machine_param = Parameter(app, "machine_param")
self.add_parameter(self.machine_param)
- self.show_all_slots = self.ShowAllSlots(app, "show_all_slots")
+ self.show_all_slots = self.SlotSwitch(app, "show_all_slots")
self.add_child(self.show_all_slots)
- class ShowAllSlots(Widget):
- def render(self, session):
- if self.parent.slot_grid.get_machine(session):
- if self.parent.all_fits.get(session):
- return super(PoolStats.ShowAllSlots, self).render(session)
-
- def render_href(self, session):
- branch = session.branch()
- self.parent.machine_param.set(branch, None)
- return branch.marshal()
-
def process(self, session):
super(PoolStats, self).process(session)
+ all_slots = self.show_all_slots.get(session)
machine = self.machine_param.get(session)
all_fits = True
+ if all_slots == "a":
+ machine = None
+
if not machine:
self.slot_grid.set_machine(session, None)
all_fits = self.slot_grid.will_it_fit(session)
@@ -331,13 +324,18 @@
return "Statistics"
def render_slot_title(self, session):
+ pool = self.frame.get_args(session)[0]
machine = self.slot_grid.get_machine(session)
- return machine and "Slots on (%s)" % machine or "Slot Utilization"
+ return machine and "Slots on (%s)" % machine or "Slots on %s" % pool.name
def render_machine_title(self, session):
pool = self.frame.get_args(session)[0]
return "Machines on %s" % pool.name
+ def render_slot_job_url(self, session):
+ job = Identifiable("XXX")
+ return self.page.main.pool.job.get_href(session, job)
+
class SlotVisualization(StatUtilizationGrid):
def __init__(self, app, name):
super(PoolStats.SlotVisualization, self).__init__(app, name)
@@ -364,18 +362,13 @@
def get_color(self, session, job):
action = self.app.model.pool.slots
- return action.get_color(job)
+ return action.get_color(session, job)
def get_contents(self, session, slot):
return ""
def get_href(self, session, slot):
- branch = session.branch()
- try:
- job = Job.select("custom_id = '%s'" % slot.JobId)[0]
- except Exception, e:
- return "#"
- return self.page.main.pool.job.get_href(branch, job)
+ return "#"
def get_url(self, session):
pool = self.parent.frame.get_args(session)[0]
@@ -407,7 +400,7 @@
def get_color(self, session, machine):
action = self.app.model.pool.machines
- return action.get_color(machine)
+ return action.get_color(session, machine)
def get_contents(self, session, machine):
return ""
@@ -416,6 +409,7 @@
machine = data["machine"]
branch = session.branch()
self.parent.machine_param.set(branch, machine)
+ self.parent.show_all_slots.set(branch, "m")
return branch.marshal()
def get_url(self, session):
@@ -426,6 +420,19 @@
action = self.app.model.pool.machines
return action.get_field_tuples(session)
+ class SlotSwitch(StateSwitch):
+ def __init__(self, app, name):
+ super(PoolStats.SlotSwitch, self).__init__(app, name)
+
+ self.add_state("a", "All Slots in Pool", hover="Show all slots in this pool")
+ self.add_state("m", "Slots for This Machine", hover="Show slots in this machine only")
+ self.param.default = "m"
+
+ def render(self, session):
+ if self.parent.slot_grid.get_machine(session):
+ if self.parent.all_fits.get(session):
+ return super(PoolStats.SlotSwitch, self).render(session)
+
class PoolStatSet(StatSet):
def render_rate_text(self, session, args):
return "Percentage"
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-11-15 22:34:09 UTC (rev 2808)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-11-15 22:36:31 UTC (rev 2809)
@@ -44,6 +44,13 @@
div.vistats {
margin-bottom: 2em;
}
+div.vistats ul.radiotabs {
+ margin: 1em 0 0 1em;
+}
+div.machine_help {
+ color: #444;
+ font-size: 0.8em;
+}
[PoolStats.html]
<div style="width: 50%; float: left;">
@@ -55,6 +62,7 @@
<div style="float: left; margin-left: 4em;">
<div class="vistats">
<h2>{machine_title}</h2>
+ <div class="machine_help">Select a Machine to view its slots</div>
{machine_grid}
</div>
<div class="vistats">
@@ -64,6 +72,9 @@
</div>
</div>
<div style="clear:left;"><!-- --></div>
+<script type="text/javascript">
+var show_slot_job_url = "{slot_job_url}";
+</script>
[ShowAllSlots.html]
<ul class="actions" style="margin: 1em;">
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-11-15 22:34:09 UTC (rev 2808)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-11-15 22:36:31 UTC (rev 2809)
@@ -58,11 +58,15 @@
def render_title(self, session):
return "Statistics"
+ def render_slot_job_url(self, session):
+ job = Identifiable("XXX")
+ return self.page.main.pool.job.get_href(session, job)
+
class SlotUtilizationGrid(StatUtilizationGrid):
def get_cells(self, session):
system = self.frame.get_args(session)[0]
action = self.app.model.system.slots
- return action.get_slots(session, system)
+ return action.get_boxes(session, system)
def render_title(self, session):
return "Slot Utilization"
@@ -73,7 +77,7 @@
def get_color(self, session, slot):
action = self.app.model.system.slots
- return action.get_color(slot)
+ return action.get_color(session, slot)
def get_contents(self, session, slot):
return ""
@@ -139,7 +143,7 @@
def render_sql_where(self, session, system):
elems = list()
elems.append("machine = %(nodeName)s")
- elems.append("deletion_time is null")
+ elems.append("s.deletion_time is null")
return "where %s" % " and ".join(elems)
def get_sql_values(self, session, system):
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2008-11-15 22:34:09 UTC (rev 2808)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2008-11-15 22:36:31 UTC (rev 2809)
@@ -32,7 +32,13 @@
if (oslot_Button) {
oslot_Button.className = "btn "+slot.color;
oslot_Button.onmouseover = over_cell;
- oslot_Button.onmouseout = out_cell
+ oslot_Button.onmouseout = out_cell;
+ if (slot.jid == "None") {
+ oslot_Button.onclick = function() { return false; };
+ } else {
+ oslot_Button.job = slot.jid;
+ oslot_Button.onclick = show_slot_job;
+ }
}
var oslot_Name = document.getElementById("cell_name_"+cell);
if (oslot_Name) {
@@ -42,14 +48,28 @@
if (oslot_Machine) {
oslot_Machine.innerHTML = slot.machine;
}
- var oslot_Job = document.getElementById("cell_job_"+cell);
+ var oslot_Job = document.getElementById("cell_job_id_"+cell);
if (oslot_Job) {
- oslot_Job.innerHTML = slot.job;
+ oslot_Job.innerHTML = slot.job_id;
}
}
- setTimeout("get_slot_grid()", 1000);
+ setTimeout("get_slot_grid()", 2500);
}
+function show_slot_job() {
+ if ( typeof show_slot_job_url != "undefined" ) {
+ var url = show_slot_job_url.replace("XXX", this.job);
+ window.location.href = url;
+ }
+ return false;
+}
+[SystemStats.html]
+{slot_grid}
+<script type="text/javascript">
+var show_slot_job_url = "{slot_job_url}";
+</script>
+
+
[SystemJobSet.html]
<div class="rfloat">{phase}</div>
<form id="{id}" style="clear:right;" method="post" action="?">
16 years, 1 month
rhmessaging commits: r2808 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-15 17:34:09 -0500 (Sat, 15 Nov 2008)
New Revision: 2808
Modified:
mgmt/trunk/cumin/python/cumin/slot.strings
Log:
Added a join to job.custom_id so clicking on a slot vis can show the job.
Modified: mgmt/trunk/cumin/python/cumin/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.strings 2008-11-15 22:24:26 UTC (rev 2807)
+++ mgmt/trunk/cumin/python/cumin/slot.strings 2008-11-15 22:34:09 UTC (rev 2808)
@@ -5,10 +5,12 @@
s.machine,
s.system,
s.job_id,
+ j.id as jid,
c.activity
from slot as s
left outer join slot_stats as c on c.id = s.stats_curr_id
left outer join slot_stats as p on p.id = s.stats_prev_id
+left outer join job as j on j.custom_id = s.job_id
{sql_where}
{sql_orderby}
{sql_limit}
16 years, 1 month