FileDocCategorySizeDatePackage
AdminObject.javaAPI DocJBoss 4.2.14980Fri Jul 13 21:01:16 BST 2007org.jboss.resource.deployment

AdminObject

public class AdminObject extends org.jboss.system.ServiceMBeanSupport implements AdminObjectMBean
An admin object deployment
author
Adrian Brock
version
$Revision: 57189 $

Fields Summary
protected ObjectName
rarName
The resource adapter name
protected String
type
The admin object type
protected Properties
properties
The properties
protected String
jndiName
The jndi name
Constructors Summary
Methods Summary
protected voidbind(java.lang.Object object)
Bind the object into jndi

param
object the object to bind
throws
Exception for any error

      InitialContext ctx = new InitialContext();
      try
      {
         Util.bind(ctx, jndiName, object);
         log.info("Bound admin object '" + object.getClass().getName() + "' at '" + jndiName + "'");
      }
      finally
      {
         ctx.close();
      }
   
protected java.lang.ObjectcreateAdminObject(org.jboss.resource.metadata.AdminObjectMetaData aomd)
Create the admin object

param
aomd the admin object metadata
return
the admin object
throws
DeploymentException for any error

      try
      {
         return AdminObjectFactory.createAdminObject(jndiName, rarName, aomd, properties);
      }
      catch (Throwable t)
      {
         DeploymentException.rethrowAsDeploymentException("Error creating admin object metadata type=" + type + " ra=" + rarName, t);
         return null; // unreachable
      }
   
public java.lang.StringgetJNDIName()

      return jndiName;
   
public java.util.PropertiesgetProperties()

      return properties;
   
public javax.management.ObjectNamegetRARName()

      return rarName;
   
public java.lang.StringgetType()

      return type;
   
protected org.jboss.resource.metadata.AdminObjectMetaDataretrieveAdminObjectMetaData()
Retrieve the admin object metadata

return
the admin object metadata
throws
DeploymentException for any error

      try
      {
         ConnectorMetaData cmd = (ConnectorMetaData) server.getAttribute(rarName, "MetaData");
         return cmd.getAdminObject(type);
      }
      catch (Throwable t)
      {
         DeploymentException.rethrowAsDeploymentException("Error retrieving admin object metadata type=" + type + " ra=" + rarName, t);
         return null; // unreachable
      }
   
public voidsetJNDIName(java.lang.String jndiName)

      this.jndiName = jndiName;
   
public voidsetProperties(java.util.Properties properties)

      this.properties = properties;
   
public voidsetRARName(javax.management.ObjectName rarName)

      this.rarName = rarName;
   
public voidsetType(java.lang.String type)

      this.type = type;
   
protected voidstartService()

      AdminObjectMetaData aomd = retrieveAdminObjectMetaData();
      if (aomd == null)
         throw new DeploymentException("No admin object metadata type=" + type + " ra=" + rarName);

      Object adminObject = createAdminObject(aomd);
      
      bind(adminObject);
   
protected voidstopService()

      unbind();
   
protected voidunbind()
Unbind the object from jndi

throws
Exception for any error

      InitialContext ctx = new InitialContext();
      try
      {
         Util.unbind(ctx, jndiName);
         log.info("Unbound admin object at '" + jndiName + "'");
      }
      finally
      {
         ctx.close();
      }