I think you're missing the point?
What is actually required is like "on-demand" processing for pojos
but done for deployments.
i.e. the bundle/deployment should sit at status DESCRIBED or CLASSLOADER
(if somebody manually resolved it) until somebody wants to import from it.
When somebody does that, it should try to move the deployment to INSTALLED
If you look at the AbstractDependencyItem.resolve() there is this code
| if (context == null)
| {
| resolved = false;
| ControllerContext unresolvedContext = controller.getContext(iDependOn,
null);
| if (unresolvedContext != null &&
ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
| {
| try
| {
| controller.enableOnDemand(unresolvedContext);
| }
| catch (Throwable ignored)
| {
| if (log.isTraceEnabled())
| log.trace("Unexpected error", ignored);
| }
| }
| }
|
but RequirementDependencyItem overrides that method so there is no
on-demand processing.
But making deployments have a controller mode of "on-demand" probably isn't
the correct solution? For normal usage they need to be "manual" so that
deployments
are fully under the control of the MainDeployer.
But you could add some similar code to the RequirementDependencyItem, e.g.
(completely untested/compiled etc.)
| // Resolved against a context in the dependent state
| Object iDependOn = module.getContextName();
| ControllerContext context = controller.getContext(iDependOn,
getDependentState());
| if (context != null)
| {
| setIDependOn(context.getName());
| addDependsOnMe(controller, context);
| setResolved(true);
| if (module.getClassLoadingSpace() == null)
| log.warn(getModule() + " resolved " + getRequirement() + "
to " + module + " which has import-all=true. Cannot check its
consistency.");
| return isResolved();
| }
| + else
| + {
| + // The dependent module is not fully installed
| + // if its not currently being processed (required state == state) then try
to fully install it
| + context = controller.getContext(iDependOn, null);
| + if (context != null &&
context.getRequiredState().equals(context.getState()))
| + {
| + try
| + {
| + controller.change(context, ControllerState.INSTALLED);
| + // It worked so we are now resolved
| + if (ControllerState.INSTALLED.equals(context.getState()))
| + {
| + <Same code as above when it was already in the correct
state/>
| + }
| + }
| + catch (Throwable t)
| + {
| + log.trace("Error trying to fully install a dependent module:
" + module, t);
| + }
| + }
| + }
|
You almost certainly need to do something for circular dependencies in this code. :-)
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255154#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...