[jboss-user] [JBoss Microcontainer Development] - setRequiredStage should also setRequiredState

Adrian Brock do-not-reply at jboss.com
Wed Mar 31 07:30:04 EDT 2010


Adrian Brock [http://community.jboss.org/people/adrian%40jboss.org] created the discussion

"setRequiredStage should also setRequiredState"

To view the discussion, visit: http://community.jboss.org/message/534876#534876

--------------------------------------------------------------
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;

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/534876#534876]

Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100331/0e878b09/attachment.html 


More information about the jboss-user mailing list