Package org.apache.catalina.ant.jmx
Class JMXAccessorCreateTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.apache.catalina.ant.BaseRedirectorHelperTask
-
- org.apache.catalina.ant.jmx.JMXAccessorTask
-
- org.apache.catalina.ant.jmx.JMXAccessorCreateTask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class JMXAccessorCreateTask extends JMXAccessorTask
Create new MBean at JMX JSR 160 MBeans Server.- Create Mbeans
- Create Mbeans with parameter
- Create remote Mbeans with different classloader
Examples:
create a new Mbean at jmx.server connection<jmx:create ref="jmx.server" name="Catalina:type=MBeanFactory" className="org.apache.catalina.mbeans.MBeanFactory" classLoader="Catalina:type=ServerClassLoader,name=server"> <Arg value="org.apache.catalina.mbeans.MBeanFactory" /> </jmxCreate/>WARNINGNot all Tomcat MBeans can create remotely and auto register by its parents! Please, use the MBeanFactory operation to generate valves and realms.
First call to a remote MBean server save the JMXConnection a reference jmx.server
These tasks require Ant 1.6 or later interface.- Since:
- 5.5.12
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.ant.jmx.JMXAccessorTask
JMX_SERVICE_PREFIX, JMX_SERVICE_SUFFIX
-
Fields inherited from class org.apache.catalina.ant.BaseRedirectorHelperTask
alwaysLog, failOnError, redirectErrStream, redirector, redirectorConfigured, redirectorElement, redirectOutput, redirectOutStream
-
-
Constructor Summary
Constructors Constructor Description JMXAccessorCreateTask()Constructs a new JMXAccessorCreateTask.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArg(Arg arg)Add an argument for MBean creation.java.util.List<Arg>getArgs()Get the arguments for MBean creation.java.lang.StringgetClassLoader()Get the class loader for MBean creation.java.lang.StringgetClassName()Get the MBean class name.protected voidjmxCreate(javax.management.MBeanServerConnection jmxServerConnection, java.lang.String name)Create new MBean from ClassLoader identified by an ObjectName.java.lang.StringjmxExecute(javax.management.MBeanServerConnection jmxServerConnection)Execute the specified command, based on the configured properties.voidsetArgs(java.util.List<Arg> args)Set the arguments for MBean creation.voidsetClassLoader(java.lang.String classLoaderName)Set the class loader for MBean creation.voidsetClassName(java.lang.String className)Set the MBean class name.-
Methods inherited from class org.apache.catalina.ant.jmx.JMXAccessorTask
accessJMXConnection, convertStringToType, createJMXConnection, createProperty, createProperty, echoResult, execute, getDelimiter, getHost, getIf, getJMXConnection, getName, getPassword, getPort, getProperty, getRef, getResultproperty, getUnless, getUrl, getUsername, isEcho, isSeparatearrayresults, isUseRef, setDelimiter, setEcho, setHost, setIf, setName, setPassword, setPort, setProperty, setRef, setResultproperty, setSeparatearrayresults, setUnless, setUrl, setUsername, testIfCondition, testUnlessCondition
-
Methods inherited from class org.apache.catalina.ant.BaseRedirectorHelperTask
addConfiguredRedirector, closeRedirector, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, handleOutput, isFailOnError, openRedirector, setAlwaysLog, setAppend, setCreateEmptyFiles, setError, setErrorProperty, setFailonerror, setLogError, setOutput, setOutputproperty
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleInput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Method Detail
-
getClassLoader
public java.lang.String getClassLoader()
Get the class loader for MBean creation.- Returns:
- the class loader
-
setClassLoader
public void setClassLoader(java.lang.String classLoaderName)
Set the class loader for MBean creation.- Parameters:
classLoaderName- the class loader to set
-
getClassName
public java.lang.String getClassName()
Get the MBean class name.- Returns:
- the class name
-
setClassName
public void setClassName(java.lang.String className)
Set the MBean class name.- Parameters:
className- the class name to set
-
addArg
public void addArg(Arg arg)
Add an argument for MBean creation.- Parameters:
arg- the argument to add
-
getArgs
public java.util.List<Arg> getArgs()
Get the arguments for MBean creation.- Returns:
- the arguments
-
setArgs
public void setArgs(java.util.List<Arg> args)
Set the arguments for MBean creation.- Parameters:
args- the arguments to set
-
jmxExecute
public java.lang.String jmxExecute(javax.management.MBeanServerConnection jmxServerConnection) throws java.lang.ExceptionDescription copied from class:JMXAccessorTaskExecute the specified command, based on the configured properties. The input stream will be closed upon completion of this task, whether it was executed successfully or not.- Overrides:
jmxExecutein classJMXAccessorTask- Parameters:
jmxServerConnection- The JMX connection that should be used- Returns:
- An error message string in some situations
- Throws:
java.lang.Exception- if an error occurs
-
jmxCreate
protected void jmxCreate(javax.management.MBeanServerConnection jmxServerConnection, java.lang.String name) throws java.lang.ExceptionCreate new MBean from ClassLoader identified by an ObjectName.- Parameters:
jmxServerConnection- Connection to the JMX servername- MBean name- Throws:
java.lang.Exception- Error creating MBean
-
-