org.apache.tools.ant.taskdefs.optional.jmx.connector
Class AbstractJMXConnector

java.lang.Object
  |
  +--org.apache.tools.ant.taskdefs.optional.jmx.connector.AbstractJMXConnector
All Implemented Interfaces:
JMXConnector
Direct Known Subclasses:
Connector, Connector, Connector

public abstract class AbstractJMXConnector
extends java.lang.Object
implements JMXConnector

Abstract base implementation of JMXConnector for JMX server types that are located through JNDI.

Version:
$Id: AbstractJMXConnector.java,v 1.5 2003/05/28 22:28:26 bdueck Exp $
Author:
Brian Dueck

Constructor Summary
AbstractJMXConnector()
          Creates a new instance of AbstractJMXConnector
 
Method Summary
 javax.management.ObjectName createMBean(java.lang.String type, javax.management.ObjectName objectName, javax.management.MBeanServer mbserver)
          This implementation simply calls mbserver.createMBean().
 java.lang.String getActiveDomain(javax.management.MBeanServer mbserver)
          This implementation returns mbserver.getDefaultDomain() as the active/default domain.
 java.util.Hashtable getInitialContextProperties(java.util.Hashtable contextProps)
          This implementation returns the contextProps unmodified.
 java.util.Hashtable getInitialContextProperties(java.lang.String providerUrl, java.lang.String user, java.lang.String password)
          Returns a base set of initial context properties that apply to this JMXServer adaptor.
abstract  javax.management.MBeanServer getMBeanServer(javax.naming.Context context, java.lang.String jndiLookupName)
          Connects to a JMX server and returns the MBeanServer to use during task execution.
 javax.management.MBeanServer getMBeanServer(java.util.Hashtable contextProps, java.lang.String jndiLookupName)
          Connects to a JMX server and returns the MBeanServer to use during task execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJMXConnector

public AbstractJMXConnector()
Creates a new instance of AbstractJMXConnector
Method Detail

getInitialContextProperties

public java.util.Hashtable getInitialContextProperties(java.lang.String providerUrl,
                                                       java.lang.String user,
                                                       java.lang.String password)
Description copied from interface: JMXConnector
Returns a base set of initial context properties that apply to this JMXServer adaptor. These properties will be used in conjuntion with additional properties obtained from the task - for example, user and password information. This is a convenience wrapper to allow minimimum set of properties to be specified without manipulating the hashtable directly. NOTE: If any of these values are null, they will be ignored.
Specified by:
getInitialContextProperties in interface JMXConnector

createMBean

public javax.management.ObjectName createMBean(java.lang.String type,
                                               javax.management.ObjectName objectName,
                                               javax.management.MBeanServer mbserver)
                                        throws javax.management.MBeanRegistrationException
This implementation simply calls mbserver.createMBean().
Specified by:
createMBean in interface JMXConnector
Following copied from interface: org.apache.tools.ant.taskdefs.optional.jmx.connector.JMXConnector
Parameters:
type - The type or classname of the MBean to create.
objectName - The name of the MBean to create.
mbserver - The server where the new MBean will be created.

getActiveDomain

public java.lang.String getActiveDomain(javax.management.MBeanServer mbserver)
This implementation returns mbserver.getDefaultDomain() as the active/default domain.
Specified by:
getActiveDomain in interface JMXConnector

getInitialContextProperties

public java.util.Hashtable getInitialContextProperties(java.util.Hashtable contextProps)
This implementation returns the contextProps unmodified.
Specified by:
getInitialContextProperties in interface JMXConnector

getMBeanServer

public javax.management.MBeanServer getMBeanServer(java.util.Hashtable contextProps,
                                                   java.lang.String jndiLookupName)
                                            throws org.apache.tools.ant.BuildException
Description copied from interface: JMXConnector
Connects to a JMX server and returns the MBeanServer to use during task execution. The caller is responsible for invoking this method prior to invoking createMBean() or getActiveDomain() methods on this interface. The getInitialContextProperties() method will be invoked prior to this method.
Specified by:
getMBeanServer in interface JMXConnector
Following copied from interface: org.apache.tools.ant.taskdefs.optional.jmx.connector.JMXConnector
Parameters:
context - The set of properties used to locate and connect to the JMX server.
jndiLookupName - The JNDI entry name for the MBeanServer.

getMBeanServer

public abstract javax.management.MBeanServer getMBeanServer(javax.naming.Context context,
                                                            java.lang.String jndiLookupName)
                                                     throws javax.naming.NamingException,
                                                            org.apache.tools.ant.BuildException
Connects to a JMX server and returns the MBeanServer to use during task execution. The caller is responsible for invoking this method prior to invoking createMBean() or getActiveDomain() methods on this interface. The getInitialContextProperties() method will be invoked prior to this method.
Parameters:
context - The JNDI naming context to use to lookup the jndiLookupName entry. The caller is responsible for closing this context.
jndiLookupName - The JNDI entry name for the MBeanServer.