Carlos Quiroz
2002-02-17 20:13:03 UTC
Hi all
Tired of writing long Java management code for simple tasks? Do them in
jython :-)
I just commited the JythonRunner MBean. It basically allows you to use jython
scripts which may reduce the size of your code and allow changes in runtime.
The scripts are loaded at every run, and can be modified in runtime. The
MBean can be tied to a NotificationBroadcaster (monitor, timer, etc..) and it
will be executed when a notification is emitted. You can also call directly
runScript().
The variable server is automatically available and points to the current
server. Statements like these below are valid
#makes a list of all mbeans
[server.queryMBean(None, None)]
#prints the description of the MBean Domain:name=test
print server.getMBeanInfo(ObjectName("Domain:name=test")).description
I also added a openjmx module which is automatically imported and it adds all
the jmx core classes and a proxy class. The proxy class is similar to the
StandardMBeanProxy and can be used like this:
name = ObjectName("Domain:name=test")
#create proxy
p = proxy(name)
#print attribute counter
print p.counter
#change attribute attr
p.attr=5
#invoke method start (Notice that method with arguments are not availabe yet
p.start()
The docs are comming soon
Regards
Carlos Quiroz
Tired of writing long Java management code for simple tasks? Do them in
jython :-)
I just commited the JythonRunner MBean. It basically allows you to use jython
scripts which may reduce the size of your code and allow changes in runtime.
The scripts are loaded at every run, and can be modified in runtime. The
MBean can be tied to a NotificationBroadcaster (monitor, timer, etc..) and it
will be executed when a notification is emitted. You can also call directly
runScript().
The variable server is automatically available and points to the current
server. Statements like these below are valid
#makes a list of all mbeans
[server.queryMBean(None, None)]
#prints the description of the MBean Domain:name=test
print server.getMBeanInfo(ObjectName("Domain:name=test")).description
I also added a openjmx module which is automatically imported and it adds all
the jmx core classes and a proxy class. The proxy class is similar to the
StandardMBeanProxy and can be used like this:
name = ObjectName("Domain:name=test")
#create proxy
p = proxy(name)
#print attribute counter
print p.counter
#change attribute attr
p.attr=5
#invoke method start (Notice that method with arguments are not availabe yet
p.start()
The docs are comming soon
Regards
Carlos Quiroz