rhmessaging commits: r1815 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-31 15:42:02 -0400 (Mon, 31 Mar 2008)
New Revision: 1815
Modified:
mgmt/cumin/python/cumin/system.py
mgmt/cumin/python/cumin/system.strings
Log:
Flesh out the system view with all the currently available system
attributes.
Modified: mgmt/cumin/python/cumin/system.py
===================================================================
--- mgmt/cumin/python/cumin/system.py 2008-03-31 16:35:32 UTC (rev 1814)
+++ mgmt/cumin/python/cumin/system.py 2008-03-31 19:42:02 UTC (rev 1815)
@@ -72,6 +72,21 @@
def render_title(self, session, system):
return "System '%s'" % system.sysId
+ def render_address(self, session, system):
+ return system.nodeName
+
+ def render_kernel(self, session, system):
+ return system.osName
+
+ def render_kernel_release(self, session, system):
+ return system.release
+
+ def render_kernel_version(self, session, system):
+ return system.version
+
+ def render_architecture(self, session, system):
+ return system.machine
+
def render_created_deleted(self, session, system):
return "%s – %s" % (fmt_datetime(system.creationTime),
fmt_datetime(system.deletionTime))
Modified: mgmt/cumin/python/cumin/system.strings
===================================================================
--- mgmt/cumin/python/cumin/system.strings 2008-03-31 16:35:32 UTC (rev 1814)
+++ mgmt/cumin/python/cumin/system.strings 2008-03-31 19:42:02 UTC (rev 1815)
@@ -28,6 +28,10 @@
<h1><img src="resource?name=system-36.png"/>{title}</h1>
<table class="props">
+ <tr><th>Address</th><td>{address}</td></tr>
+ <tr><th>Kernel</th><td>{kernel} {kernel_release}<br/>{kernel_version}</td></tr>
+ <tr><th>Architecture</th><td>{architecture}</td></tr>
+ <tr><th>Updated</th><td>{updated}</td></tr>
<tr><th>Created – Deleted</th><td>{created_deleted}</td></tr>
<tr><th>Updated</th><td>{updated}</td></tr>
</table>
16 years, 8 months
rhmessaging commits: r1814 - in mgmt/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-31 12:35:32 -0400 (Mon, 31 Mar 2008)
New Revision: 1814
Modified:
mgmt/mint/python/mint/schema.py
mgmt/mint/python/mint/schemaparser.py
mgmt/mint/sql/schema.sql
Log:
Update the sql schema. Work around an object attr collision for managementagent.id
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2008-03-31 16:04:54 UTC (rev 1813)
+++ mgmt/mint/python/mint/schema.py 2008-03-31 16:35:32 UTC (rev 1814)
@@ -14,6 +14,11 @@
statsCurr = ForeignKey('SystemStats', cascade='null', default=None)
statsPrev = ForeignKey('SystemStats', cascade='null', default=None)
sysId = StringCol(length=1000, default=None)
+ osName = StringCol(length=1000, default=None)
+ nodeName = StringCol(length=1000, default=None)
+ release = StringCol(length=1000, default=None)
+ version = StringCol(length=1000, default=None)
+ machine = StringCol(length=1000, default=None)
classInfos = dict() # brokerId => classInfo
@@ -24,11 +29,6 @@
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
system = ForeignKey('System', cascade='null', default=None)
- osName = StringCol(length=1000, default=None)
- nodeName = StringCol(length=1000, default=None)
- release = StringCol(length=1000, default=None)
- version = StringCol(length=1000, default=None)
- machine = StringCol(length=1000, default=None)
classInfos = dict() # brokerId => classInfo
@@ -111,6 +111,34 @@
Broker.sqlmeta.addJoin(SQLMultipleJoin('BrokerStats', joinMethodName='stats'))
+class Agent(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ idOriginal = BigIntCol(default=None)
+ recTime = TimestampCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('AgentStats', cascade='null', default=None)
+ statsPrev = ForeignKey('AgentStats', cascade='null', default=None)
+ id_ = StringCol(default=None)
+
+ classInfos = dict() # brokerId => classInfo
+
+class AgentStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ idOriginal = BigIntCol(default=None)
+ recTime = TimestampCol(default=None)
+ agent = ForeignKey('Agent', cascade='null', default=None)
+
+ classInfos = dict() # brokerId => classInfo
+
+Agent.sqlmeta.addJoin(SQLMultipleJoin('AgentStats', joinMethodName='stats'))
+
+
class Vhost(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -368,6 +396,7 @@
statsPrev = ForeignKey('LinkStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
address = StringCol(length=1000, default=None)
+ authIdentity = StringCol(length=1000, default=None)
classInfos = dict() # brokerId => classInfo
@@ -402,7 +431,6 @@
recTime = TimestampCol(default=None)
link = ForeignKey('Link', cascade='null', default=None)
closing = BoolCol(default=None)
- authIdentity = StringCol(length=1000, default=None)
framesFromPeer = BigIntCol(default=None)
framesToPeer = BigIntCol(default=None)
bytesFromPeer = BigIntCol(default=None)
@@ -673,6 +701,8 @@
schemaNameToClassMap['system'] = System
classToSchemaNameMap['Broker'] = 'broker'
schemaNameToClassMap['broker'] = Broker
+classToSchemaNameMap['Agent'] = 'agent'
+schemaNameToClassMap['agent'] = Agent
classToSchemaNameMap['Vhost'] = 'vhost'
schemaNameToClassMap['vhost'] = Vhost
classToSchemaNameMap['Queue'] = 'queue'
Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py 2008-03-31 16:04:54 UTC (rev 1813)
+++ mgmt/mint/python/mint/schemaparser.py 2008-03-31 16:35:32 UTC (rev 1814)
@@ -22,6 +22,7 @@
# see xml/MintTypes.xml
self.dataTypesMap = dict()
self.dataTypesMap["objId"] = "ForeignKey"
+ self.dataTypesMap["uuid"] = "StringCol"
self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] = self.dataTypesMap["count8"] = self.dataTypesMap["mma8"] = "SmallIntCol"
self.dataTypesMap["uint16"] = self.dataTypesMap["hilo16"] = self.dataTypesMap["count16"] = self.dataTypesMap["mma16"] = "SmallIntCol"
self.dataTypesMap["uint32"] = self.dataTypesMap["hilo32"] = self.dataTypesMap["count32"] = self.dataTypesMap["mma32"] = "IntCol"
@@ -39,6 +40,8 @@
params = "default=None"
else:
params += ", default=None"
+ if attribName == "id":
+ attribName = "id_"
self.pythonOutput += " %s = %s(%s)\n" % (attribName, attribType, params)
def generateTimestampAttrib(self, col):
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-03-31 16:04:54 UTC (rev 1813)
+++ mgmt/mint/sql/schema.sql 2008-03-31 16:35:32 UTC (rev 1814)
@@ -50,6 +50,25 @@
version VARCHAR(1000) NOT NULL
);
+CREATE TABLE agent (
+ id SERIAL PRIMARY KEY,
+ id_original BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ id_ TEXT
+);
+
+CREATE TABLE agent_stats (
+ id SERIAL PRIMARY KEY,
+ id_original BIGINT,
+ rec_time TIMESTAMP,
+ agent_id INT
+);
+
CREATE TABLE binding (
id SERIAL PRIMARY KEY,
id_original BIGINT,
@@ -245,7 +264,8 @@
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
- address VARCHAR(1000)
+ address VARCHAR(1000),
+ auth_identity VARCHAR(1000)
);
CREATE TABLE link_stats (
@@ -254,7 +274,6 @@
rec_time TIMESTAMP,
link_id INT,
closing BOOL,
- auth_identity VARCHAR(1000),
frames_from_peer BIGINT,
frames_to_peer BIGINT,
bytes_from_peer BIGINT,
@@ -384,19 +403,19 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
- sys_id VARCHAR(1000)
+ sys_id VARCHAR(1000),
+ os_name VARCHAR(1000),
+ node_name VARCHAR(1000),
+ release VARCHAR(1000),
+ version VARCHAR(1000),
+ machine VARCHAR(1000)
);
CREATE TABLE system_stats (
id SERIAL PRIMARY KEY,
id_original BIGINT,
rec_time TIMESTAMP,
- system_id INT,
- os_name VARCHAR(1000),
- node_name VARCHAR(1000),
- release VARCHAR(1000),
- version VARCHAR(1000),
- machine VARCHAR(1000)
+ system_id INT
);
CREATE TABLE vhost (
@@ -429,6 +448,12 @@
ALTER TABLE broker_registration ADD CONSTRAINT profile_id_exists FOREIGN KEY (profile_id) REFERENCES broker_profile (id) ON DELETE SET NULL;
+ALTER TABLE agent ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES agent_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE agent ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES agent_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE agent_stats ADD CONSTRAINT agent_id_exists FOREIGN KEY (agent_id) REFERENCES agent (id) ON DELETE SET NULL;
+
ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
16 years, 8 months
rhmessaging commits: r1813 - mgmt.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-03-31 12:04:54 -0400 (Mon, 31 Mar 2008)
New Revision: 1813
Modified:
mgmt/Makefile
mgmt/cumin.spec
Log:
create user cumin for rpm install; fix unpackaged files error; add tar.gz creation to makefile
Modified: mgmt/Makefile
===================================================================
--- mgmt/Makefile 2008-03-31 14:34:29 UTC (rev 1812)
+++ mgmt/Makefile 2008-03-31 16:04:54 UTC (rev 1813)
@@ -1,3 +1,5 @@
+version := 0.1
+
.PHONY: help dist clean cumin mint
help:
@@ -21,6 +23,7 @@
cp -a cumin/resources/* dist/resources
cp -a cumin/etc/* dist/etc
cp LICENSE COPYING dist/doc
+ tar -cvzf cumin-${version}.tar.gz dist
cumin: mint
cd cumin && make install
Modified: mgmt/cumin.spec
===================================================================
--- mgmt/cumin.spec 2008-03-31 14:34:29 UTC (rev 1812)
+++ mgmt/cumin.spec 2008-03-31 16:04:54 UTC (rev 1813)
@@ -1,7 +1,7 @@
Summary: management component of MRG
Name: cumin
Version: 0.1
-Release: 5%{?dist}
+Release: 6%{?dist}
License: LGPL
Group: System Environment/Libraries
URL: http://redhat.com/mrg
@@ -29,6 +29,13 @@
%{!?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
@@ -69,16 +76,19 @@
rm -rf $RPM_BUILD_ROOT
%files
-%defattr(-,root,root,-)
+%defattr(-,cumin,cumin,-)
%doc doc/*
%{_bindir}/cumin*
-%{_sysconfdir}/cumin.conf
+%{_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
16 years, 8 months
rhmessaging commits: r1812 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-31 10:34:29 -0400 (Mon, 31 Mar 2008)
New Revision: 1812
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
Remove an obsolete import
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-28 20:39:30 UTC (rev 1811)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-31 14:34:29 UTC (rev 1812)
@@ -1,5 +1,4 @@
from datetime import datetime, timedelta
-from math import ceil
from sqlobject import sqlhub
from sqlobject.sresults import SelectResults
from wooly import *
16 years, 8 months
rhmessaging commits: r1811 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-03-28 16:39:30 -0400 (Fri, 28 Mar 2008)
New Revision: 1811
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/BdbMessageStore.h
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
Log:
Bugfix for BZ439499 - C++ broker fails JMS TCK when started in daemon mode. Changed static Timer instance into static timer pointer instance, and initialized the timer if required during JournalImpl construction. Also changed remaining messages sent to cout in BdbMessageStore to use QPID_LOG instead.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-28 19:47:15 UTC (rev 1810)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-28 20:39:30 UTC (rev 1811)
@@ -26,6 +26,7 @@
#include <qpid/broker/Message.h>
#include <qpid/framing/Buffer.h>
#include <qpid/log/Statement.h>
+#include <qpid/sys/Mutex.h>
#include <algorithm>
#include <iomanip>
#include <sstream>
@@ -127,12 +128,12 @@
if (numJrnlFiles < JRNL_MIN_NUM_FILES)
{
numJrnlFiles = JRNL_MIN_NUM_FILES;
- std::cout << "WARNING: parameter num-jfiles (" << opts->numJrnlFiles << ") below allowable minimum (" << numJrnlFiles << "); changing this parameter to minimum value." << std::endl;
+ QPID_LOG(warning, "parameter num-jfiles (" << opts->numJrnlFiles << ") below allowable minimum (" << numJrnlFiles << "); changing this parameter to minimum value.");
}
else if (numJrnlFiles > 64)
{
numJrnlFiles = 64;
- std::cout << "WARNING: parameter num-jfiles (" << opts->numJrnlFiles << ") above allowable maximum (" << numJrnlFiles << "); changing this parameter to maximum value." << std::endl;
+ QPID_LOG(warning, "parameter num-jfiles (" << opts->numJrnlFiles << ") above allowable maximum (" << numJrnlFiles << "); changing this parameter to maximum value.");
}
u_int32_t jrnlFsizePgs = opts->jrnlFsizePgs;
@@ -140,12 +141,12 @@
if (jrnlFsizePgs < jrnlMinFsizePgs)
{
jrnlFsizePgs = jrnlMinFsizePgs;
- std::cout << "WARNING: parameter jfile-size-pgs (" << opts->jrnlFsizePgs << ") below allowable minimum (" << jrnlFsizePgs << "); changing this parameter to minimum value." << std::endl;
+ QPID_LOG(warning, "parameter jfile-size-pgs (" << opts->jrnlFsizePgs << ") below allowable minimum (" << jrnlFsizePgs << "); changing this parameter to minimum value.");
}
else if (jrnlFsizePgs > 1024) // (pgs) = 64MiB max file size
{
jrnlFsizePgs = 1024;
- std::cout << "WARNING: parameter jfile-size-pgs (" << opts->jrnlFsizePgs << ") above allowable maximum (" << jrnlFsizePgs << "); changing this parameter to maximum value." << std::endl;
+ QPID_LOG(warning, "parameter jfile-size-pgs (" << opts->jrnlFsizePgs << ") above allowable maximum (" << jrnlFsizePgs << "); changing this parameter to maximum value.");
}
return init(opts->storeDir, opts->storeAsync, opts->storeForce, numJrnlFiles, jrnlFsizePgs);
@@ -246,7 +247,11 @@
THROW_STORE_EXCEPTION("Queue already created: " + queue.getName());
}
if (usingJrnl()) {
- JournalImpl* jQueue = new JournalImpl(queue.getName(), getJrnlDir(queue), string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE, defJournalGetEventsTimeout, defJournalFlushTimeout);
+ JournalImpl* jQueue = 0;
+ {
+ qpid::sys::Mutex::ScopedLock sl(jrnlCreateLock);
+ jQueue = new JournalImpl(queue.getName(), getJrnlDir(queue), string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE, defJournalGetEventsTimeout, defJournalFlushTimeout);
+ }
queue.setExternalQueueStore(dynamic_cast<ExternalQueueStore*>(jQueue));
try {
// init will create the deque's for the init...
@@ -414,7 +419,11 @@
if (usingJrnl())
{
const char* queueName = queue->getName().c_str();
- JournalImpl* jQueue = new JournalImpl(queueName, getJrnlDir(queueName), string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE, defJournalGetEventsTimeout, defJournalFlushTimeout);
+ JournalImpl* jQueue = 0;
+ {
+ qpid::sys::Mutex::ScopedLock sl(jrnlCreateLock);
+ jQueue = new JournalImpl(queueName, getJrnlDir(queueName), string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE, defJournalGetEventsTimeout, defJournalFlushTimeout);
+ }
queue->setExternalQueueStore(dynamic_cast<ExternalQueueStore*>(jQueue));
try
@@ -474,7 +483,7 @@
while (bindings.next(key, value)) {
Buffer buffer(reinterpret_cast<char*>(value.get_data()), value.get_size());
if (buffer.available() < 8) {
- std::cout << "Not enough data for binding: " << buffer.available() << std::endl;
+ QPID_LOG(error, "Not enough data for binding: " << buffer.available());
THROW_STORE_EXCEPTION("Not enough data for binding");
}
uint64_t queueId = buffer.getLongLong();
@@ -1209,7 +1218,7 @@
txn.complete(commit);
} catch (const std::exception& e) {
- std::cout << "Error completing xid " << txn.getXid() << ": " << e.what() << std::endl;
+ QPID_LOG(error, "Error completing xid " << txn.getXid() << ": " << e.what());
txn.abort();
throw;
}
Modified: store/trunk/cpp/lib/BdbMessageStore.h
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.h 2008-03-28 19:47:15 UTC (rev 1810)
+++ store/trunk/cpp/lib/BdbMessageStore.h 2008-03-28 20:39:30 UTC (rev 1811)
@@ -87,6 +87,7 @@
const char* envPath;
static qpid::sys::Duration defJournalGetEventsTimeout;
static qpid::sys::Duration defJournalFlushTimeout;
+ qpid::sys::Mutex jrnlCreateLock;
bool mode(const bool mode, const bool force);
void recoverQueues(TxnCtxt& txn, qpid::broker::RecoveryManager& recovery, queue_index& index,
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-03-28 19:47:15 UTC (rev 1810)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-03-28 20:39:30 UTC (rev 1811)
@@ -32,7 +32,7 @@
using namespace rhm::bdbstore;
using namespace rhm::journal;
-qpid::broker::Timer JournalImpl::journalTimer;
+qpid::broker::Timer* JournalImpl::journalTimerPtr = 0;
void InactivityFireEvent::fire() { if (parent) parent->flushFire(); }
void GetEventsFireEvent::fire() {
@@ -60,8 +60,11 @@
::pthread_mutex_init(&_getf_mutex, 0);
getEventsFireEventsPtr = new GetEventsFireEvent(this, getEventsTimeout);
inactivityFireEventPtr = new InactivityFireEvent(this, flushTimeout);
- journalTimer.start();
- journalTimer.add(inactivityFireEventPtr);
+ if (journalTimerPtr == 0)
+ journalTimerPtr = new qpid::broker::Timer;
+ assert (journalTimerPtr != 0);
+ journalTimerPtr->start();
+ journalTimerPtr->add(inactivityFireEventPtr);
}
JournalImpl::~JournalImpl()
@@ -269,7 +272,8 @@
}
}
inactivityFireEventPtr->reset();
- journalTimer.add(inactivityFireEventPtr);
+ assert(journalTimerPtr != 0);
+ journalTimerPtr->add(inactivityFireEventPtr);
}
void
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2008-03-28 19:47:15 UTC (rev 1810)
+++ store/trunk/cpp/lib/JournalImpl.h 2008-03-28 20:39:30 UTC (rev 1811)
@@ -66,7 +66,7 @@
class JournalImpl : public qpid::broker::ExternalQueueStore, public journal::jcntl
{
private:
- static qpid::broker::Timer journalTimer;
+ static qpid::broker::Timer* journalTimerPtr;
bool getEventsTimerSetFlag;
boost::intrusive_ptr<qpid::broker::TimerTask> getEventsFireEventsPtr;
@@ -146,7 +146,8 @@
inline void setGetEventTimer()
{
getEventsFireEventsPtr->addRef();
- journalTimer.add(getEventsFireEventsPtr);
+ assert(journalTimerPtr != 0);
+ journalTimerPtr->add(getEventsFireEventsPtr);
getEventsTimerSetFlag = true;
}
void handleIoResult(const journal::iores r);
16 years, 9 months
rhmessaging commits: r1810 - in store/trunk/cpp: tests and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2008-03-28 15:47:15 -0400 (Fri, 28 Mar 2008)
New Revision: 1810
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/BdbMessageStore.h
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/persistence.py
Log:
Unbind using binding key only.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-27 21:43:45 UTC (rev 1809)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-03-28 19:47:15 UTC (rev 1810)
@@ -339,21 +339,10 @@
}
void BdbMessageStore::unbind(const PersistableExchange& e, const PersistableQueue& q,
- const std::string& k, const FieldTable& a)
+ const std::string& k, const FieldTable&)
{
checkInit();
- IdDbt key(e.getPersistenceId());
- BindingDbt value(e, q, k, a);
-
- TxnCtxt txn;
- txn.begin(env, true);
-
- if (deleteKeyValuePair(bindingDb, txn.get(), key, value)) {
- txn.commit();
- } else {
- txn.abort();
- THROW_STORE_EXCEPTION("Can't find binding");
- }
+ deleteBinding(e, q, k);
}
void BdbMessageStore::recover(RecoveryManager& registry)
@@ -1365,6 +1354,40 @@
QPID_LOG(debug, "Deleted all bindings for " << queue.getName() << ":" << queue.getPersistenceId());
}
+void BdbMessageStore::deleteBinding(const PersistableExchange& exchange, const PersistableQueue& queue, const std::string& bkey)
+{
+ TxnCtxt txn;
+ txn.begin(env, true);
+ try {
+ Cursor bindings;
+ bindings.open(bindingDb, txn.get());
+
+ IdDbt key(exchange.getPersistenceId());
+ Dbt value;
+
+ for (int status = bindings->get(&key, &value, DB_SET); status == 0; status = bindings->get(&key, &value, DB_NEXT_DUP)) {
+ Buffer buffer(reinterpret_cast<char*>(value.get_data()), value.get_size());
+ if (buffer.available() < 8) {
+ THROW_STORE_EXCEPTION("Not enough data for binding");
+ }
+ uint64_t queueId = buffer.getLongLong();
+ if (queue.getPersistenceId() == queueId) {
+ std::string q;
+ std::string k;
+ buffer.getShortString(q);
+ buffer.getShortString(k);
+ if (bkey == k) {
+ bindings->del(0);
+ QPID_LOG(debug, "Deleting binding for " << queue.getName() << " " << key.id << "->" << queueId);
+ }
+ }
+ }
+ } catch (const std::exception& e) {
+ THROW_STORE_EXCEPTION_2("Error deleting bindings", e.what());
+ }
+ txn.commit();
+}
+
string BdbMessageStore::getJrnlBaseDir()
{
std::stringstream dir;
Modified: store/trunk/cpp/lib/BdbMessageStore.h
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.h 2008-03-27 21:43:45 UTC (rev 1809)
+++ store/trunk/cpp/lib/BdbMessageStore.h 2008-03-28 19:47:15 UTC (rev 1810)
@@ -123,6 +123,9 @@
void completed(TPCTxnCtxt& txn, Db& discard, Db& apply, bool commit);
void record2pcOp(Db& db, TPCTxnCtxt& txn, u_int64_t messageId, u_int64_t queueId);
void deleteBindingsForQueue(const qpid::broker::PersistableQueue& queue);
+ void deleteBinding(const qpid::broker::PersistableExchange& exchange,
+ const qpid::broker::PersistableQueue& queue,
+ const std::string& key);
u_int64_t getRecordSize(Db& db, Dbt& key);
u_int64_t getRecordSize(DbTxn* txn, Db& db, Dbt& key);
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2008-03-27 21:43:45 UTC (rev 1809)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2008-03-28 19:47:15 UTC (rev 1810)
@@ -467,12 +467,9 @@
}
}
-void testExchangeBindAndUnbind(bool async)
+void bindAndUnbind(const string& exchangeName, const string& queueName,
+ const string& key, const FieldTable& args, bool async)
{
- string exchangeName("MyDurableExchange");
- string queueName("MyDurableQueue");
- string key("my-routing-key");
- FieldTable args;
{
BdbMessageStore store;
store.init(TESTDIR, async, true, 4, 1);
@@ -513,6 +510,19 @@
}
}
+void testExchangeBindAndUnbind(bool async)
+{
+ bindAndUnbind("MyDurableExchange", "MyDurableQueue", "my-routing-key", FieldTable(), async);
+}
+
+void testExchangeBindAndUnbindWithArgs(bool async)
+{
+ FieldTable args;
+ args.setString("a", "A");
+ args.setString("b", "B");
+ bindAndUnbind("MyDurableExchange", "MyDurableQueue", "my-routing-key", args, async);
+}
+
void testExchangeImplicitUnbind(bool async)
{
string exchangeName("MyDurableExchange");
@@ -742,6 +752,20 @@
cout << "ok" << endl;
}
+QPID_AUTO_TEST_CASE(ExchangeBindAndUnbindWithArgsSync)
+{
+ cout << test_filename << ".ExchangeBindAndUnbindWithArgsSync: " << flush;
+ testExchangeBindAndUnbindWithArgs(false);
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(ExchangeBindAndUnbindWithArgsAsync)
+{
+ cout << test_filename << ".ExchangeBindAndUnbindWithArgsAsync: " << flush;
+ testExchangeBindAndUnbindWithArgs(true);
+ cout << "ok" << endl;
+}
+
QPID_AUTO_TEST_CASE(ExchangeImplicitUnbindSync)
{
cout << test_filename << ".ExchangeImplicitUnbindSync: " << flush;
Modified: store/trunk/cpp/tests/persistence.py
===================================================================
--- store/trunk/cpp/tests/persistence.py 2008-03-27 21:43:45 UTC (rev 1809)
+++ store/trunk/cpp/tests/persistence.py 2008-03-28 19:47:15 UTC (rev 1810)
@@ -24,6 +24,7 @@
from getopt import getopt, GetoptError
import qpid.client, qpid.spec, qpid.content, qpid.testlib
from qpid.client import Closed
+from qpid.queue import Empty
from qpid.content import Content
from struct import *
from time import sleep
@@ -287,9 +288,68 @@
channel.message_transfer(destination= "amq.topic", content=Content(properties={'routing_key' : "xyz", 'delivery_mode':2}, body = "my-message"))
channel.queue_delete(queue = "durable-subscriber-queue")
+ #test unbind:
+ #create a series of bindings to a queue
+ channel.queue_declare(queue = "binding-test-queue", durable=True)
+ channel.queue_bind(exchange="amq.direct", queue="binding-test-queue", routing_key="abc")
+ channel.queue_bind(exchange="amq.direct", queue="binding-test-queue", routing_key="pqr")
+ channel.queue_bind(exchange="amq.direct", queue="binding-test-queue", routing_key="xyz")
+ channel.queue_bind(exchange="amq.match", queue="binding-test-queue", routing_key="a", arguments={"x-match":"all", "p":"a"})
+ channel.queue_bind(exchange="amq.match", queue="binding-test-queue", routing_key="b", arguments={"x-match":"all", "p":"b"})
+ channel.queue_bind(exchange="amq.match", queue="binding-test-queue", routing_key="c", arguments={"x-match":"all", "p":"c"})
+ #then restart broker...
+
+
def phase8(self):
channel = self.channel
+ #continue testing unbind:
+ #send messages to the queue via each of the bindings
+ for k in ["abc", "pqr", "xyz"]:
+ data = "first %s" % (k)
+ channel.message_transfer(destination= "amq.direct", content=Content(data, properties={'routing_key': k,'delivery_mode':2}))
+ for a in [{"p":"a"}, {"p":"b"}, {"p":"c"}]:
+ data = "first %s" % (a["p"])
+ channel.message_transfer(destination="amq.match", content=Content(data, properties={'application_headers':a }))
+ #unbind some bindings (using final 0-10 semantics)
+ channel.queue_unbind(exchange="amq.direct", queue="binding-test-queue", routing_key="pqr")
+ channel.queue_unbind(exchange="amq.match", queue="binding-test-queue", routing_key="b")
+ #send messages again
+ for k in ["abc", "pqr", "xyz"]:
+ data = "second %s" % (k)
+ channel.message_transfer(destination= "amq.direct", content=Content(data, properties={'routing_key': k,'delivery_mode':2}))
+ for a in [{"p":"a"}, {"p":"b"}, {"p":"c"}]:
+ data = "second %s" % (a["p"])
+ channel.message_transfer(destination="amq.match", content=Content(data, properties={'application_headers':a }))
+
+ #check that only the correct messages are received
+ expected = []
+ for k in ["abc", "pqr", "xyz"]:
+ expected.append("first %s" % (k))
+ for a in [{"p":"a"}, {"p":"b"}, {"p":"c"}]:
+ expected.append("first %s" % (a["p"]))
+ for k in ["abc", "xyz"]:
+ expected.append("second %s" % (k))
+ for a in [{"p":"a"}, {"p":"c"}]:
+ expected.append("second %s" % (a["p"]))
+
+ channel.message_subscribe(queue = "binding-test-queue", destination = "binding-test")
+ channel.message_flow(unit = 1, value = 0xFFFFFFFF, destination = "binding-test")
+ channel.message_flow(unit = 0, value = 10, destination = "binding-test")
+ queue = self.client.queue("binding-test")
+
+ while len(expected):
+ msg = queue.get(timeout=1)
+ if msg.content.body not in expected:
+ self.fail("Missing message: %s" % msg.content.body)
+ expected.remove(msg.content.body)
+ try:
+ msg = queue.get(timeout=1)
+ self.fail("Got extra message: %s" % msg.content.body)
+ except Empty: pass
+
+
+
channel.queue_declare(queue = "durable-subscriber-queue", exclusive=True, durable=True)
channel.queue_bind(exchange="amq.topic", queue="durable-subscriber-queue", routing_key="xyz")
channel.message_transfer(destination= "amq.topic", content=Content(properties={'routing_key' : "xyz", 'delivery_mode':2}, body = "my-message"))
16 years, 9 months
rhmessaging commits: r1809 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-03-27 17:43:45 -0400 (Thu, 27 Mar 2008)
New Revision: 1809
Modified:
mgmt/mint/python/mint/__init__.py
Log:
Use more streamlined management API, fixed some typos
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-03-27 20:17:14 UTC (rev 1808)
+++ mgmt/mint/python/mint/__init__.py 2008-03-27 21:43:45 UTC (rev 1809)
@@ -194,13 +194,8 @@
self.model.connections[self.key] = self
self.client.start({})
- self.mchan = managementChannel(self.client.channel(1),
- self.mclient.topicCb,
- self.mclient.replyCb,
- self.key)
+ self.mchan = self.mclient.addChannel (self.client.channel(1), self.key)
- self.mclient.addChannel(self.mchan)
-
self.state = "opened"
except Exception, e:
self.exception = e
@@ -325,7 +320,7 @@
try:
obj.set(**d)
except TypeError, detail:
- self.log("Schema mismatch: %s" % details)
+ self.log("Schema mismatch: %s" % detail)
obj.syncUpdate()
self.log("END CONFIG---------------------------------------------------\n")
@@ -348,7 +343,7 @@
try:
objStats.set(**d)
except TypeError, detail:
- self.log("Schema mismatch: %s" % details)
+ self.log("Schema mismatch: %s" % detail)
objStats.syncUpdate()
d = dict()
@@ -360,7 +355,7 @@
try:
obj.set(**d)
except TypeError, detail:
- self.log("Schema mismatch: %s" % details)
+ self.log("Schema mismatch: %s" % detail)
obj.syncUpdate()
self.log("END INST---------------------------------------------------\n")
16 years, 9 months
rhmessaging commits: r1808 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 16:17:14 -0400 (Thu, 27 Mar 2008)
New Revision: 1808
Modified:
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/widgets.py
mgmt/cumin/python/wooly/widgets.strings
Log:
Move Paginator from cumin to wooly
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-27 18:51:34 UTC (rev 1807)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-27 20:17:14 UTC (rev 1808)
@@ -305,124 +305,6 @@
return sql
-class Paginator(ItemSet):
- def __init__(self, app, name):
- super(Paginator, self).__init__(app, name)
-
- self.__page = IntegerParameter(app, "page")
- self.__page.default = 0
- self.add_parameter(self.__page)
-
- self.__pageset = IntegerParameter(app, "pageset")
- self.__pageset.default = 0
- self.add_parameter(self.__pageset)
-
- self.__count = Attribute(app, "count")
- self.add_attribute(self.__count)
-
- self.page_size = 15
- self.pageset_size = 5
-
- def get_bounds(self, session):
- page = self.__page.get(session)
- return self.page_size * page, self.page_size * (page + 1)
-
- def get_pageset_bounds(self, session):
- pageset = self.__pageset.get(session)
- return self.pageset_size * pageset, self.pageset_size * (pageset + 1)
-
- def set_count(self, session, count):
- return self.__count.set(session, count)
-
- def get_count(self, session):
- return self.__count.get(session)
-
- def get_page_count(self, session):
- count = self.get_count(session)
- return int(ceil(count / float(self.page_size)))
-
- def get_pageset_count(self, session):
- page_count = self.get_page_count(session)
- return int(ceil(page_count / float(self.pageset_size)))
-
- def render_prev_page_link(self, session, *args):
- page = self.__page.get(session)
-
- if page < 1:
- html = fmt_link(session.marshal(), "<", "pagenav disabled")
- else:
- page -= 1
- pageset_start = self.get_pageset_bounds(session)[0]
-
- branch = session.branch()
- self.__page.set(branch, page)
- if page < pageset_start:
- self.__pageset.set(branch, self.__pageset.get(session) - 1)
- html = fmt_link(branch.marshal(), "<", "pagenav")
-
- return html
-
- def render_next_page_link(self, session, *args):
- page = self.__page.get(session)
-
- if page >= self.get_page_count(session) - 1:
- html = fmt_link(session.marshal(), ">", "pagenav disabled")
- else:
- page += 1
- pageset_end = self.get_pageset_bounds(session)[1]
-
- branch = session.branch()
- self.__page.set(branch, page)
- if page >= pageset_end: # XXX should be >? bounds func is funny
- self.__pageset.set(branch, self.__pageset.get(session) + 1)
- html = fmt_link(branch.marshal(), ">", "pagenav")
-
- return html
-
- def render_prev_pageset_link(self, session, *args):
- pageset = self.__pageset.get(session)
-
- if pageset < 1:
- html = fmt_link(session.marshal(), "<<", "pagenav disabled")
- else:
- branch = session.branch()
- self.__pageset.set(branch, pageset - 1)
- html = fmt_link(branch.marshal(), "<<", "pagenav")
-
- return html
-
- def render_next_pageset_link(self, session, *args):
- pageset = self.__pageset.get(session)
-
- if pageset >= self.get_pageset_count(session) - 1:
- html = fmt_link(session.marshal(), ">>", "pagenav disabled")
- else:
- branch = session.branch()
- self.__pageset.set(branch, pageset + 1)
- html = fmt_link(branch.marshal(), ">>", "pagenav")
-
- return html
-
- def do_get_items(self, session, *args):
- count = self.__count.get(session)
-
- start, end = self.get_pageset_bounds(session)
- page_count = self.get_page_count(session)
-
- return range(start, min(end, page_count))
-
- def render_item_class_attr(self, session, page):
- if self.__page.get(session) == page:
- return " class=\"selected\""
-
- def render_item_href(self, session, page):
- branch = session.branch()
- self.__page.set(branch, page)
- return branch.marshal()
-
- def render_item_content(self, session, page):
- return page + 1
-
class CuminTable(SqlTable):
def __init__(self, app, name):
super(CuminTable, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-03-27 18:51:34 UTC (rev 1807)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-03-27 20:17:14 UTC (rev 1808)
@@ -126,48 +126,6 @@
[StateSwitch.item_html]
<li>{item_link}</li>
-[Paginator.css]
-ul.Paginator {
- display: inline;
- font-size: 0.9em;
-}
-
-ul.Paginator li {
- display: inline;
- margin: 0 0.1em;
-}
-
-ul.Paginator a {
- padding: 0.075em 0.25em;
- border: 1px solid #f7f7f7;
-}
-
-ul.Paginator a:hover {
- border: 1px solid #ddd;
- background-color: white;
-}
-
-ul.Paginator a.pagenav {
- border: 1px solid #ddd;
- color: black;
-}
-
-ul.Paginator a.disabled {
- color: #ccc;
-}
-
-ul.Paginator a.pagenav:hover {
- background-color: white;
-}
-
-[Paginator.html]
-<ul class="Paginator">
- <li>{prev_pageset_link}</li><li>{prev_page_link}</li>{items}<li>{next_page_link}</li><li>{next_pageset_link}</li>
-</ul>
-
-[Paginator.item_html]
-<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
-
[CuminTable.css]
table.mobjects th.setnav {
font-size: 0.9em;
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2008-03-27 18:51:34 UTC (rev 1807)
+++ mgmt/cumin/python/wooly/widgets.py 2008-03-27 20:17:14 UTC (rev 1808)
@@ -1,6 +1,8 @@
-from wooly import *
+from math import ceil
+
from parameters import *
from resources import *
+from wooly import *
strings = StringCatalog(__file__)
@@ -196,3 +198,125 @@
self.item_tmpl.render(writer, session, child)
return writer.to_string()
+
+class Paginator(ItemSet):
+ def __init__(self, app, name):
+ super(Paginator, self).__init__(app, name)
+
+ self.__page = IntegerParameter(app, "page")
+ self.__page.default = 0
+ self.add_parameter(self.__page)
+
+ self.__pageset = IntegerParameter(app, "pageset")
+ self.__pageset.default = 0
+ self.add_parameter(self.__pageset)
+
+ self.__count = Attribute(app, "count")
+ self.add_attribute(self.__count)
+
+ self.page_size = 15
+ self.pageset_size = 5
+
+ def get_bounds(self, session):
+ page = self.__page.get(session)
+ return self.page_size * page, self.page_size * (page + 1)
+
+ def get_pageset_bounds(self, session):
+ pageset = self.__pageset.get(session)
+ return self.pageset_size * pageset, self.pageset_size * (pageset + 1)
+
+ def set_count(self, session, count):
+ return self.__count.set(session, count)
+
+ def get_count(self, session):
+ return self.__count.get(session)
+
+ def get_page_count(self, session):
+ count = self.get_count(session)
+ return int(ceil(count / float(self.page_size)))
+
+ def get_pageset_count(self, session):
+ page_count = self.get_page_count(session)
+ return int(ceil(page_count / float(self.pageset_size)))
+
+ def __link(self, href, content, class_=""):
+ return "<a href=\"%s\"%s>%s</a>" % \
+ (href, class_ and " class=\"%s\" " % class_ or " ", content)
+
+ def render_prev_page_link(self, session, *args):
+ page = self.__page.get(session)
+
+ if page < 1:
+ html = self.__link(session.marshal(), "<", "pagenav disabled")
+ else:
+ page -= 1
+ pageset_start = self.get_pageset_bounds(session)[0]
+
+ branch = session.branch()
+ self.__page.set(branch, page)
+ if page < pageset_start:
+ self.__pageset.set(branch, self.__pageset.get(session) - 1)
+ html = self.__link(branch.marshal(), "<", "pagenav")
+
+ return html
+
+ def render_next_page_link(self, session, *args):
+ page = self.__page.get(session)
+
+ if page >= self.get_page_count(session) - 1:
+ html = self.__link(session.marshal(), ">", "pagenav disabled")
+ else:
+ page += 1
+ pageset_end = self.get_pageset_bounds(session)[1]
+
+ branch = session.branch()
+ self.__page.set(branch, page)
+ if page >= pageset_end: # XXX should be >? bounds func is funny
+ self.__pageset.set(branch, self.__pageset.get(session) + 1)
+ html = self.__link(branch.marshal(), ">", "pagenav")
+
+ return html
+
+ def render_prev_pageset_link(self, session, *args):
+ pageset = self.__pageset.get(session)
+
+ if pageset < 1:
+ html = self.__link(session.marshal(), "<<", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__pageset.set(branch, pageset - 1)
+ html = self.__link(branch.marshal(), "<<", "pagenav")
+
+ return html
+
+ def render_next_pageset_link(self, session, *args):
+ pageset = self.__pageset.get(session)
+
+ if pageset >= self.get_pageset_count(session) - 1:
+ html = self.__link(session.marshal(), ">>", "pagenav disabled")
+ else:
+ branch = session.branch()
+ self.__pageset.set(branch, pageset + 1)
+ html = self.__link(branch.marshal(), ">>", "pagenav")
+
+ return html
+
+ def do_get_items(self, session, *args):
+ count = self.__count.get(session)
+
+ start, end = self.get_pageset_bounds(session)
+ page_count = self.get_page_count(session)
+
+ return range(start, min(end, page_count))
+
+ def render_item_class_attr(self, session, page):
+ if self.__page.get(session) == page:
+ return " class=\"selected\""
+
+ def render_item_href(self, session, page):
+ branch = session.branch()
+ self.__page.set(branch, page)
+ return branch.marshal()
+
+ def render_item_content(self, session, page):
+ return page + 1
Modified: mgmt/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/cumin/python/wooly/widgets.strings 2008-03-27 18:51:34 UTC (rev 1807)
+++ mgmt/cumin/python/wooly/widgets.strings 2008-03-27 20:17:14 UTC (rev 1808)
@@ -88,3 +88,45 @@
<tr>
{cells}
</tr>
+
+[Paginator.css]
+ul.Paginator {
+ display: inline;
+ font-size: 0.9em;
+}
+
+ul.Paginator li {
+ display: inline;
+ margin: 0 0.1em;
+}
+
+ul.Paginator a {
+ padding: 0.075em 0.25em;
+ border: 1px solid #f7f7f7;
+}
+
+ul.Paginator a:hover {
+ border: 1px solid #ddd;
+ background-color: white;
+}
+
+ul.Paginator a.pagenav {
+ border: 1px solid #ddd;
+ color: black;
+}
+
+ul.Paginator a.disabled {
+ color: #ccc;
+}
+
+ul.Paginator a.pagenav:hover {
+ background-color: white;
+}
+
+[Paginator.html]
+<ul class="Paginator">
+ <li>{prev_pageset_link}</li><li>{prev_page_link}</li>{items}<li>{next_page_link}</li><li>{next_pageset_link}</li>
+</ul>
+
+[Paginator.item_html]
+<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
16 years, 9 months
rhmessaging commits: r1807 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 14:51:34 -0400 (Thu, 27 Mar 2008)
New Revision: 1807
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
Log:
Rename BrokerLinkSet to PeerSet
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-27 18:47:36 UTC (rev 1806)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-27 18:51:34 UTC (rev 1807)
@@ -123,9 +123,9 @@
return link
-class BrokerLinkSet(CuminTable):
+class PeerSet(CuminTable):
def __init__(self, app, name):
- super(BrokerLinkSet, self).__init__(app, name)
+ super(PeerSet, self).__init__(app, name)
col = self.AddressColumn(app, "addr")
self.add_column(col)
@@ -141,7 +141,7 @@
def render_title(self, session, broker):
count = self.get_item_count(session, broker)
- return "Broker Links %s" % fmt_count(count)
+ return "Peers %s" % fmt_count(count)
def render_sql_where(self, session, reg):
vhost = reg.getDefaultVhost()
@@ -254,7 +254,7 @@
self.tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
self.tabs.add_tab(self.BrokerClientTab(app, "clients"))
- self.tabs.add_tab(BrokerLinkSet(app, "links"))
+ self.tabs.add_tab(PeerSet(app, "links"))
self.missing = self.BrokerMissing(app, "missing")
self.body.add_mode(self.missing)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-03-27 18:47:36 UTC (rev 1806)
+++ mgmt/cumin/python/cumin/broker.strings 2008-03-27 18:51:34 UTC (rev 1807)
@@ -39,7 +39,7 @@
{hidden_inputs}
</form>
-[BrokerLinkSet.sql]
+[PeerSet.sql]
select
l.id,
l.address as addr,
@@ -55,7 +55,7 @@
{sql_orderby}
{sql_limit}
-[BrokerLinkSet.count_sql]
+[PeerSet.count_sql]
select count(*)
from link as l
join vhost as v on v.id = l.vhost_id
16 years, 9 months
rhmessaging commits: r1806 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 14:47:36 -0400 (Thu, 27 Mar 2008)
New Revision: 1806
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Use types directly in stat declarations.
Simplify the value formatting based on types.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-03-27 17:44:39 UTC (rev 1805)
+++ mgmt/cumin/python/cumin/model.py 2008-03-27 18:47:36 UTC (rev 1806)
@@ -183,10 +183,11 @@
if value is None:
text = ""
- elif value == 0:
- text = "0"
- elif isinstance(value, IntType) or isinstance(value, LongType):
- text = "%i" % value
+ elif self.type is int:
+ if value == 0:
+ text = "0"
+ else:
+ text = "%i" % value
else:
text = "%r" % value
@@ -357,150 +358,150 @@
def __init__(self, model):
super(CuminQueue, self).__init__(model, "queue", Queue, QueueStats)
- stat = CuminStat(self, "consumers", "int")
+ stat = CuminStat(self, "consumers", int)
stat.title = "Consumers"
stat.unit = "consumer"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "bindings", "int")
+ stat = CuminStat(self, "bindings", int)
stat.title = "Bindings"
stat.unit = "binding"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "msgDepth", "int")
+ stat = CuminStat(self, "msgDepth", int)
stat.title = "Message Depth"
stat.unit = "message"
stat.categories = ("message", "general")
stat.highlow = True
- stat = CuminStat(self, "msgTotalEnqueues", "int")
+ stat = CuminStat(self, "msgTotalEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "general")
- stat = CuminStat(self, "msgTotalDequeues", "int")
+ stat = CuminStat(self, "msgTotalDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "general")
- stat = CuminStat(self, "byteDepth", "int")
+ stat = CuminStat(self, "byteDepth", int)
stat.title = "Byte Depth"
stat.unit = "byte"
stat.categories = ("byte", "general")
stat.highlow = True
- stat = CuminStat(self, "byteTotalEnqueues", "int")
+ stat = CuminStat(self, "byteTotalEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- stat = CuminStat(self, "byteTotalDequeues", "int")
+ stat = CuminStat(self, "byteTotalDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- stat = CuminStat(self, "unackedMessages", "int")
+ stat = CuminStat(self, "unackedMessages", int)
stat.title = "Msgs. Unacked"
stat.unit = "message"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "messageLatencyMin", "int")
+ stat = CuminStat(self, "messageLatencyMin", int)
stat.title = "Min. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencyMax", "int")
+ stat = CuminStat(self, "messageLatencyMax", int)
stat.title = "Max. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencyAverage", "int")
+ stat = CuminStat(self, "messageLatencyAverage", int)
stat.title = "Avg. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencySamples", "int")
+ stat = CuminStat(self, "messageLatencySamples", int)
stat.title = "Msg. Latency Samples"
stat.unit = "sample"
stat.categories = ("general")
# Disk
- #stat = CuminStat(self, "diskPageSize", "int")
+ #stat = CuminStat(self, "diskPageSize", int)
#stat.title = "Page size"
#stat.categories = ("disk")
- #stat = CuminStat(self, "diskPages", "int")
+ #stat = CuminStat(self, "diskPages", int)
#stat.title = "Disk Pages"
#stat.unit = "page"
#stat.categories = ("general")
- #stat = CuminStat(self, "diskAvailableSize", "int")
+ #stat = CuminStat(self, "diskAvailableSize", int)
#stat.title = "Available size"
#stat.categories = ("disk")
# Transactional
- stat = CuminStat(self, "msgTxnEnqueues", "int")
+ stat = CuminStat(self, "msgTxnEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- stat = CuminStat(self, "msgTxnDequeues", "int")
+ stat = CuminStat(self, "msgTxnDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- stat = CuminStat(self, "byteTxnEnqueues", "int")
+ stat = CuminStat(self, "byteTxnEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- stat = CuminStat(self, "byteTxnDequeues", "int")
+ stat = CuminStat(self, "byteTxnDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- stat = CuminStat(self, "enqueueTxnStarts", "int")
+ stat = CuminStat(self, "enqueueTxnStarts", int)
stat.title = "Enq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnCommits", "int")
+ stat = CuminStat(self, "enqueueTxnCommits", int)
stat.title = "Enq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnRejects", "int")
+ stat = CuminStat(self, "enqueueTxnRejects", int)
stat.title = "Enq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "enqueueTxnCount", "int")
+ stat = CuminStat(self, "enqueueTxnCount", int)
stat.title = "Enq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
stat.highlow = True
- stat = CuminStat(self, "dequeueTxnStarts", "int")
+ stat = CuminStat(self, "dequeueTxnStarts", int)
stat.title = "Deq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnCommits", "int")
+ stat = CuminStat(self, "dequeueTxnCommits", int)
stat.title = "Deq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnRejects", "int")
+ stat = CuminStat(self, "dequeueTxnRejects", int)
stat.title = "Deq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- stat = CuminStat(self, "dequeueTxnCount", "int")
+ stat = CuminStat(self, "dequeueTxnCount", int)
stat.title = "Deq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
@@ -508,22 +509,22 @@
# Persistent
- stat = CuminStat(self, "msgPersistEnqueues", "int")
+ stat = CuminStat(self, "msgPersistEnqueues", int)
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- stat = CuminStat(self, "msgPersistDequeues", "int")
+ stat = CuminStat(self, "msgPersistDequeues", int)
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- stat = CuminStat(self, "bytePersistEnqueues", "int")
+ stat = CuminStat(self, "bytePersistEnqueues", int)
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
- stat = CuminStat(self, "bytePersistDequeues", "int")
+ stat = CuminStat(self, "bytePersistDequeues", int)
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
@@ -545,44 +546,44 @@
super(CuminExchange, self).__init__(model, "exchange",
Exchange, ExchangeStats)
- stat = CuminStat(self, "producers", "int")
+ stat = CuminStat(self, "producers", int)
stat.title = "Producers"
stat.unit = "producer"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "bindings", "int")
+ stat = CuminStat(self, "bindings", int)
stat.title = "Bindings"
stat.unit = "binding"
stat.categories = ("general")
stat.highlow = True
- stat = CuminStat(self, "msgReceives", "int")
+ stat = CuminStat(self, "msgReceives", int)
stat.title = "Msgs. Received"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "msgRoutes", "int")
+ stat = CuminStat(self, "msgRoutes", int)
stat.title = "Msgs. Routed"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "msgDrops", "int")
+ stat = CuminStat(self, "msgDrops", int)
stat.title = "Msgs. Dropped"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteReceives", "int")
+ stat = CuminStat(self, "byteReceives", int)
stat.title = "Bytes Received"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteRoutes", "int")
+ stat = CuminStat(self, "byteRoutes", int)
stat.title = "Bytes Routed"
stat.unit = "message"
stat.categories = ("general")
- stat = CuminStat(self, "byteDrops", "int")
+ stat = CuminStat(self, "byteDrops", int)
stat.title = "Bytes Dropped"
stat.unit = "message"
stat.categories = ("general")
@@ -595,7 +596,7 @@
super(CuminBinding, self).__init__(model, "binding",
Binding, BindingStats)
- stat = CuminStat(self, "msgMatched", "int")
+ stat = CuminStat(self, "msgMatched", int)
stat.title = "Msgs. Matched"
stat.unit = "message"
stat.categories = ("general")
@@ -610,26 +611,26 @@
def __init__(self, model):
super(CuminClient, self).__init__(model, "client", Client, ClientStats)
- stat = CuminStat(self, "closing", "bool")
+ stat = CuminStat(self, "closing", bool)
stat.title = "Closing Down"
stat.categories = ("general")
- stat = CuminStat(self, "bytesFromClient", "int")
+ stat = CuminStat(self, "bytesFromClient", int)
stat.title = "Bytes Sent"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "bytesToClient", "int")
+ stat = CuminStat(self, "bytesToClient", int)
stat.title = "Bytes Received"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "framesFromClient", "int")
+ stat = CuminStat(self, "framesFromClient", int)
stat.title = "Frames Sent"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "framesToClient", "int")
+ stat = CuminStat(self, "framesToClient", int)
stat.title = "Frames Received"
stat.unit = "frame"
stat.categories = ("general")
@@ -654,16 +655,16 @@
super(CuminSession, self).__init__(model, "session",
Session, SessionStats)
- stat = CuminStat(self, "expireTime", "datetime")
+ stat = CuminStat(self, "expireTime", datetime)
stat.title = "Expiration"
stat.categories = ("general")
- stat = CuminStat(self, "framesOutstanding", "int")
+ stat = CuminStat(self, "framesOutstanding", int)
stat.title = "Frames Outstanding"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "attached", "bool")
+ stat = CuminStat(self, "attached", bool)
stat.title = "Attached"
stat.categories = ("general")
@@ -707,26 +708,26 @@
def __init__(self, model):
super(CuminLink, self).__init__(model, "link", Link, LinkStats)
- stat = CuminStat(self, "closing", "bool")
+ stat = CuminStat(self, "closing", bool)
stat.title = "Closing Down"
stat.categories = ("general")
- stat = CuminStat(self, "framesFromPeer", "int")
+ stat = CuminStat(self, "framesFromPeer", int)
stat.title = "Frames from Peer"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "framesToPeer", "int")
+ stat = CuminStat(self, "framesToPeer", int)
stat.title = "Frames to Peer"
stat.unit = "frame"
stat.categories = ("general")
- stat = CuminStat(self, "bytesFromPeer", "int")
+ stat = CuminStat(self, "bytesFromPeer", int)
stat.title = "Bytes from Peer"
stat.unit = "byte"
stat.categories = ("general")
- stat = CuminStat(self, "bytesToPeer", "int")
+ stat = CuminStat(self, "bytesToPeer", int)
stat.title = "Bytes to Peer"
stat.unit = "byte"
stat.categories = ("general")
16 years, 9 months