JBIDeployerpublic class JBIDeployer extends Object Handles all the mbean operations. |
Fields Summary |
---|
private String | PREFIX | private String | DEPLOY_SUFFIX | private String | SHUTDOWN | private String | STARTED | private String | STOPPED | private String | NOTFOUND |
Methods Summary |
---|
void | deploy(javax.management.MBeanServer mbs, java.io.File sa, java.lang.String saName)Get the status of the service assembly, if it is present undeploy it
first. Later deploy ant start the new archive.
if (!getState(mbs, saName).equals(NOTFOUND) ) {
undeploy(mbs, saName);
}
ObjectName deployMbean = getObjectName(mbs);
mbs.invoke(deployMbean, "deploy", new Object[] {sa.getAbsolutePath()},
new String[] {"java.lang.String"});
start(mbs, saName);
| private javax.management.ObjectName | getObjectName(javax.management.MBeanServer mbs)
ObjectName deployMbean = new ObjectName(PREFIX + DEPLOY_SUFFIX);
return mbs.getObjectInstance(deployMbean).getObjectName();
| java.lang.String | getState(javax.management.MBeanServer mbs, java.lang.String sa)Return the state of the service assembly. If it is not found return
NOTFOUND.
String state = NOTFOUND;
try {
ObjectName deployMbean = getObjectName(mbs);
state = (String) mbs.invoke(deployMbean, "getState",
new Object[] {sa}, new String[] {"java.lang.String"});
} catch (Exception e) {
//sLogger.log(Level.FINE, e.getMessage(), e);
}
return state;
| private void | shutdown(javax.management.MBeanServer mbs, java.lang.String sa)
ObjectName deployMbean = getObjectName(mbs);
mbs.invoke(deployMbean, "shutDown", new Object[] {sa},
new String[] {"java.lang.String"});
| private void | start(javax.management.MBeanServer mbs, java.lang.String sa)
ObjectName deployMbean = getObjectName(mbs);
mbs.invoke(deployMbean, "start", new Object[] {sa},
new String[] {"java.lang.String"});
| private void | stop(javax.management.MBeanServer mbs, java.lang.String sa)
ObjectName deployMbean = getObjectName(mbs);
mbs.invoke(deployMbean, "stop", new Object[] {sa},
new String[] {"java.lang.String"});
| void | undeploy(javax.management.MBeanServer mbs, java.lang.String sa)Undeploy the archive. Before doing that, if it is started, stop it.
If it is stopped, shutdown it.
if (STARTED.equals(getState(mbs, sa))) {
stop(mbs, sa);
shutdown(mbs, sa);
}
if (STOPPED.equals(getState(mbs, sa))) {
shutdown(mbs, sa);
}
ObjectName deployMbean = getObjectName(mbs);
mbs.invoke(deployMbean, "undeploy", new Object[] {sa},
new String[] {"java.lang.String"});
|
|