// register DasJ2EE Server
public void registerDasJ2EEServer(String serverName) {
// vars
DomainStatusHelper dsh = new DomainStatusHelper();
try {
// check if the DomainStatusMBean is registered or not
if (! server.isRegistered(dsh.getDomainStatusObjectName())) {
registerDomainStatusMBean();
}
// set this server state to STARTING if not already set
try {
dsh.getstate(serverName);
} catch (Exception e) {
Object[] params = new Object[2];
params[0] = (Object) serverName;
params[1] = (Object) Integer.valueOf(StateManageable.STATE_STARTING);
String[] signature = {"java.lang.String", "java.lang.Integer"};
server.invoke(dsh.getDomainStatusObjectName(), "setstate", params, signature);
}
// object name for j2ee server
/*
String strON = (
ApplicationServer.getServerContext().getDefaultDomainName() + ":" +
"j2eeType=J2EEServer," +
"name=" + serverName +
",category=dasJ2EE"
);
ObjectName on = new ObjectName(strON);
*/
ObjectName on = new ObjectName(getServerBaseON(true, serverName));
DASJ2EEServerImpl ds = new DASJ2EEServerImpl();
ObjectInstance oi = server.registerMBean(ds, on);
// register the notification listener
server.addNotificationListener(
dsh.getDomainStatusObjectName(),
oi.getObjectName(),
null, null);
} catch(MalformedObjectNameException e) {
e.printStackTrace();
_logger.log(Level.WARNING, "admin.registerDasJ2EEServer exception", e);