1 Reply Latest reply on Mar 31, 2010 7:46 AM by alesj

    setRequiredStage should also setRequiredState

      This patch in OSGi shows that there is something wrong with AbstractDeploymentContext.setRequiredStage().

       

      You shouldn't have to explicitly do the ControllerContext.setRequiredState(), that is an implementation detail.

       

      Index: PackageAdminImpl.java
      ===================================================================
      --- PackageAdminImpl.java    (revision 103305)
      +++ PackageAdminImpl.java    (working copy)
      @@ -347,6 +347,18 @@
             {
                log.error("Error resolving bundles: " + resolvableBundles, ex);
                allResolved = false;
      +        
      +         // Reset the required state for bundles that didn't get resolved
      +         for (OSGiBundleState bundleState : resolvableBundles)
      +         {
      +            if (bundleState.getState() == Bundle.INSTALLED)
      +            {
      +               DeploymentUnit unit = bundleState.getDeploymentUnit();
      +               unit.setRequiredStage(DeploymentStages.DESCRIBE);
      +               ControllerContext ctx = unit.getAttachment(ControllerContext.class);
      +               ctx.setRequiredState(ControllerState.newState(DeploymentStages.DESCRIBE.getName()));
      +            }
      +         }
             }
            
             return allResolved;