Path archivePath = null;
Throwable exception = null;
TargetImpl childTarget = new TargetImpl(moduleID, "");
TargetModuleIDImpl childModuleID
= new TargetModuleIDImpl(childTarget, moduleID);
if (mxbean != null) {
try {
Path deployPath = Vfs.lookup(mxbean.getArchivePath(name));
deployPath.getParent().mkdirs();
if (archivePath == null) {
createArchive(deployPath, plan, archiveIs);
archivePath = deployPath;
}
else {
WriteStream deployStream = deployPath.openWrite();
try {
deployStream.writeFile(archivePath);
}
finally {
deployStream.close();
}
}
mxbean.update();
exception = mxbean.getConfigException(name);
}
catch (Exception e) {
if (log.isLoggable(Level.INFO))
log.log(Level.INFO, e.toString(), e);
exception = e;
}
if (exception != null) {
failed = true;
describe(message, childModuleID, false, getExceptionMessage(exception));
/*
if (mxbean != null) {
try {
mxbean.undeploy(moduleID);
}
catch (Throwable t) {
log.log(Level.FINE, t.toString(), t);
}
}
*/
}
else {
if ("ear".equals(plan.getArchiveType())) {
try {
EAppMXBean eApp = (EAppMXBean) Jmx.find(moduleID);
if (eApp != null)
childTarget.setClientRefs(eApp.getClientRefs());
} catch (Exception e) {
log.log(Level.FINEST, e.toString(), e);
}
}