[jboss-dev-forums] [JBoss AS7 Development] - Re: module add listener for standalone xml changes
Dan Sirbu
do-not-reply at jboss.com
Thu Oct 6 14:22:45 EDT 2011
Dan Sirbu [http://community.jboss.org/people/lmcdasi] created the discussion
"Re: module add listener for standalone xml changes"
To view the discussion, visit: http://community.jboss.org/message/630436#630436
--------------------------------------------------------------
The only way that I could figure out - which maybe very well wrong - is to have define a :
modules.registerOperationHandler(ModelDescriptionConstants.ADD, ....)
on a class where one needs to have implemented the execute method. In that method the service can be found and invoke a method from it. The key is to be carefull about the classloader when executing that method (need to set the thread classloader to the class classloader).
At the same time the method shall be executing only id the service has been started .....
if (context.getType() == OperationContext.Type.SERVER) {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
String identifier = operation.get(ModelDescriptionConstants.OP_ADDR).asObject().get(CommonAttributes.MODULE).asString();
..... <YOUR CORE> ....
if (context.completeStep() == OperationContext.ResultAction.ROLLBACK) {
stateService.removeModule(identifier);
}
}
}, OperationContext.Stage.RUNTIME);
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/630436#630436]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111006/d8ec25c2/attachment.html
More information about the jboss-dev-forums
mailing list