public String getMessage() { return report.getMessage(); } };
protected void setActionReport(ActionReport ar) { this.actionReport = ar; if (ar == null) { this.output = null; } else { StringBuilder sb = new StringBuilder(); if (ar instanceof CliActionReport) { addCombinedMessages((CliActionReport) ar, sb); } else if (ar.getMessage() != null) { sb.append(ar.getMessage()); } addSubMessages("", ar.getTopMessagePart(), sb); this.output = sb.toString(); if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "------ ACTION REPORT ------"); logger.log(Level.FINER, String.valueOf(actionReport)); logger.log(Level.FINER, "---- END ACTION REPORT ----"); } } }
/** * Provide a warning message to the user. The message is appended to any * already-existing warning message text. * @param msg Message for user. */ public static void warnUser(ActionReport report, String msg) { if (report != null) { StringBuffer sb = new StringBuffer(); String s = report.getMessage(); if (s != null) { sb.append(s); } sb.append("\n").append(msg); // NOI18N report.setMessage(sb.toString()); report.setActionExitCode(ActionReport.ExitCode.WARNING); } }
"deploy", "failed to deploy {0} for following reason: {1} ", new Object[]{b, reporter.getMessage()}); throw new RuntimeException("Failed to deploy bundle [ " + b + " ], root cause: " + reporter.getMessage(), reporter.getFailureCause());
"deploy", "failed to deploy {0} for following reason: {1} ", new Object[]{b, reporter.getMessage()}); throw new RuntimeException("Failed to deploy bundle [ " + b + " ], root cause: " + reporter.getMessage(), reporter.getFailureCause());
private String killInstance(AdminCommandContext context) { String msg = initializeInstance(); if (msg != null) return msg; String nodeName = instance.getNodeRef(); Node node = nodes.getNode(nodeName); NodeUtils nodeUtils = new NodeUtils(habitat, logger); // asadmin command to run on instances node ArrayList<String> command = new ArrayList<String>(); command.add("stop-local-instance"); command.add("--kill"); command.add(instanceName); String humanCommand = makeCommandHuman(command); String firstErrorMessage = Strings.get("stop.local.instance.kill", instanceName, nodeName, humanCommand); if (logger.isLoggable(Level.FINE)) logger.fine("stop-instance: running " + humanCommand + " on " + nodeName); nodeUtils.runAdminCommandOnNode(node, command, context, firstErrorMessage, humanCommand, null); ActionReport killreport = context.getActionReport(); if (killreport.getActionExitCode() != ActionReport.ExitCode.SUCCESS) { return killreport.getMessage(); } return null; }
private String killInstance(AdminCommandContext context) { String msg = initializeInstance(); if (msg != null) return msg; String nodeName = instance.getNodeRef(); Node node = nodes.getNode(nodeName); NodeUtils nodeUtils = new NodeUtils(habitat, logger); // asadmin command to run on instances node ArrayList<String> command = new ArrayList<String>(); command.add("stop-local-instance"); command.add("--kill"); command.add(instanceName); String humanCommand = makeCommandHuman(command); String firstErrorMessage = Strings.get("stop.local.instance.kill", instanceName, nodeName, humanCommand); logger.fine("stop-instance: running " + humanCommand + " on " + nodeName); nodeUtils.runAdminCommandOnNode(node, command, context, firstErrorMessage, humanCommand, null); ActionReport killreport = context.getActionReport(); if (killreport.getActionExitCode() != ActionReport.ExitCode.SUCCESS) { return killreport.getMessage(); } return null; }
} else if (report.getActionExitCode().equals(ActionReport.ExitCode.WARNING)){ logger.log(Level.WARNING, KernelLoggerInfo.loadingApplicationWarning, new Object[] { appName, report.getMessage()}); } else if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) { throw new Exception(report.getMessage());
getMessageString(ds, file)); } else { if(report.getMessage() != null){ deplLogger.log(Level.WARNING, WARNING_MSG, report.getMessage());
throw new Exception(report.getMessage());
public OSGiApplicationInfo deploy(Bundle b) throws DeploymentException { raiseEvent(State.DEPLOYING, b, null); ActionReport report = getReport(); OSGiDeploymentRequest request = createOSGiDeploymentRequest(deployer, archiveFactory, env, report, b); OSGiApplicationInfo osgiAppInfo = request.execute(); if (osgiAppInfo == null) { final Throwable throwable = report.getFailureCause(); raiseEvent(State.FAILED, b, throwable); throw new DeploymentException("Deployment of " + b + " failed because of following reason: " + report.getMessage(), throwable); } raiseEvent(State.DEPLOYED, b, null); return osgiAppInfo; }
public void undeploy(OSGiApplicationInfo osgiAppInfo) throws DeploymentException { final Bundle b = osgiAppInfo.getBundle(); raiseEvent(State.UNDEPLOYING, b, null); ActionReport report = getReport(); OSGiUndeploymentRequest request = createOSGiUndeploymentRequest(deployer, env, report, osgiAppInfo); request.execute(); raiseEvent(State.UNDEPLOYED, b, null); // raise event even if something went wrong if (report.getActionExitCode() == ActionReport.ExitCode.FAILURE) { throw new DeploymentException("Undeployment of " + b + " failed because of following reason: " + report.getMessage(), report.getFailureCause()); } }
private void start() { // be VERY careful -- we are being called from within a catch block... Exception exception = null; try { StartInstanceCommand sic = new StartInstanceCommand(habitat, instanceName, Boolean.parseBoolean(debug), env); sic.execute(ctx); } catch (Exception e) { // this is NOT normal! start-instance communicates errors via the // reporter. This catch should never happen. It is here for robustness. // and especially for programmer/regression errors. exception = e; // Perhaps a NPE or something **after** the report was set to success??? report.setActionExitCode(ActionReport.ExitCode.FAILURE); } // save start-instance's message String messageFromStartCommand = report.getMessage(); String exceptionMessage = ""; if (exception != null) exceptionMessage = Strings.get("restart.instance.exception", exception); if (isError()) setError(Strings.get("restart.instance.startFailed", exceptionMessage, messageFromStartCommand)); else setSuccess(Strings.get("restart.instance.startSucceeded", messageFromStartCommand)); }
public OSGiApplicationInfo deploy(Bundle b) throws DeploymentException { raiseEvent(State.DEPLOYING, b, null); ActionReport report = getReport(); OSGiDeploymentRequest request = createOSGiDeploymentRequest(deployer, archiveFactory, env, report, b); OSGiApplicationInfo osgiAppInfo = request.execute(); if (osgiAppInfo == null) { final Throwable throwable = report.getFailureCause(); raiseEvent(State.FAILED, b, throwable); throw new DeploymentException("Deployment of " + b + " failed because of following reason: " + report.getMessage(), throwable); } raiseEvent(State.DEPLOYED, b, null); return osgiAppInfo; }
public void undeploy(OSGiApplicationInfo osgiAppInfo) throws DeploymentException { final Bundle b = osgiAppInfo.getBundle(); raiseEvent(State.UNDEPLOYING, b, null); ActionReport report = getReport(); OSGiUndeploymentRequest request = createOSGiUndeploymentRequest(deployer, env, report, osgiAppInfo); request.execute(); raiseEvent(State.UNDEPLOYED, b, null); // raise event even if something went wrong if (report.getActionExitCode() == ActionReport.ExitCode.FAILURE) { throw new DeploymentException("Undeployment of " + b + " failed because of following reason: " + report.getMessage(), report.getFailureCause()); } }
private void start() { // be VERY careful -- we are being called from within a catch block... Exception exception = null; try { StartInstanceCommand sic = new StartInstanceCommand(habitat, instanceName, Boolean.parseBoolean(debug), env); sic.execute(ctx); } catch (Exception e) { // this is NOT normal! start-instance communicates errors via the // reporter. This catch should never happen. It is here for robustness. // and especially for programmer/regression errors. exception = e; // Perhaps a NPE or something **after** the report was set to success??? report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setFailureCause(e); } // save start-instance's message String messageFromStartCommand = report.getMessage(); if (isError()) { setError(Strings.get("restart.instance.startFailed", messageFromStartCommand)); } else { setSuccess(Strings.get("restart.instance.startSucceeded", messageFromStartCommand)); } }
postInvoke(context, subReport.getSubActionsReport().get(0)); } else { actionReport.setMessage(subReport.getMessage());
CommandRunner.CommandInvocation invocation = commandRunner.getCommandInvocation("undeploy", report); invocation.parameters(parameterMap).execute(); Object args[] = new Object[]{appName, report.getMessage()}; logger.log(Level.FINEST, "undeploying.app", args);
if (StringUtils.ok(report.getMessage())) { if (msg.length() > 0) { msg.append(NL); msg.append(report.getMessage());
user = subjectUsernames.get(0); jobPersistenceService.persist(new JobInfo(id,commandName,executionDate,report.getActionExitCode().name(),user,report.getMessage(),getJobsFile(),finalState.name(),completionDate)); if (getState().equals(State.RUNNING_RETRYABLE) || getState().equals(State.REVERTING)) { JobManagerService jobManager = Globals.getDefaultHabitat().getService(JobManagerService.class);