Hi guys,
For the Mobicent SIP Servlet project that is build on top of AS7, we have
some CLI operations to list available SIP Servlet application, to gracefuly
stop the context and the server. These operations work fine when the server
runs in standalone mode using the command:
/subsystem=sip:listSipAppplications
But when running in domain mode the command should be (sip subsystem
belongs to the default profile) :
/profile=default/subsystem=sip:listSipAppplications
But then we get an NPE because the context that the operation executes is
not a normal server:
@Override
public void execute(OperationContext context, ModelNode operation)
throws OperationFailedException {
ModelNode result = context.getResult();
result.get("AppName").setEmptyList();
if(context.isNormalServer()){
SipApplicationDispatcher sipApplicationDispatcher =
StaticServiceHolder.sipStandardService.getSipApplicationDispatcher();
Iterator<SipContext> sipApps =
sipApplicationDispatcher.findSipApplications();
while(sipApps.hasNext()){
result.get("AppName").add(sipApps.next().getApplicationName());
}
} else {
throw new OperationFailedException(new ModelNode().set("Operation
available only a Server"));
}
context.completeStep();
}
Is there a way we can specify a server node that the operation should
execute?
Also, in standalone mode, we gracefuly shutdown the server and the contexts
running using the following:
protected void shutdownServer() throws MalformedObjectNameException,
NullPointerException, InstanceNotFoundException, MBeanException,
ReflectionException, IOException{
MBeanServerConnection mbeanServerConnection =
ManagementFactory.getPlatformMBeanServer();
ObjectName mbeanName = new ObjectName("jboss.as:management-root=server");
Object[] args = {false};
String[] sigs = {"java.lang.Boolean"};
mbeanServerConnection.invoke(mbeanName, "shutdown", args, sigs);
}
And this one fails when server runs in domain mode.
Any ideas?
Thanks
George