[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Naming, @JNDI and OnDemand

alesj do-not-reply at jboss.com
Wed May 13 08:38:15 EDT 2009


"adrian at jboss.org" wrote : 
  | We'll maybe I'm dreaming and didn't actually implement it properly (yet ;-)
  | 
I guess we need something like this:

  | Index: dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java
  | ===================================================================
  | --- dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java       (revision 88788)
  | +++ dependency/src/main/java/org/jboss/dependency/plugins/AbstractController.java       (working copy)
  | @@ -726,8 +726,9 @@
  |              }
  |           }
  | 
  | -         if (ControllerMode.AUTOMATIC.equals(context.getMode()))
  | -            context.setRequiredState(ControllerState.INSTALLED);
  | +         // set the required state
  | +         ControllerMode mode = context.getMode();
  | +         context.setRequiredState(mode.getRequiredState());
  | 
  |           if (trace)
  |              log.trace("Installing " + context.toShortString());
  | Index: dependency/src/main/java/org/jboss/dependency/spi/ControllerMode.java
  | ===================================================================
  | --- dependency/src/main/java/org/jboss/dependency/spi/ControllerMode.java       (revision 88788)
  | +++ dependency/src/main/java/org/jboss/dependency/spi/ControllerMode.java       (working copy)
  | 
  |  public enum ControllerMode
  |  {
  | -   AUTOMATIC("Automatic"),
  | -   @XmlEnumValue("On Demand") ON_DEMAND("On Demand"),
  | +   AUTOMATIC("Automatic", ControllerState.INSTALLED),
  | +   @XmlEnumValue("On Demand") ON_DEMAND("On Demand", ControllerState.DESCRIBED),
  |     MANUAL("Manual"),
  |     DISABLED("Disabled"),
  |     ASYNCHRONOUS("Asynchronous");
  | @@ -46,6 +47,9 @@
  |     /** The mode string */
  |     private final String modeString;
  | 
  | +   /** The required state */
  | +   private ControllerState requiredState;
  | +
  |     /**
  |      * Create a new mode
  |      *
  | @@ -53,9 +57,18 @@
  |      */
  |     private ControllerMode(String modeString)
  |     {
  | +      this(modeString, null);
  | +   }
  | +
  | +   private ControllerMode(String modeString, ControllerState requiredState)
  | +   {
  |        if (modeString == null)
  |           throw new IllegalArgumentException("Null mode string");
  | +      if (requiredState == null)
  | +         requiredState = ControllerState.NOT_INSTALLED;
  | +
  |        this.modeString = modeString;
  | +      this.requiredState = requiredState;
  |     }
  | 
  |     /**
  | @@ -87,6 +100,16 @@
  |        return modeString;
  |     }
  | 
  | +   /**
  | +    * The required state.
  | +    *
  | +    * @return the required state
  | +    */
  | +   public ControllerState getRequiredState()
  | +   {
  | +      return requiredState;
  | +   }
  | +
  | 

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

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



More information about the jboss-dev-forums mailing list