org.apache.tools.ant.taskdefs.optional.jmx
Class JndiLookup

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.optional.jmx.AbstractManagementTask
                    |
                    +--org.apache.tools.ant.taskdefs.optional.jmx.JndiLookup

public class JndiLookup
extends AbstractManagementTask

This is task allows a lookup to be performed within a JNDI tree. If the lookup is successful, the specified property will be set with a value. The result of the lookup is stored in a reference called named refid. Refer to the user documentation for more information and examples on how to use this task.

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

Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
JndiLookup()
           
 
Method Summary
 void execute()
          Execute the task.
protected  javax.naming.Context getNamingContext(java.lang.String providerUrl, java.lang.String jndiName, java.lang.String user, java.lang.String password)
          Logs into a JMX server and returns the MBeanServer to use during task execution.
 java.lang.String getProperty()
          Getter for property.
 java.lang.String getRefid()
          Getter for property refid.
 void setProperty(java.lang.String property)
          Setter for property.
 void setRefid(java.lang.String refid)
          Setter for property refid.
 
Methods inherited from class org.apache.tools.ant.taskdefs.optional.jmx.AbstractManagementTask
getContext, getFailOnError, getJndiName, getPassword, getProviderUrl, getUser, setContext, setContextRef, setFailOnError, setJndiName, setPassword, setProviderUrl, setServerType, setUser
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiLookup

public JndiLookup()
Method Detail

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute the task.
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - If an error occurs.

getNamingContext

protected javax.naming.Context getNamingContext(java.lang.String providerUrl,
                                                java.lang.String jndiName,
                                                java.lang.String user,
                                                java.lang.String password)
                                         throws javax.naming.NamingException
Logs into a JMX server and returns the MBeanServer to use during task execution. The caller is responsible for invoking this method prior to executing any other methods on this interface.
Parameters:
providerUrl - The url of the JNDI provider.
jndiName - The JNDI name of the MBeanServer.
user - The user name to use for authentication.
password - The password to use for authentication.
Returns:
An MBeanServer.

getProperty

public java.lang.String getProperty()
Getter for property.
Returns:
Value of property.

setProperty

public void setProperty(java.lang.String property)
Setter for property.
Parameters:
property - New value of property.

getRefid

public java.lang.String getRefid()
Getter for property refid.
Returns:
Value of property refid.

setRefid

public void setRefid(java.lang.String refid)
Setter for property refid.
Parameters:
refid - New value of property refid.