|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mx4j.tools.jython.JythonRunner
This MBean enables you to run scripts written in jython. Scripts can be run using the managed operation runScript or by listening notifcations from another MBean. To us it you need to install jython 2.1 or higher from <a href="http://www.jython.org">here</a> If you want to use a jython library remember to add the jython jar to the classpath in the right location or modify the python.path address The scripts have always the "server" embedded variable which points to the current server. It also automatically import some JMX modules as:
Constructor Summary | |
---|---|
JythonRunner()
|
Method Summary | |
---|---|
boolean |
getCacheScript()
Returns whether the script should be kept in the cache. |
java.lang.String |
getNotificationType()
Gets the specific notification type being listened |
ObjectName |
getObservedObject()
Gets the object being observed by this MBean |
static org.python.util.PythonInterpreter |
getPythonInterpreter()
|
java.lang.String |
getScript()
Returns the script as text. |
java.net.URL |
getScriptFile()
Returns the URL pointing to the script source |
boolean |
getUseText()
Indicates wether to use the script given in the ScripText variable or the one given in the script File. |
void |
handleNotification(Notification notification,
java.lang.Object handback)
Called when a notification occurs. |
protected static java.lang.String |
loadStream(java.io.InputStream in)
|
void |
postDeregister()
Called upon after the MBean has been de-registered. |
void |
postRegister(java.lang.Boolean registrationDone)
Called upon after a registration ( successful or not ). |
void |
preDeregister()
Called upon before an MBean will be de-registered by
the MBeanServer . |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Gathers some basic data |
protected void |
registerListener()
|
void |
runScript()
Executes a given script. |
void |
setCacheScript(boolean useCache)
Sets whether the script should be kept in the cache. |
void |
setNotificationType(java.lang.String notificationName)
Sets the notification being listed. |
void |
setObservedObject(ObjectName targetMBeanName)
Sets the object being observed by this MBean. |
void |
setScript(java.lang.String text)
Sets the content of the script. |
void |
setScriptFile(java.net.URL file)
Sets the script source as URL. |
protected void |
unregisterListener()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JythonRunner()
Method Detail |
public void handleNotification(Notification notification, java.lang.Object handback)
NotificationListener
handleNotification
in interface NotificationListener
javax.management.NotificationListener
notification
- The notification objecthandback
- Helps in associating information regarding the listener.public void runScript()
runScript
in interface JythonRunnerMBean
public static org.python.util.PythonInterpreter getPythonInterpreter()
protected static java.lang.String loadStream(java.io.InputStream in) throws java.io.IOException
public java.lang.String getNotificationType()
getNotificationType
in interface JythonRunnerMBean
public void setNotificationType(java.lang.String notificationName)
setNotificationType
in interface JythonRunnerMBean
public void setObservedObject(ObjectName targetMBeanName)
setObservedObject
in interface JythonRunnerMBean
public ObjectName getObservedObject()
getObservedObject
in interface JythonRunnerMBean
public boolean getUseText()
getUseText
in interface JythonRunnerMBean
public void setScript(java.lang.String text)
setScript
in interface JythonRunnerMBean
public java.lang.String getScript()
getScript
in interface JythonRunnerMBean
public java.net.URL getScriptFile()
getScriptFile
in interface JythonRunnerMBean
public void setScriptFile(java.net.URL file)
setScriptFile
in interface JythonRunnerMBean
public boolean getCacheScript()
getCacheScript
in interface JythonRunnerMBean
public void setCacheScript(boolean useCache)
setCacheScript
in interface JythonRunnerMBean
public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
preRegister
in interface MBeanRegistration
javax.management.MBeanRegistration
server
- The MBeanServer on which the MBean will be registered.name
- The ObjectName
of the MBean.java.lang.Exception
- Exception of the operation. Note that this is caught
by the MBeanServer
and re-thrown as an
MBeanRegistrationException
.public void postRegister(java.lang.Boolean registrationDone)
MBeanRegistration
postRegister
in interface MBeanRegistration
javax.management.MBeanRegistration
registrationDone
- Evaluates to true of the registrations
is successful, false otherwise.public void preDeregister() throws java.lang.Exception
MBeanRegistration
MBean
will be de-registered by
the MBeanServer
.preDeregister
in interface MBeanRegistration
javax.management.MBeanRegistration
java.lang.Exception
- Would be caught by the MBeanServer
and rethrown as an MBeanRegistrationException.public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
protected void registerListener()
protected void unregisterListener()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |