private String installDir = null;
private String registerInstanceMessage = null;
@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
ctx = context;
logger = context.getLogger();
if (!env.isDas()) {
String msg = Strings.get("notAllowed");
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
// Make sure Node is valid
theNode = nodes.getNode(node);
if (theNode == null) {
String msg = Strings.get("noSuchNode", node);
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
if (lbEnabled != null && clusterName == null) {
String msg = Strings.get("lbenabledNotForStandaloneInstance");
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
nodeHost = theNode.getNodeHost();
nodeDir = theNode.getNodeDirAbsolute();
installDir = theNode.getInstallDir();
// First, update domain.xml by calling _register-instance
CommandInvocation ci = cr.getCommandInvocation("_register-instance", report);
ParameterMap map = new ParameterMap();
map.add("node", node);
map.add("config", configRef);
map.add("cluster", clusterName);
if (lbEnabled != null) {
map.add("lbenabled", lbEnabled.toString());
}
if (!checkPorts) {
map.add("checkports", "false");
}
if (StringUtils.ok(portBase)) {
map.add("portbase", portBase);
}
map.add("systemproperties", systemProperties);
map.add("DEFAULT", instance);
ci.parameters(map);
ci.execute();
if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS
&& report.getActionExitCode() != ActionReport.ExitCode.WARNING) {
// If we couldn't update domain.xml then stop!
return;
}
registerInstanceMessage = report.getMessage();
// if nodehost is localhost and installdir is null and config node, update config node
// so installdir is product root. see register-instance above
if (theNode.isLocal() && installDir == null) {
ci = cr.getCommandInvocation("_update-node", report);
map = new ParameterMap();
map.add("installdir", "${com.sun.aas.productRoot}");
map.add("type", "CONFIG");
map.add("DEFAULT", theNode.getName());
ci.parameters(map);
ci.execute();
if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS
&& report.getActionExitCode() != ActionReport.ExitCode.WARNING) {
// If we couldn't update domain.xml then stop!
return;
}
}
if (!validateDasOptions(context)) {
report.setActionExitCode(ActionReport.ExitCode.WARNING);
return;
}
// Then go create the instance filesystem on the node
createInstanceFilesystem(context);