[jboss-dev-forums] [Design of OSGi Integration] - Re: Facade Questions

alesj do-not-reply at jboss.com
Mon Feb 25 09:36:24 EST 2008


"johnbailey" wrote : Makes sense.  I wasn't sure if it would be in a state that would allow it to move directly to INSTALLED.
  | 
You can always try to move it to any state from any state (except error state).
But it doesn't mean it will actually move there - e.g. still some unresolved dependencies 'blocking' the transition.

"johnbailey" wrote : 
  | The getState method will simply map the ControllerState to an equivelent Bundle State.  Are the following resonable?
  | 
  | 
  |   |          ControllerState controllerState = getControllerContext().getState();
  |   |          if (ControllerState.ERROR.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.INSTALLED; // Seems strange, but see javadoc 
  |   |          }
  |   |          else if (ControllerState.NOT_INSTALLED.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.UNINSTALLED;
  |   |          }
  |   |          else if (ControllerState.PRE_INSTALL.equals(controllerState)
  |   |                || ControllerState.DESCRIBED.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.INSTALLED;
  |   |          }
  |   |          else if (ControllerState.INSTANTIATED.equals(controllerState)
  |   |                || ControllerState.CONFIGURED.equals(controllerState) 
  |   |                || ControllerState.CREATE.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.RESOLVED;
  |   |          }
  |   |          else if (ControllerState.START.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.STARTING;
  |   |          }
  |   |          else if (ControllerState.INSTALLED.equals(controllerState))
  |   |          {
  |   |             bundleState = Bundle.ACTIVE;
  |   |          }
  |   | 
  | 
Let's make this more OO. ;-)
e.g.

  | List<BundleState2ControllerState> states ...
  | ...
  | for(BundleState2ControllerState bs2cs : states)
  | {
  |    if (bs2cs.getControllerState().equals(state))
  |       return bs2cs.getBundleState();
  | }
  | throw new IllegalArgumentException("No such matching BS2CS.");
  | 

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

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



More information about the jboss-dev-forums mailing list