rhmessaging commits: r2797 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-13 10:17:12 -0500 (Thu, 13 Nov 2008)
New Revision: 2797
Modified:
mgmt/trunk/cumin/python/cumin/pool.strings
Log:
Added javascript to handle pool stats update.
Changed from job visualization to pool slot visualization
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-11-13 15:15:49 UTC (rev 2796)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-11-13 15:17:12 UTC (rev 2797)
@@ -16,6 +16,23 @@
from
(select 1 from collector group by pool) as l
+[PoolView.javascript]
+function updatePool(data) {
+ var model = data.objectify();
+ var pools = model.pool;
+ var pool;
+
+ for (var key in pools) {
+ pool = pools[key];
+ break;
+ }
+
+ cumin.runModelListeners(model);
+ cumin.runObjectListeners(pool);
+
+ //throw new Error();
+}
+
[PoolStatus.html]
<div id="{id}" class="CuminStatus {color}">
<h2>{title}</h2>
@@ -23,6 +40,11 @@
<div>{status}</div>
</div>
+[PoolStats.css]
+div.vistats {
+ margin-bottom: 2em;
+}
+
[PoolStats.html]
<div style="width: 50%; float: left;">
<h2>General</h2>
@@ -31,8 +53,10 @@
</div>
</div>
<div style="float: left; margin-left: 4em;">
- <h2>Job Activity</h2>
- {job_grid}
+ <div class="vistats">
+ <h2>Slot Utilization</h2>
+ {slot_grid}
+ </div>
</div>
<div style="clear:left;"><!-- --></div>
16 years, 2 months
rhmessaging commits: r2796 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-13 10:15:49 -0500 (Thu, 13 Nov 2008)
New Revision: 2796
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
Log:
Use objectlistener to update pool stats.
Deferred pool stats calculations until after page loads.
Removed Job visualization.
Added Pool Slot visualization.
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-11-13 15:07:41 UTC (rev 2795)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-13 15:15:49 UTC (rev 2796)
@@ -17,6 +17,7 @@
from collector import CollectorSet, CollectorFrame, CollectorStart, CollectorStop
from negotiator import NegotiatorSet, NegotiatorFrame, NegStart, NegStop
from limits import LimitsSet, LimitsFrame
+from slot import SlotSet
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.pool")
@@ -190,6 +191,10 @@
class LimitsTab(LimitsSet):
pass
+ def render_script(self, session, pool):
+ data = "model.xml?class=pool;id=%s" % pool.id
+ return "wooly.setIntervalUpdate('%s', updatePool, 3000)" % data
+
class PoolSchedulerSet(SchedulerSet):
def get_args(self, session):
return self.frame.get_args(session)
@@ -245,7 +250,21 @@
def render_sql_where(self, session, pool):
return "where n.pool = %(pool)s"
-
+
+class PoolSlotSet(SlotSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_sql_where(self, session, pool):
+ return "where s.pool = %(pool)s"
+
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
+
+ def render_title(self, session, pool):
+ count = self.get_item_count(session, pool)
+ return "Slots %s" % fmt_count(count)
+
class PoolStats(Widget):
def __init__(self, app, name):
super(PoolStats, self).__init__(app, name)
@@ -253,9 +272,12 @@
stats = PoolStatSet(app, "general", "general")
self.add_child(stats)
- self.grid = self.JobUtilizationGrid(app, "job_grid")
- self.add_child(self.grid)
+ #self.grid = self.JobUtilizationGrid(app, "job_grid")
+ #self.add_child(self.grid)
+ self.slot_grid = self.SlotVisualization(app, "slot_grid")
+ self.add_child(self.slot_grid)
+
def render_title(self, session):
return "Statistics"
@@ -291,68 +313,45 @@
def get_sticky_info(self, session):
return [("name", "ID"), ("submitter", "Submitter"), ("status", "Status")]
-class PoolStatSet(StatSet):
- def __init__(self, app, name, category):
- super(PoolStatSet, self).__init__(app, name, category)
+ class SlotVisualization(StatUtilizationGrid):
+ def get_cells(self, session):
+ pool = self.frame.get_args(session)[0]
+ action = self.app.model.pool.slots
+ return action.get_slots(session, pool)
- self.jobs = Attribute(app, "jobs")
- self.add_attribute(self.jobs)
-
- def process(self, session):
- value = Job.select().count()
- self.jobs.set(session, value)
- super(PoolStatSet, self).process(session)
-
- def render_rate_text(self, session, args):
- return "Percentage"
+ def render_title(self, session):
+ return ""
- def render_item_name(self, session, args):
- stat = args[0]
- return stat.name
+ def get_colors(self, session):
+ action = self.app.model.pool.slots
+ return action.get_colors()
+
+ def get_color(self, session, job):
+ action = self.app.model.pool.slots
+ return action.get_color(job)
+
+ def get_contents(self, session, slot):
+ return ""
- def render_item_value(self, session, args):
- stat = args[0]
- if stat.name == "Jobs":
- return self.jobs.get(session)
- else:
- state = stat.name
- value = self.get_value(session, state)
- return value
+ 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)
- def get_value(self, session, state):
- pool = self.frame.get_object(session)
- elems = list()
- istate = JobStatusInfo.get_status_int(state)
- elems.append("job_status = %i" % istate)
- elems.append("s.pool = '%s'" % pool.id)
+ def get_url(self, session):
+ pool = self.parent.frame.get_args(session)[0]
+ return "call.xml?class=pool;method=slots"
+
+ def get_sticky_info(self, session):
+ return [("name", "Name"), ("machine", "Machine"), ("job", "Job")]
- # manually removed jobs will have a state of Idle
- # with a deletion_time
- if state == "Idle":
- elems.append("job.deletion_time is null")
- where = " and ".join(elems)
+class PoolStatSet(StatSet):
+ def render_rate_text(self, session, args):
+ return "Percentage"
- # manually removed jobs will have a state of Idle
- # with a deletion_time
- if state == "Removed":
- removed = "(job.deletion_time is not null and job_status = %i)" % JobStatusInfo.get_status_int("Idle")
- where = " or ".join((where, removed))
-
- jn = "inner join scheduler as s on s.id = scheduler_id"
- return Job.select(where, join=jn).count()
-
- def render_item_rate(self, session, stat):
- jobs = self.jobs.get(session)
- state = stat[0].name
- if state == "Jobs":
- value = jobs
- else:
- value = self.get_value(session, state)
- if jobs:
- percent = (value*1.0) / (jobs*1.0) * 100.0
- return jobs and "%2.2f" % percent or "-"
-
-
class PoolStatus(CuminStatus):
def render_status(self, session, pool):
return "Active"
16 years, 2 months
rhmessaging commits: r2795 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-11-13 10:07:41 -0500 (Thu, 13 Nov 2008)
New Revision: 2795
Modified:
mgmt/trunk/cumin/python/cumin/test.py
Log:
Fixed queue and exchange tests.
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2008-11-13 13:55:29 UTC (rev 2794)
+++ mgmt/trunk/cumin/python/cumin/test.py 2008-11-13 15:07:41 UTC (rev 2795)
@@ -264,14 +264,8 @@
form = p.main.broker.link_add
form.show(s)
- host = dict()
- host["name"] = "localhost"
- host["port"] = "9991"
- host["password"] = ""
- host["username"] = ""
- form.host.set(s, host)
-
- form.durable.set(s, "transient")
+ form.host.set(s, "localhost")
+ form.port.set(s, "9991")
form.submit(s)
p.process(s)
@@ -282,15 +276,11 @@
def predicate():
for item in Link.selectBy(vhost=vhost, host="localhost", port=9991):
+ self.env.link = item
return True
wait(predicate)
- try:
- self.env.link = Link.selectBy(vhost=vhost, host="localhost", port=9991)[0]
- except IndexError:
- raise Exception("Link not created")
-
self.run_children(session)
class LinkRemove(Test):
@@ -349,15 +339,11 @@
def predicate():
for item in Bridge.selectBy(link=self.env.link, dest=self.env.broker_exchange.name, key="cumin.key"):
+ self.env.bridge = item
return True
wait(predicate)
- try:
- self.env.bridge = Bridge.selectBy(link=self.env.link, dest=self.env.broker_exchange.name, key="cumin.key")[0]
- except IndexError:
- raise Exception("Route not created")
-
class Remove(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
@@ -379,10 +365,6 @@
wait(predicate)
- # if it timed out, raise an exception
- if not self.env.bridge.deletionTime:
- raise Exception("Route not removed")
-
class BrokerRegistrationTest(Test):
def __init__(self, env, parent):
super(BrokerRegistrationTest, self).__init__(env, parent)
@@ -570,6 +552,7 @@
direct = binding["test"]
direct["name"] = "amq.direct"
direct["type"] = "direct"
+ direct["key"] = "amq.direct.key"
form.bindings.dict_param.set(s, binding)
@@ -605,17 +588,21 @@
wait(predicate)
- # if it timed out, raise an exception
- if not self.env.binding_direct.deletionTime:
- raise Exception("Direct Binding not removed")
+ class BindTopic(Test):
+ def __init__(self, env, parent):
+ super(BindQueueTest.BindTopic, self).__init__(env, parent)
- class BindTopic(Test):
+ self.RemoveBindTopic(env, self)
+
def do_run(self, session):
p, s = self.env.page_and_session()
- frame = p.main.broker.queue.show_object(s, self.env.queue)
+ p.main.broker.set_object(s, self.env.broker.registration)
+ p.main.broker.queue.set_object(s, self.env.queue)
- form = frame.binding_add
+ form = p.main.broker.queue.binding_add
+ form.show(s)
+
binding = dict()
binding["test"] = {}
direct = binding["test"]
@@ -631,17 +618,43 @@
def predicate():
for item in Binding.selectBy(queue=self.env.queue, bindingKey="topic.key"):
+ self.env.binding_topic = item
return True
wait(predicate)
+ class RemoveBindTopic(Test):
+ def do_run(self, session):
+ p, s = self.env.page_and_session()
+
+ p.main.broker.set_object(s, self.env.broker_registration)
+
+ form = p.main.broker.bindings_remove.show(s)
+ form.ids.set([self.env.binding_topic.id])
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ def predicate():
+ return self.env.binding_topic.deletionTime
+
+ wait(predicate)
+
class BindFanout(Test):
+ def __init__(self, env, parent):
+ super(BindQueueTest.BindFanout, self).__init__(env, parent)
+
+ self.RemoveBindFanout(env, self)
+
def do_run(self, session):
p, s = self.env.page_and_session()
- frame = p.main.broker.queue.show_object(s, self.env.queue)
+ p.main.broker.set_object(s, self.env.broker.registration)
+ p.main.broker.queue.set_object(s, self.env.queue)
- form = frame.binding_add
+ form = p.main.broker.queue.binding_add
form.show(s)
binding = dict()
@@ -659,23 +672,38 @@
def predicate():
for item in Binding.selectBy(queue=self.env.queue):
if item.exchange.name == "amq.fanout":
+ self.env.binding_fanout = item
return True
wait(predicate)
- for item in Binding.selectBy(queue=self.env.queue):
- if item.exchange.name == "amq.fanout":
- return
+ class RemoveBindFanout(Test):
+ def do_run(self, session):
+ p, s = self.env.page_and_session()
- raise Exception("Fanout Binding not added")
+ p.main.broker.set_object(s, self.env.broker_registration)
+ form = p.main.broker.bindings_remove.show(s)
+ form.ids.set([self.env.binding_fanout.id])
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ def predicate():
+ return self.env.binding_fanout.deletionTime
+
+ wait(predicate)
+
class BindHeaders(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
- frame = p.main.broker.queue.show_object(s, self.env.queue)
+ p.main.broker.set_object(s, self.env.broker.registration)
+ p.main.broker.queue.set_object(s, self.env.queue)
- form = frame.binding_add
+ form = p.main.broker.queue.binding_add
form.show(s)
binding = dict()
@@ -722,8 +750,6 @@
form = p.main.broker.queue_add
form.show(s)
form.namef.set(s, name)
- form.durable.set(s, "durable")
- form.autodelete.set(s, "preserve")
form.submit(s)
p.process(s)
@@ -761,15 +787,11 @@
def predicate():
for item in Queue.selectBy(vhost=vhost, name=name):
+ self.env.broker_queue = item
return True
wait(predicate)
- try:
- self.env.broker_queue = Queue.selectBy(vhost=vhost, name=name)[0]
- except IndexError:
- raise Exception("Queue not found")
-
self.run_children(session)
class Remove(Test):
@@ -794,55 +816,54 @@
wait(predicate)
+class AddExchangeTest(Test):
+ def do_run(self, session):
+ name = "cumin.exchange.%s" % session.id
+ p, s = self.env.page_and_session()
+
+ reg = self.env.broker_registration
+ p.main.broker.set_object(s, reg)
+
+ form = p.main.broker.exchange_add
+ form.show(s)
+
+ form.exchange_name.set(s, name)
+ form.exchange_type.set(s, "topic")
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ vhost = self.env.vhost
+ # wait for newly created exchange to show up
+ def predicate():
+ for item in Exchange.selectBy(vhost=vhost, name=name):
+ self.env.added_exchange = item
+ return True
+
+ wait(predicate)
+
class ExchangeTest(Test):
def __init__(self, env, parent):
super(ExchangeTest, self).__init__(env, parent)
- self.Add(env, self)
+ AddExchangeTest(env, self)
self.Remove(env, self)
def do_run(self, session):
vhost = self.env.vhost
name = self.env.broker_exchange.name
- try:
- self.env.exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
- except IndexError:
- raise Exception("Exchange not found")
+ def predicate():
+ for item in Exchange.selectBy(vhost=vhost, name=name):
+ self.env.broker_exchange = item
+ return True
+ wait(predicate)
+
self.run_children(session)
- class Add(Test):
- def do_run(self, session):
- name = "cumin.exchange.%s" % session.id
- p, s = self.env.page_and_session()
-
- reg = self.env.broker_registration
- p.main.broker.set_object(s, reg)
-
- form = p.main.broker.exchange_add
- form.show(s)
- form.exchange_name.set(s, name)
- form.type.set(s, "topic")
- form.submit(s)
-
- p.process(s)
-
- self.env.check_redirect(p, s)
-
- vhost = self.env.vhost
- # wait for newly created exchange to show up
- def predicate():
- for item in Exchange.selectBy(vhost=vhost, name=name):
- return True
-
- wait(predicate)
-
- try:
- self.env.added_exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
- except IndexError:
- raise Exception("Exchange %s not added" % name)
-
class Remove(Test):
def do_run(self, session):
# try to delete it
@@ -860,8 +881,6 @@
self.env.check_redirect(p, s)
- name = "cumin.exchange.%s" % session.id
-
# wait for newly created exchange to get marked as deleted
def predicate():
return self.env.added_exchange.deletionTime
16 years, 2 months
rhmessaging commits: r2794 - in mgmt/trunk/sesame/cpp/src: qmfgen and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-13 08:55:29 -0500 (Thu, 13 Nov 2008)
New Revision: 2794
Modified:
mgmt/trunk/sesame/cpp/src/Makefile.am
mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
Log:
Makefile changes: Added make clean logic for generated code
Removed generated files from distribution
Modified: mgmt/trunk/sesame/cpp/src/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-13 04:32:45 UTC (rev 2793)
+++ mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-13 13:55:29 UTC (rev 2794)
@@ -6,11 +6,9 @@
include qmfgen/qmfgen.mk
bin_PROGRAMS = sesame
-sesame_SOURCES =\
- $(qmfgen_sources) \
- SysAgent.cpp
+nodist_sesame_SOURCES = $(qmfgen_sources)
+sesame_SOURCES = SysAgent.cpp
-
sesame_LDADD = $(QPID_LIBS)
Modified: mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am 2008-11-13 04:32:45 UTC (rev 2793)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am 2008-11-13 13:55:29 UTC (rev 2794)
@@ -9,3 +9,6 @@
all : schema.xml
$(qmfgen_cmd)
+
+clean:
+ rm -rf $(srcdir)/qmf
16 years, 2 months
rhmessaging commits: r2793 - mgmt/trunk/sesame/cpp/etc.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-12 23:32:45 -0500 (Wed, 12 Nov 2008)
New Revision: 2793
Modified:
mgmt/trunk/sesame/cpp/etc/sesame.conf
Log:
Typo fix
Modified: mgmt/trunk/sesame/cpp/etc/sesame.conf
===================================================================
--- mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-13 04:27:37 UTC (rev 2792)
+++ mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-13 04:32:45 UTC (rev 2793)
@@ -39,7 +39,7 @@
##==============
##
-## Set the path to the directory where the sesame will store persistent data.
+## Set the path to the directory where sesame will store persistent data.
##
#state-dir=/var/sesame
16 years, 2 months
rhmessaging commits: r2792 - mgmt/trunk/sesame/cpp/etc.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-12 23:27:37 -0500 (Wed, 12 Nov 2008)
New Revision: 2792
Modified:
mgmt/trunk/sesame/cpp/etc/sesame.conf
Log:
Removed test settings
Modified: mgmt/trunk/sesame/cpp/etc/sesame.conf
===================================================================
--- mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-13 04:26:27 UTC (rev 2791)
+++ mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-13 04:27:37 UTC (rev 2792)
@@ -41,5 +41,5 @@
##
## Set the path to the directory where the sesame will store persistent data.
##
-state-dir=.
+#state-dir=/var/sesame
16 years, 2 months
rhmessaging commits: r2791 - in mgmt/trunk/sesame/cpp: src and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-12 23:26:27 -0500 (Wed, 12 Nov 2008)
New Revision: 2791
Modified:
mgmt/trunk/sesame/cpp/etc/sesame.conf
mgmt/trunk/sesame/cpp/src/Makefile.am
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
Log:
Added configuration and command line parsing.
Added example config file with comments.
The system agent is now fully functional.
Modified: mgmt/trunk/sesame/cpp/etc/sesame.conf
===================================================================
--- mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-12 22:24:25 UTC (rev 2790)
+++ mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-13 04:26:27 UTC (rev 2791)
@@ -1,4 +1,45 @@
##
## sesame configuration
##
-broker_url=amqp://localhost
+
+##===================
+## Broker Connection
+##===================
+
+##
+## Set the host and port of the broker that this agent shall attempt to
+## connect to. The port will default to the appropriate value based on the
+## protocol.
+##
+## For proto=tcp, the default port is 5672
+## proto=ssl, 5671
+## proto=rdma, 5672
+##
+#host=localhost
+#proto=tcp
+#port=5672
+
+##======================
+## Agent Authentication
+##======================
+
+##
+## Set the SASL mechanism (PLAIN by default), and the username and password
+## to be used when authenticating to the broker. If you wish to not store
+## the password in this configuration file, you may use pwd-file to point
+## to an access-restricted file containing the password.
+##
+#mech=PLAIN
+#uid=guest
+#pwd=guest
+#pwd-file=/etc/sesame/password
+
+##==============
+## Data Storage
+##==============
+
+##
+## Set the path to the directory where the sesame will store persistent data.
+##
+state-dir=.
+
Modified: mgmt/trunk/sesame/cpp/src/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-12 22:24:25 UTC (rev 2790)
+++ mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-13 04:26:27 UTC (rev 2791)
@@ -1,5 +1,7 @@
SUBDIRS = qmfgen
-AM_CXXFLAGS = -I$(QPID_DIR)/cpp/src -I$(QPID_DIR)/cpp/src/gen -Iqmfgen
+sesame_CXXFLAGS = -I$(QPID_DIR)/cpp/src -I$(QPID_DIR)/cpp/src/gen -Iqmfgen \
+ -DCONF_FILE=\"$(sysconfdir)/sesame.conf\" \
+ -DLOCSTATE_DIR=\"$(localstatedir)/sesame\"
include qmfgen/qmfgen.mk
Modified: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2008-11-12 22:24:25 UTC (rev 2790)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2008-11-13 04:26:27 UTC (rev 2791)
@@ -28,11 +28,11 @@
{
ManagementAgent* agent;
_qmf::SysImage* mgmtObject;
- qpid::framing::Uuid sysId;
+ qpid::framing::Uuid uuid;
public:
- SysAgent(ManagementAgent* agent);
+ SysAgent(ManagementAgent* agent, const string& uuidFile);
~SysAgent() { mgmtObject->resourceDestroy(); }
ManagementObject* GetManagementObject(void) const
@@ -59,13 +59,27 @@
void getMem(Mem& mem);
};
-SysAgent::SysAgent(ManagementAgent* _agent) : agent(_agent)
+SysAgent::SysAgent(ManagementAgent* _agent, const string& uuidFile) : agent(_agent)
{
std::string sysname, nodename, release, version, machine;
// obtain or establish the system-id
- sysId.generate();
- mgmtObject = new _qmf::SysImage(agent, this, sysId);
+ ifstream input(uuidFile.c_str());
+ if (input.good()) {
+ input >> uuid;
+ input.close();
+ }
+
+ if (uuid.isNull()) {
+ uuid.generate();
+ ofstream output(uuidFile.c_str());
+ if (output.good()) {
+ output << uuid << endl;
+ output.close();
+ }
+ }
+
+ mgmtObject = new _qmf::SysImage(agent, this, uuid);
qpid::sys::SystemInfo::getSystemId (sysname,
nodename,
release,
@@ -150,12 +164,138 @@
}
}
+struct Option {
+ string placeholder;
+ string defaultVal;
+ string help;
+ string value;
+
+ Option() {}
+ Option(const string& p, const string& d, const string& h) :
+ placeholder(p), defaultVal(d), help(h), value(d) {}
+};
+
+static map<string, Option> options;
+
//==============================================================
// Main program
//==============================================================
ManagementAgent::Singleton* singleton;
+void usage()
+{
+ cerr << "Usage: sesame [OPTIONS]" << endl << endl;
+ for (map<string, Option>::iterator iter = options.begin();
+ iter != options.end(); iter++)
+ cerr << " --" << iter->first << " " << iter->second.placeholder <<
+ " (" << iter->second.defaultVal << ") " << iter->second.help << endl;
+ exit(1);
+}
+
+void configure(int argc, char** argv)
+{
+ // Check to see if the config file was overridden
+ for (int i = 1; i < argc; i++) {
+ string arg(argv[i]);
+ if (arg == "--config") {
+ i++;
+ if (i == argc)
+ usage();
+ options["config"].value = string(argv[i]);
+ }
+ if (arg == "--no-config")
+ options["config"].value = string();
+ if (arg == "--help")
+ usage();
+ }
+
+ // Open the config file, if present, and load its values as overrides
+ // to the defaults.
+ if (!options["config"].value.empty()) {
+ ifstream input(options["config"].value.c_str());
+ if (!input.good()) {
+ cerr << "Can't open config file: " << options["config"].value << endl;
+ exit(1);
+ }
+
+ while (!input.eof()) {
+ char line[512];
+ char* cursor;
+ char* val;
+
+ input.getline(line, 512);
+ if (input.fail() && !input.eof()) {
+ cerr << "Line too long in config file: " << options["config"].value << endl;
+ exit(1);
+ }
+
+ if (line[0] != '\0' && line[0] != '#') {
+ cursor = line;
+ while (*cursor != '\0' && *cursor != '=')
+ cursor++;
+ if (*cursor == '\0') {
+ cerr << "Missing value in config line: " << line << endl;
+ exit(1);
+ }
+ *cursor = '\0';
+ val = ++cursor;
+
+ map<string, Option>::iterator iter = options.find(line);
+ if (iter == options.end()) {
+ cerr << "Config file option '" << line << "' not known" << endl;
+ exit(1);
+ }
+
+ iter->second.value = string(val);
+ }
+ }
+
+ input.close();
+ }
+
+ // Run through the command line options and override the defaults and the config file.
+ for (int i = 1; i < argc; i++) {
+ string arg(argv[i]);
+ if (arg == "--no-config")
+ continue;
+ if (arg.substr(0, 2) != "--") {
+ cerr << "Invalid argument: " << arg << endl;
+ usage();
+ }
+
+ map<string, Option>::iterator iter = options.find(arg.substr(2));
+ if (iter == options.end()) {
+ cerr << "Unknown option: " << arg << endl;
+ usage();
+ }
+
+ i++;
+ if (i == argc) {
+ cerr << "No value for option: " << arg << endl;
+ usage();
+ }
+
+ iter->second.value = string(argv[i]);
+ }
+}
+
+void getPassword()
+{
+ string file(options["pwd-file"].value);
+ if (file.empty())
+ return;
+
+ ifstream input(file.c_str());
+ if (!input.good()) {
+ cerr << "Can't read password file" << endl;
+ exit(1);
+ }
+
+ input >> options["pwd"].value;
+ input.close();
+}
+
void shutdown(int)
{
delete singleton;
@@ -165,23 +305,37 @@
int main_int(int argc, char** argv)
{
singleton = new ManagementAgent::Singleton();
- const char* host = argc>1 ? argv[1] : "127.0.0.1";
- int port = argc>2 ? atoi(argv[2]) : 5672;
-
signal(SIGINT, shutdown);
+ options["no-config"] = Option("", "", "Don't read configuration file");
+ options["config"] = Option("FILE", CONF_FILE, "Configuration file");
+ options["host"] = Option("ADDR", "localhost", "Broker host name or IP address");
+ options["port"] = Option("N", "5672", "Port for broker service");
+ options["proto"] = Option("NAME", "tcp", "Protocol for broker communication");
+ options["mech"] = Option("NAME", "PLAIN", "Authentication mechanism");
+ options["uid"] = Option("NAME", "guest", "Authentication user name");
+ options["pwd"] = Option("PASSWORD", "guest", "Authentication password");
+ options["pwd-file"] = Option("FILE", "", "File containing password");
+ options["state-dir"] = Option("DIR", LOCSTATE_DIR, "Directory for stored state");
+
+ configure(argc, argv);
+ getPassword();
+
// Create the qmf management agent
ManagementAgent* agent = singleton->getInstance();
- // Register the Qmf_example schema with the agent
+ // Register the schema with the agent
_qmf::Package packageInit(agent);
// Start the agent. It will attempt to make a connection to the
// management broker
- agent->init(string(host), port, 5, false, ".magentdata");
+ agent->init(options["host"].value, ::atoi(options["port"].value.c_str()), 5, false,
+ options["state-dir"].value + "/agentdata",
+ options["uid"].value, options["pwd"].value,
+ options["mech"].value, options["proto"].value);
// Allocate core object
- SysAgent core(agent);
+ SysAgent core(agent, options["state-dir"].value + "/uuid");
core.run();
}
16 years, 2 months
rhmessaging commits: r2790 - mgmt/trunk/sesame/cpp/src/qmfgen.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-12 17:24:25 -0500 (Wed, 12 Nov 2008)
New Revision: 2790
Removed:
mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
Log:
Removed generated file from SVN
Deleted: mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk 2008-11-12 22:20:42 UTC (rev 2789)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk 2008-11-12 22:24:25 UTC (rev 2790)
@@ -1,28 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# This source file was created by a code generator.
-# Please do not edit.
-
-
-qmfgen_sources=$(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.h \
- $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.h \
- $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.cpp \
- $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.cpp
-
16 years, 2 months
rhmessaging commits: r2789 - in mgmt/trunk: sesame and 5 other directories.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-11-12 17:20:42 -0500 (Wed, 12 Nov 2008)
New Revision: 2789
Added:
mgmt/trunk/sesame/
mgmt/trunk/sesame/cpp/
mgmt/trunk/sesame/cpp/COPYING
mgmt/trunk/sesame/cpp/Makefile.am
mgmt/trunk/sesame/cpp/README
mgmt/trunk/sesame/cpp/bootstrap
mgmt/trunk/sesame/cpp/build-aux/
mgmt/trunk/sesame/cpp/configure.ac
mgmt/trunk/sesame/cpp/etc/
mgmt/trunk/sesame/cpp/etc/sesame.conf
mgmt/trunk/sesame/cpp/m4/
mgmt/trunk/sesame/cpp/m4/clock_time.m4
mgmt/trunk/sesame/cpp/m4/compiler-flags.m4
mgmt/trunk/sesame/cpp/m4/cppunit.m4
mgmt/trunk/sesame/cpp/m4/extensions.m4
mgmt/trunk/sesame/cpp/src/
mgmt/trunk/sesame/cpp/src/Makefile.am
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
mgmt/trunk/sesame/cpp/src/qmfgen/
mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml
Log:
sesame - A System Agent module for the Qpid Management Framework
Added: mgmt/trunk/sesame/cpp/COPYING
===================================================================
--- mgmt/trunk/sesame/cpp/COPYING (rev 0)
+++ mgmt/trunk/sesame/cpp/COPYING 2008-11-12 22:20:42 UTC (rev 2789)
@@ -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.
Added: mgmt/trunk/sesame/cpp/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,14 @@
+AUTOMAKE_OPTIONS = 1.9.6 foreign
+ACLOCAL_AMFLAGS = -I m4
+
+
+EXTRA_DIST = README etc/sesame.conf
+
+sysconf_DATA = etc/sesame.conf
+
+SUBDIRS = src
+
+# Update libtool, if needed.
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
Added: mgmt/trunk/sesame/cpp/README
===================================================================
--- mgmt/trunk/sesame/cpp/README (rev 0)
+++ mgmt/trunk/sesame/cpp/README 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,16 @@
+sesame - A System agent for the Qpid Management Framework
+
+Pre-requisites:
+
+ Apache Qpid - You will need either the source tree for Qpid or and
+ installed copy of Qpid. The version must be M4 or later.
+
+ https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid
+
+ Alternatively, you can install the qmf-devel RPM and its dependencies.
+
+
+To use a checkout ./configure --with-qpid-checkout=<path_to_qpid>
+
+* 'make' will build the module
+
Added: mgmt/trunk/sesame/cpp/bootstrap
===================================================================
--- mgmt/trunk/sesame/cpp/bootstrap (rev 0)
+++ mgmt/trunk/sesame/cpp/bootstrap 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Copyright (C) 2007, 2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+set -e
+aclocal -I m4
+autoheader
+libtoolize --automake
+
+# Create initial Makefile fragments that will force make to generate
+# the real ones.
+cat > src/qmfgen/qmfgen.mk <<EOF
+\$(top_srcdir)/src/qmfgen/qmfgen.mk: force
+ \$(qmfgen_cmd)
+EOF
+
+automake --add-missing
+autoconf
Property changes on: mgmt/trunk/sesame/cpp/bootstrap
___________________________________________________________________
Name: svn:executable
+ *
Added: mgmt/trunk/sesame/cpp/configure.ac
===================================================================
--- mgmt/trunk/sesame/cpp/configure.ac (rev 0)
+++ mgmt/trunk/sesame/cpp/configure.ac 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,189 @@
+dnl # Copyright (C) 2007, 2008 Red Hat Inc.
+dnl #
+dnl # This file is part of Red Hat Messaging.
+dnl #
+dnl # Red Hat Messaging is free software; you can redistribute it and/or
+dnl # modify it under the terms of the GNU Lesser General Public
+dnl # License as published by the Free Software Foundation; either
+dnl # version 2.1 of the License, or (at your option) any later version.
+dnl #
+dnl # This library is distributed in the hope that it will be useful,
+dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl # Lesser General Public License for more details.
+dnl #
+dnl # You should have received a copy of the GNU Lesser General Public
+dnl # License along with this library; if not, write to the Free Software
+dnl # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+dnl # USA
+dnl #
+dnl # The GNU Lesser General Public License is available in the file COPYING.
+dnl
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([sesame], [0.1], [rhemrg-users-list(a)redhat.com])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+# Minimum Autoconf version required.
+AC_PREREQ(2.59)
+
+AC_CONFIG_HEADERS([src/config.h])
+AC_CONFIG_SRCDIR([src/SysAgent.cpp])
+
+AC_PROG_CC_STDC
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_USE_SYSTEM_EXTENSIONS
+AC_LANG([C++])
+
+AC_ARG_ENABLE(warnings,
+[ --enable-warnings turn on lots of compiler warnings (recommended)],
+[case "${enableval}" in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for warnings option]) ;;
+ esac],
+ [enableval=yes])
+
+# Warnings: Enable as many as possible, keep the code clean. Please
+# do not disable warnings or remove -Werror without discussing on
+# rhm-users list.
+#
+# The following warnings are deliberately omitted, they warn on valid code.
+# -Wunreachable-code -Wpadded -Winline
+# -Wshadow - warns about boost headers.
+
+if test "${enableval}" = yes; then
+ gl_COMPILER_FLAGS(-Werror)
+ gl_COMPILER_FLAGS(-pedantic)
+ gl_COMPILER_FLAGS(-Wall)
+ gl_COMPILER_FLAGS(-Wextra)
+ gl_COMPILER_FLAGS(-Wno-shadow)
+ gl_COMPILER_FLAGS(-Wpointer-arith)
+ gl_COMPILER_FLAGS(-Wcast-qual)
+ gl_COMPILER_FLAGS(-Wcast-align)
+ gl_COMPILER_FLAGS(-Wno-long-long)
+ gl_COMPILER_FLAGS(-Wvolatile-register-var)
+ gl_COMPILER_FLAGS(-Winvalid-pch)
+ gl_COMPILER_FLAGS(-Wno-system-headers)
+ AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
+ AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
+ COMPILER_FLAGS=
+fi
+
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+# Select building against qpid checkout or install.
+AC_ARG_WITH([qpid-checkout],
+ [AS_HELP_STRING([--with-qpid-checkout],
+ [Location of qpid checkout to build against (by default use installed qpid)])])
+
+if test x$with_qpid_checkout != x; then
+ QPID_DIR=$with_qpid_checkout
+ QPID_SRC=$QPID_DIR/cpp/src
+ QMF_GEN=$QPID_DIR/cpp/managementgen/qmf-gen
+ test -f $QPID_SRC/qpid/agent/ManagementAgent.h || \
+ AC_MSG_ERROR([$QPID_DIR does not appear to be a valid qpid checkout.])
+ QPID_LIBS="$QPID_SRC/libqmfagent.la"
+ QPID_CXXFLAGS="-I$QPID_SRC -I${QPID_SRC}/gen"
+else
+ fail=0
+ AC_CHECK_PROG([QMF_GEN], [qmf-gen], [qmf-gen], [no])
+ test $QMF_GEN = no &&
+ AC_MSG_ERROR([Missing required qmf-gen. Install package qmf-devel or use --with-qpid-checkout])
+
+ AC_CHECK_HEADERS([qpid/agent/ManagementAgent.h], , [fail=1])
+ # Give any/all diagnostics before failing.
+ test $fail = 1 &&
+ AC_MSG_ERROR([Missing required qpid libraries/headers. Install package qmf-devel or use --with-qpid-checkout])
+ QPID_LIBS="-lqmfagent"
+fi
+AC_SUBST([QMF_GEN])
+AC_SUBST([QPID_DIR])
+AC_SUBST([QPID_LIBS])
+AC_SUBST([QPID_CXXFLAGS])
+
+# For libraries (libcommon) that use dlopen, dlerror, etc.,
+# test whether we need to link with -ldl.
+gl_saved_libs=$LIBS
+AC_SEARCH_LIBS(dlopen, [dl],
+ [test "$ac_cv_search_dlopen" = "none required" ||
+ LIB_DLOPEN=$ac_cv_search_dlopen])
+AC_SUBST([LIB_DLOPEN])
+LIBS=$gl_saved_libs
+
+# Require libdb_cxx (any version between 4.2 and 4.7), for the library, and for db_cxx.h.
+db4_devel_fail=0
+AC_CHECK_HEADER([db_cxx.h], ,[db4_devel_fail=1])
+test $db4_devel_fail == 1 && \
+ AC_MSG_ERROR([db4-devel package missing. Please ensure both db4 and db4-devel are installed. (hint: "yum install db4-devel" should do it...)])
+
+gl_saved_libs=$LIBS
+AC_SEARCH_LIBS([__db_open], [db_cxx-4.7 db_cxx-4.6 db_cxx-4.5 db_cxx-4.4 db_cxx-4.3 db_cxx-4.2],
+ [test "$ac_cv_search___db_open" = "none required" ||
+ LIB_BERKELEY_DB=$ac_cv_search___db_open],
+ AC_MSG_ERROR([Couldn't find required library in range db_cxx-4.2 through db_cxx-4.6]))
+AC_SUBST([LIB_BERKELEY_DB])
+LIBS=$gl_saved_libs
+
+# Determine how to include db_cxx.h:
+# Red Hat needs <db4/db_cxx.h>, Debian needs <db_cxx.h>.
+AC_CHECK_HEADER([db4/db_cxx.h],
+ [DB_CXX_HEADER_PREFIX=db4/])
+if test x$DB_CXX_HEADER_PREFIX = x; then
+ AC_CHECK_HEADER([db_cxx.h],
+ [DB_CXX_HEADER_PREFIX=])
+fi
+AC_SUBST(DB_CXX_HEADER_PREFIX)
+
+# Set the argument to be used in "libtool -version-info ARG".
+QPID_CURRENT=1
+QPID_REVISION=0
+QPID_AGE=1
+LIBTOOL_VERSION_INFO_ARG=$QPID_CURRENT:$QPID_REVISION:$QPID_AGE
+AC_SUBST(LIBTOOL_VERSION_INFO_ARG)
+
+gl_CLOCK_TIME
+
+AC_ARG_ENABLE([apr-platform],
+ [AS_HELP_STRING([--enable-apr-platform],
+ [use the Apache Portable Runtime library for platform (default no)])],
+ [case $enableval in
+ yes|no) enable_APR_PLATFORM=$enableval;;
+ *) AC_MSG_ERROR([Invalid value for --enable-apr-platform: $enableval]);;
+ esac],
+ [enable_APR_PLATFORM=no]
+)
+AM_CONDITIONAL([USE_APR_PLATFORM], [test x$enable_APR_PLATFORM = xyes])
+
+APR_MINIMUM_VERSION=1.2.2
+AC_SUBST(APR_MINIMUM_VERSION)
+AC_SUBST(APR_CXXFLAGS)
+AC_SUBST(USE_APR_PLATFORM)
+
+if test x$enable_APR_PLATFORM = xyes; then
+ PKG_CHECK_MODULES([APR], [apr-1 >= $APR_MINIMUM_VERSION])
+ APR_CXXFLAGS="$APR_CFLAGS -DUSE_APR_PLATFORM=1"
+ USE_APR_PLATFORM=1
+fi
+
+# We use valgrind for the tests. See if it's available.
+AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
+
+# If rpmlint is available we'll run it when building RPMs.
+AC_CHECK_PROG([RPMLINT], [rpmlint], [rpmlint])
+AM_CONDITIONAL([HAS_RPMLINT], [test -n "$RPMLINT"])
+
+# Also doxygen for documentation...
+AC_CHECK_PROG([do_doxygen], [doxygen], [yes])
+AM_CONDITIONAL([DOXYGEN], [test x$do_doxygen = xyes])
+
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ src/qmfgen/Makefile
+ ])
+
+AC_OUTPUT
Added: mgmt/trunk/sesame/cpp/etc/sesame.conf
===================================================================
--- mgmt/trunk/sesame/cpp/etc/sesame.conf (rev 0)
+++ mgmt/trunk/sesame/cpp/etc/sesame.conf 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,4 @@
+##
+## sesame configuration
+##
+broker_url=amqp://localhost
Added: mgmt/trunk/sesame/cpp/m4/clock_time.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/clock_time.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/clock_time.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,30 @@
+# clock_time.m4 serial 8
+dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
+# For a program named, say foo, you should add a line like the following
+# in the corresponding Makefile.am file:
+# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+
+AC_DEFUN([gl_CLOCK_TIME],
+[
+ dnl Persuade glibc and Solaris <time.h> to declare these functions.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+ # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+ # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
+ # programs in the package would end up linked with that potentially-shared
+ # library, inducing unnecessary run-time overhead.
+ gl_saved_libs=$LIBS
+ AC_SEARCH_LIBS(clock_gettime, [rt posix4],
+ [test "$ac_cv_search_clock_gettime" = "none required" ||
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+ AC_SUBST([LIB_CLOCK_GETTIME])
+ AC_CHECK_FUNCS(clock_gettime clock_settime)
+ LIBS=$gl_saved_libs
+])
Added: mgmt/trunk/sesame/cpp/m4/compiler-flags.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/compiler-flags.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/compiler-flags.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,23 @@
+# serial 3
+# Find valid warning flags for the C Compiler. -*-Autoconf-*-
+dnl Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl Written by Jesse Thilo.
+
+AC_DEFUN([gl_COMPILER_FLAGS],
+ [AC_MSG_CHECKING(whether compiler accepts $1)
+ AC_SUBST(COMPILER_FLAGS)
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $1"
+ AC_TRY_COMPILE(,
+ [int x;],
+ COMPILER_FLAGS="$COMPILER_FLAGS $1"
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+ CFLAGS="$ac_save_CFLAGS"
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ])
Added: mgmt/trunk/sesame/cpp/m4/cppunit.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/cppunit.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/cppunit.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,89 @@
+dnl
+dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl
+AC_DEFUN([AM_PATH_CPPUNIT],
+[
+
+AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
+ cppunit_config_prefix="$withval", cppunit_config_prefix="")
+AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
+ cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
+
+ if test x$cppunit_config_exec_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
+ fi
+ fi
+ if test x$cppunit_config_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
+ fi
+ fi
+
+ AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
+ cppunit_version_min=$1
+
+ AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
+ no_cppunit=""
+ if test "$CPPUNIT_CONFIG" = "no" ; then
+ AC_MSG_RESULT(no)
+ no_cppunit=yes
+ else
+ CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
+ CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
+ cppunit_version=`$CPPUNIT_CONFIG --version`
+
+ cppunit_major_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ cppunit_minor_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ cppunit_micro_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+ cppunit_major_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ if test "x${cppunit_major_min}" = "x" ; then
+ cppunit_major_min=0
+ fi
+
+ cppunit_minor_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ if test "x${cppunit_minor_min}" = "x" ; then
+ cppunit_minor_min=0
+ fi
+
+ cppunit_micro_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x${cppunit_micro_min}" = "x" ; then
+ cppunit_micro_min=0
+ fi
+
+ cppunit_version_proper=`expr \
+ $cppunit_major_version \> $cppunit_major_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \> $cppunit_minor_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \= $cppunit_minor_min \& \
+ $cppunit_micro_version \>= $cppunit_micro_min `
+
+ if test "$cppunit_version_proper" = "1" ; then
+ AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
+ else
+ AC_MSG_RESULT(no)
+ no_cppunit=yes
+ fi
+ fi
+
+ if test "x$no_cppunit" = x ; then
+ ifelse([$2], , :, [$2])
+ else
+ CPPUNIT_CFLAGS=""
+ CPPUNIT_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+
+ AC_SUBST(CPPUNIT_CFLAGS)
+ AC_SUBST(CPPUNIT_LIBS)
+])
Added: mgmt/trunk/sesame/cpp/m4/extensions.m4
===================================================================
--- mgmt/trunk/sesame/cpp/m4/extensions.m4 (rev 0)
+++ mgmt/trunk/sesame/cpp/m4/extensions.m4 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,58 @@
+# serial 4 -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
+# Autoconf. Perhaps we can remove this once we can assume Autoconf
+# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+[
+ AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+ AC_BEFORE([$0], [AC_RUN_IFELSE])
+
+ AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([AC_AIX])
+ AC_REQUIRE([AC_MINIX])
+
+ AH_VERBATIM([__EXTENSIONS__],
+[/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+# define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+ AC_DEFINE([_TANDEM_SOURCE])
+])
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
+ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
Added: mgmt/trunk/sesame/cpp/src/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/src/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,14 @@
+SUBDIRS = qmfgen
+AM_CXXFLAGS = -I$(QPID_DIR)/cpp/src -I$(QPID_DIR)/cpp/src/gen -Iqmfgen
+
+include qmfgen/qmfgen.mk
+
+bin_PROGRAMS = sesame
+sesame_SOURCES =\
+ $(qmfgen_sources) \
+ SysAgent.cpp
+
+
+sesame_LDADD = $(QPID_LIBS)
+
+
Added: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp (rev 0)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,196 @@
+
+#include <qpid/management/Manageable.h>
+#include <qpid/management/ManagementObject.h>
+#include <qpid/agent/ManagementAgent.h>
+#include <qpid/sys/Mutex.h>
+#include "qpid/sys/SystemInfo.h"
+#include "qpid/framing/Uuid.h"
+#include "qmf/com/redhat/sesame/Package.h"
+#include "qmf/com/redhat/sesame/SysImage.h"
+
+#include <signal.h>
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+using namespace std;
+using qpid::management::ManagementAgent;
+using qpid::management::ManagementObject;
+using qpid::management::Manageable;
+using qpid::management::Args;
+using qpid::sys::Mutex;
+namespace _qmf = qmf::com::redhat::sesame;
+
+
+class SysAgent : public Manageable
+{
+ ManagementAgent* agent;
+ _qmf::SysImage* mgmtObject;
+ qpid::framing::Uuid sysId;
+
+public:
+
+ SysAgent(ManagementAgent* agent);
+ ~SysAgent() { mgmtObject->resourceDestroy(); }
+
+ ManagementObject* GetManagementObject(void) const
+ { return mgmtObject; }
+ void run();
+
+private:
+ struct LoadAverage {
+ float load1Min;
+ float load5Min;
+ float load10Min;
+ uint32_t procTotal;
+ uint32_t procRunning;
+ };
+
+ struct Mem {
+ uint32_t memTotal;
+ uint32_t memFree;
+ uint32_t swapTotal;
+ uint32_t swapFree;
+ };
+
+ void getLoadAverage(LoadAverage& la);
+ void getMem(Mem& mem);
+};
+
+SysAgent::SysAgent(ManagementAgent* _agent) : agent(_agent)
+{
+ std::string sysname, nodename, release, version, machine;
+
+ // obtain or establish the system-id
+ sysId.generate();
+ mgmtObject = new _qmf::SysImage(agent, this, sysId);
+ qpid::sys::SystemInfo::getSystemId (sysname,
+ nodename,
+ release,
+ version,
+ machine);
+ mgmtObject->set_osName (sysname);
+ mgmtObject->set_nodeName (nodename);
+ mgmtObject->set_release (release);
+ mgmtObject->set_version (version);
+ mgmtObject->set_machine (machine);
+
+ agent->addObject(mgmtObject, 1);
+}
+
+void SysAgent::getLoadAverage(LoadAverage& la)
+{
+ ifstream input("/proc/loadavg");
+ if (!input.good())
+ return;
+
+ input >> la.load1Min;
+ input >> la.load5Min;
+ input >> la.load10Min;
+
+ string procs;
+ input >> procs;
+ input.close();
+
+ la.procTotal = 0;
+ la.procRunning = 0;
+
+ size_t slashPos = procs.find('/');
+ if (slashPos == string::npos)
+ return;
+
+ la.procRunning = ::atoi(procs.substr(0, slashPos).c_str());
+ la.procTotal = ::atoi(procs.substr(slashPos + 1).c_str());
+}
+
+void SysAgent::getMem(Mem& mem)
+{
+ ifstream input("/proc/meminfo");
+ if (!input.good())
+ return;
+
+ while (!input.eof()) {
+ string key;
+ input >> key;
+ if (key == "MemTotal:")
+ input >> mem.memTotal;
+ else if (key == "MemFree:")
+ input >> mem.memFree;
+ else if (key == "SwapTotal:")
+ input >> mem.swapTotal;
+ else if (key == "SwapFree:")
+ input >> mem.swapFree;
+ }
+ input.close();
+}
+
+void SysAgent::run()
+{
+ LoadAverage la;
+ Mem mem;
+
+ getMem(mem);
+ mgmtObject->set_memTotal(mem.memTotal);
+ mgmtObject->set_swapTotal(mem.swapTotal);
+
+ for (;;) {
+ getLoadAverage(la);
+ getMem(mem);
+ mgmtObject->set_loadAverage1Min(la.load1Min);
+ mgmtObject->set_loadAverage5Min(la.load5Min);
+ mgmtObject->set_loadAverage10Min(la.load10Min);
+ mgmtObject->set_procTotal(la.procTotal);
+ mgmtObject->set_procRunning(la.procRunning);
+
+ mgmtObject->set_memFree(mem.memFree);
+ mgmtObject->set_swapFree(mem.swapFree);
+ ::sleep(5);
+ }
+}
+
+//==============================================================
+// Main program
+//==============================================================
+
+ManagementAgent::Singleton* singleton;
+
+void shutdown(int)
+{
+ delete singleton;
+ exit(0);
+}
+
+int main_int(int argc, char** argv)
+{
+ singleton = new ManagementAgent::Singleton();
+ const char* host = argc>1 ? argv[1] : "127.0.0.1";
+ int port = argc>2 ? atoi(argv[2]) : 5672;
+
+ signal(SIGINT, shutdown);
+
+ // Create the qmf management agent
+ ManagementAgent* agent = singleton->getInstance();
+
+ // Register the Qmf_example schema with the agent
+ _qmf::Package packageInit(agent);
+
+ // Start the agent. It will attempt to make a connection to the
+ // management broker
+ agent->init(string(host), port, 5, false, ".magentdata");
+
+ // Allocate core object
+ SysAgent core(agent);
+ core.run();
+}
+
+int main(int argc, char** argv)
+{
+ try {
+ return main_int(argc, argv);
+ } catch(std::exception& e) {
+ cout << "Top Level Exception: " << e.what() << endl;
+ }
+}
+
Added: mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/Makefile.am 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,11 @@
+
+force:
+
+EXTRA_DIST = schema.xml
+
+qmfgen_cmd=$(QMF_GEN) -o $(srcdir)/qmf -m qmfgen.mk -p $$\(top_srcdir\)/src/qmfgen schema.xml
+
+include qmfgen.mk
+
+all : schema.xml
+ $(qmfgen_cmd)
Added: mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/qmfgen.mk 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This source file was created by a code generator.
+# Please do not edit.
+
+
+qmfgen_sources=$(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.h \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.h \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/SysImage.cpp \
+ $(top_srcdir)/src/qmfgen/qmf/com/redhat/sesame/Package.cpp
+
Added: mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml
===================================================================
--- mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml (rev 0)
+++ mgmt/trunk/sesame/cpp/src/qmfgen/schema.xml 2008-11-12 22:20:42 UTC (rev 2789)
@@ -0,0 +1,30 @@
+<schema package="com.redhat.sesame">
+
+ <class name="SysImage">
+ <property name="uuid" index="y" type="uuid" access="RC" desc="UUID of System Image"/>
+
+ <property name="osName" type="sstr" access="RO" desc="Operating System Name"/>
+ <property name="nodeName" type="sstr" access="RO" desc="Node Name"/>
+ <property name="release" type="sstr" access="RO"/>
+ <property name="version" type="sstr" access="RO"/>
+ <property name="machine" type="sstr" access="RO"/>
+
+ <property name="memTotal" type="uint32" access="RO" unit="kByte"/>
+ <property name="swapTotal" type="uint32" access="RO" unit="kByte"/>
+
+ The following statistics are gathered from /proc/meminfo
+
+ <statistic name="memFree" type="uint32" unit="kByte"/>
+ <statistic name="swapFree" type="uint32" unit="kByte"/>
+
+ The following statistics are gathered from /proc/loadavg
+
+ <statistic name="loadAverage1Min" type="float"/>
+ <statistic name="loadAverage5Min" type="float"/>
+ <statistic name="loadAverage10Min" type="float"/>
+ <statistic name="procTotal" type="uint32"/>
+ <statistic name="procRunning" type="uint32"/>
+ </class>
+
+</schema>
+
16 years, 2 months
rhmessaging commits: r2788 - store/branches/java/broker-queue-refactor/java/bdbstore.
by rhmessaging-commits@lists.jboss.org
Author: aidanskinner
Date: 2008-11-12 08:58:11 -0500 (Wed, 12 Nov 2008)
New Revision: 2788
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/build.xml
Log:
Set compile and source targets to 1.5
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/build.xml
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/build.xml 2008-11-11 20:39:13 UTC (rev 2787)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/build.xml 2008-11-12 13:58:11 UTC (rev 2788)
@@ -14,6 +14,8 @@
<property name="release.dir" location="release"/>
<property name="resources.dir" location="resources"/>
<property name="docs.dir" location="docs"/>
+ <property name="java.target" value="1.5"/>
+ <property name="java.source" value="1.5"/>
<property name="build.classes" location="build/classes"/>
<property name="build.test.classes" location="build/test/classes"/>
@@ -72,8 +74,9 @@
<target name="build-main" depends="init">
<javac srcdir="${src.main.dir}"
- destdir="${build.classes}"
- classpathref="test.class.path" debug="on"/>
+ destdir="${build.classes}"
+ target="${java.target}"
+ classpathref="test.class.path" debug="on"/>
</target>
<target name="build-tests" depends="init,build-main">
16 years, 2 months