[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: 2.0.0-beta7 release

alesj do-not-reply at jboss.com
Fri Nov 23 13:24:02 EST 2007


This is the change I was talking about (AbstractRealDeployer):

  |    public final void deploy(DeploymentUnit unit) throws DeploymentException
  |    {
  |       internalDeploy(unit);
  | 
  |       if (isControllerContextNameCandidate(unit))
  |       {
  |          addControllerContextName(unit);
  |       }
  |    }
  | 
  |    /**
  |     * Should we set controller context name on unit?
  |     *
  |     * @param unit the dpeloyment unit
  |     * @return true if we should use unit's name as controller context name
  |     */
  |    protected boolean isControllerContextNameCandidate(DeploymentUnit unit)
  |    {
  |       return useUnitName && unit.isComponent();
  |    }
  | 
  |    /**
  |     * Deploy a deployment
  |     *
  |     * @param unit the unit
  |     * @throws DeploymentException for any error
  |     */
  |    protected abstract void internalDeploy(DeploymentUnit unit) throws DeploymentException;
  | 
  |    /**
  |     * Add controller context name.
  |     *
  |     * @param unit the deployment unit
  |     */
  |    protected void addControllerContextName(DeploymentUnit unit)
  |    {
  |       unit.addControllerContextName(unit.getName());
  |    }
  | 
  |    /**
  |     * Remove controller context name.
  |     *
  |     * @param unit the deployment unit
  |     */
  |    protected void removeControllerContextName(DeploymentUnit unit)
  |    {
  |       unit.removeControllerContextName(unit.getName());
  |    }
  | 
  |    public final void undeploy(DeploymentUnit unit)
  |    {
  |       try
  |       {
  |          if (isControllerContextNameCandidate(unit))
  |          {
  |             removeControllerContextName(unit);
  |          }
  |       }
  |       catch (Throwable t)
  |       {
  |          if (log.isTraceEnabled())
  |             log.trace("Exception while removing unit name: " + t);
  |       }
  | 
  |       internalUndeploy(unit);
  |    }
  | 
  |    /**
  |     * Undeploy an deployment
  |     *
  |     * @param unit the unit
  |     */
  |    protected void internalUndeploy(DeploymentUnit unit)
  |    {
  |       // nothing
  |    }
  | 
  |    /**
  |     * Should we use unit name for controller context name.
  |     *
  |     * @return true if usage is allowed
  |     */
  |    public boolean isUseUnitName()
  |    {
  |       return useUnitName;
  |    }
  | 
  |    /**
  |     * Set use unit name for controller context name.
  |     *
  |     * @param useUnitName flag to allow unit name usage
  |     */
  |    public void setUseUnitName(boolean useUnitName)
  |    {
  |       this.useUnitName = useUnitName;
  |    }
  | 

Since I want to explicitly force this name registration on the real deployers - hence making the deploy/undeploy methods final.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107422#4107422

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107422



More information about the jboss-dev-forums mailing list