FileDocCategorySizeDatePackage
TargetModuleIDImpl.javaAPI DocJBoss 4.2.15341Fri Jul 13 20:52:34 BST 2007org.jboss.deployment.spi

TargetModuleIDImpl

public class TargetModuleIDImpl extends Object implements javax.enterprise.deploy.spi.TargetModuleID
A TargetModuleID interface represents a unique identifier for a deployed application module. A deployable application module can be an EAR, JAR, WAR or RAR file. A TargetModuleID can represent a root module or a child module. A root module TargetModuleID has no parent. It represents a deployed EAR file or stand alone module. A child module TargetModuleID represents a deployed sub module of a J2EE application. A child TargetModuleID has only one parent, the super module it was bundled and deployed with. The identifier consists of the target name and the unique identifier for the deployed application module.
author
thomas.diesler@jboss.org
author
dimitris.andreadis@jboss.org
version
$Revision: 62519 $

Fields Summary
private TargetModuleIDImpl
parentModuleID
private List
childModuleIDs
private JBossTarget
target
private String
moduleID
private javax.enterprise.deploy.shared.ModuleType
moduleType
private boolean
isRunning
Constructors Summary
public TargetModuleIDImpl(javax.enterprise.deploy.spi.Target target, String moduleID, javax.enterprise.deploy.spi.TargetModuleID parentModuleID, boolean isRunning, javax.enterprise.deploy.shared.ModuleType moduleType)
Construct a new target module


            
             
   
      this.target = (JBossTarget)target;
      this.moduleID = moduleID;
      this.parentModuleID = (TargetModuleIDImpl)parentModuleID;
      this.isRunning = isRunning;
      this.moduleType = moduleType;
   
Methods Summary
public voidaddChildTargetModuleID(javax.enterprise.deploy.spi.TargetModuleID childModuleID)

      childModuleIDs.add(childModuleID);
   
public booleanequals(java.lang.Object obj)
Equality is defined by moduleType, moduleID, and parentModuleID

      boolean equals = false;
      if (obj instanceof TargetModuleIDImpl)
      {
         TargetModuleIDImpl other = (TargetModuleIDImpl)obj;
         equals = moduleType.equals(other.moduleType) && moduleID.equals(other.moduleID);
         if (equals && parentModuleID != null)
            equals = equals && parentModuleID.equals(other.parentModuleID);
      }
      return equals;
   
public javax.enterprise.deploy.spi.TargetModuleID[]getChildTargetModuleID()
Get the child modules

return
an array of child modules or null if there are no children

      int children = childModuleIDs.size();
      if (children > 0)
      {
         TargetModuleID[] idarr = new TargetModuleID[children];
         childModuleIDs.toArray(idarr);
         return idarr;
      }
      else
      {
         return null;
      }
   
public java.lang.StringgetModuleID()
Get the module id

return
the id

      return moduleID;
   
public javax.enterprise.deploy.shared.ModuleTypegetModuleType()
Get this modules type.

      return moduleType;
   
public javax.enterprise.deploy.spi.TargetModuleIDgetParentTargetModuleID()
The parent of this module

return
the parent or null if there is no parent

      return parentModuleID;
   
public javax.enterprise.deploy.spi.TargetgetTarget()
Get the target

return
the target

      return target;
   
public java.lang.StringgetWebURL()
The URL for a web module

return
the url

      return null; //[todo] implement method
   
public inthashCode()

      String hashStr = moduleType + moduleID;
      if (parentModuleID != null)
      {
         hashStr += parentModuleID.moduleID;
      }
      return hashStr.hashCode();
   
public booleanisRunning()
True if the module is running.

      return isRunning;
   
public java.lang.StringtoString()

      StringBuffer sbuf = new StringBuffer(128);
      
      String parentID = (parentModuleID != null ? parentModuleID.moduleID : null);
      sbuf.append("[host=").append(target.getHostName());
      sbuf.append(",id=").append(moduleID);
      sbuf.append(",parent=").append(parentID);
      sbuf.append(",children=").append(childModuleIDs);
      sbuf.append("]");
      
      return sbuf.toString();