CopyMBean

Description

A task to allows a JMX MBean and all its attributes to be copied to a new domain and/or mbean name.

Note: This task depends on external libraries that are not included in the Ant distribution.

Parameters

Attribute Description Required
toName The object name of the new (destination) JMX MBean. This name follows the same form as the name attribute. The toName defaults the type and domain from the name attribute if not specified. Yes
type Specifies the type or class name of the MBean to create. No
ifExists Specifies the action to take if an MBean already exists with the same name as specified by name. Valid values are:
fail : Fail the task if the MBean already exists

skip : Skip this task if the MBean already exists

replace : Delete and replace the MBean

warn : Log a message if the mbean to be created already exists, but leave the existing mbean in place without any modification. Any nested setAttribute elements will be ignored.
replaceAttributes : Leave the existing mbean in place but will copy all attributes from the source mbean to the target mbean.
The default value is fail.
No
mbeanref A reference to a mbean type.

If a reference to an mbean is specified, then the name, serverType, providerUrl, jndiName, user, and password attributes of this task are not used.
No
name The object name of the JMX MBean. This name follows the standard JMX ObjectName form of:
[domainName]:[property=value][,property=value]*
Here are some examples for weblogic:
mydomain:Name=myconnectionPool,Type=JDBCConnectionPool

:Name=myconnectionPool,Type=JDBCConnectionPool
Here are some examples for jboss:
jboss.system:service=MainDeployer

jboss.system:type=Server
Yes

Unless mbeanref is set
serverType The type of server involved. Valid values are weblogic, jboss, or jboss.ejb. The setting of this value determines the default value for the jndiName and providerUrl attributes.

NOTE:If this value is other than weblogic, jboss, or jboss.ejb then it is assumed to be a fully qualified class name that implements org.apache.tools.ant.taskdefs.optional.jmx.connector.JMXConnector. This is used to support additional types of servers without modifying the Ant JMX task classes.
Yes

Unless mbeanref is set
providerUrl The JNDI providerUrl for the JMX MBean server. If serverType is set to weblogic, the default value is t3://localhost:7001. If serverType is set to jboss, the default value is jnp://localhost:1099. No
jndiName The JNDI name for the JMX MBeanServer. If serverType is set to weblogic, the default value is weblogic.management.adminhome. If serverType is set to jboss, the default value is jmx:<hostname>:rmi. No
user The user name used for authentication with the JMX server. No
password The password used for authentication with the JMX server. No
failOnError If an error is detected (e.g. can't contact server, bad login, etc.), should this cause the task to fail? The default value is false, meaning a warning message will be logged but the build will continue. No

Examples

Creates a new JDBCConnectionPool called newPool by copying all the attributes from an MBean named "mypool". If an MBean with the same name exists it is deleted and replaced. Both MBeans are in the default domain accessible at the providerUrl t3://bigHost:7001.
<copyMBean toName=":Name=newPool" name="mydomain:Name=myPool,Type=JDBCConnectionPool"
ifExists="replace" serverType="weblogic" providerUrl="t3://bigHost:7001" user="system" password="secret"/> 

$Id: CopyMBeanTask.html,v 1.3 2003/05/28 22:26:30 bdueck Exp $

Copyright © 2002 Apache Software Foundation. All rights Reserved.