@Override public StepPhase executeAsyncStep(ExecutionWrapper execution) { CloudApplication app = getAppToRestart(execution.getContext()); try { restartApp(execution, app); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); onError(format(Messages.ERROR_STARTING_APP_1, app.getName()), e); throw e; } return StepPhase.POLL; }
@Override public StepPhase executeAsyncStep(ExecutionWrapper execution) { CloudApplication app = getAppToRestart(execution.getContext()); try { restartApp(execution, app); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); onError(format(Messages.ERROR_STARTING_APP_1, app.getName()), e); throw e; } return StepPhase.POLL; }
public <T> T executeServiceOperation(CloudServiceExtended service, Supplier<T> serviceOperation, StepLogger stepLogger) { try { return serviceOperation.get(); } catch (CloudOperationException e) { if (!service.isOptional()) { if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { throw new CloudServiceBrokerException(e); } throw new CloudControllerException(e); } stepLogger.warn(e, Messages.COULD_NOT_EXECUTE_OPERATION_OVER_OPTIONAL_SERVICE, service.getName()); return null; } }
public <T> T executeServiceOperation(CloudServiceExtended service, Supplier<T> serviceOperation, StepLogger stepLogger) { try { return serviceOperation.get(); } catch (CloudOperationException e) { if (!service.isOptional()) { if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { throw new CloudServiceBrokerException(e); } throw new CloudControllerException(e); } stepLogger.warn(e, Messages.COULD_NOT_EXECUTE_OPERATION_OVER_OPTIONAL_SERVICE, service.getName()); return null; } }
private CloudOperationException evaluateCloudOperationException(CloudOperationException e, String serviceName) { if (e.getStatusCode() == HttpStatus.NOT_FOUND) { getStepLogger().warn(e, Messages.COULD_NOT_DELETE_SERVICE, serviceName); return null; } if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { return new CloudServiceBrokerException(e); } return new CloudControllerException(e); }
private CloudOperationException evaluateCloudOperationException(CloudOperationException e, String serviceName) { if (e.getStatusCode() == HttpStatus.NOT_FOUND) { getStepLogger().warn(e, Messages.COULD_NOT_DELETE_SERVICE, serviceName); return null; } if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { return new CloudServiceBrokerException(e); } return new CloudControllerException(e); }
private void processServiceCreationFailure(CloudServiceExtended service, CloudOperationException e) { if (!service.isOptional()) { if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { throw new CloudServiceBrokerException(e); } throw new CloudControllerException(e); } getStepLogger().warn(e, Messages.COULD_NOT_EXECUTE_OPERATION_OVER_OPTIONAL_SERVICE, service.getName()); }
private void processServiceCreationFailure(CloudServiceExtended service, CloudOperationException e) { if (!service.isOptional()) { if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { throw new CloudServiceBrokerException(e); } throw new CloudControllerException(e); } getStepLogger().warn(e, Messages.COULD_NOT_EXECUTE_OPERATION_OVER_OPTIONAL_SERVICE, service.getName()); }
@Override protected StepPhase executeStep(ExecutionWrapper context) { CloudApplication app = StepsUtil.getApp(context.getContext()); try { return attemptToExecuteStep(context); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_DETERMINING_ACTIONS_TO_EXECUTE_ON_APP, app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_DETERMINING_ACTIONS_TO_EXECUTE_ON_APP, app.getName()); throw e; } }
@Override protected StepPhase executeStep(ExecutionWrapper context) { CloudApplication app = StepsUtil.getApp(context.getContext()); try { return attemptToExecuteStep(context); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_DETERMINING_ACTIONS_TO_EXECUTE_ON_APP, app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_DETERMINING_ACTIONS_TO_EXECUTE_ON_APP, app.getName()); throw e; } }
@Override protected StepPhase executeAsyncStep(ExecutionWrapper execution) { CloudApplication app = StepsUtil.getApp(execution.getContext()); try { ApplicationStager applicationStager = ApplicationStagerFactory.createApplicationStager(configuration.getPlatformType()); return applicationStager.stageApp(execution.getContext(), execution.getControllerClient(), app, getStepLogger()); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_STAGING_APP_1, app.getName()); throw e; } }
@Override protected StepPhase executeAsyncStep(ExecutionWrapper execution) { CloudApplication app = StepsUtil.getApp(execution.getContext()); try { ApplicationStager applicationStager = ApplicationStagerFactory.createApplicationStager(configuration.getPlatformType()); return applicationStager.stageApp(execution.getContext(), execution.getControllerClient(), app, getStepLogger()); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_STAGING_APP_1, app.getName()); throw e; } }
@Override protected StepPhase executeStep(ExecutionWrapper execution) { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); List<CloudTask> tasksToExecute = app.getTasks(); try { return attemptToPrepareExecutionOfTasks(execution, tasksToExecute); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_PREPARING_TO_EXECUTE_TASKS_ON_APP, app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_PREPARING_TO_EXECUTE_TASKS_ON_APP, app.getName()); throw e; } }
@Override protected StepPhase executeStep(ExecutionWrapper execution) { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); List<CloudTask> tasksToExecute = app.getTasks(); try { return attemptToPrepareExecutionOfTasks(execution, tasksToExecute); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_PREPARING_TO_EXECUTE_TASKS_ON_APP, app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_PREPARING_TO_EXECUTE_TASKS_ON_APP, app.getName()); throw e; } }
@Override protected StepPhase executeAsyncStep(ExecutionWrapper execution) throws Exception { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); CloudTask taskToExecute = StepsUtil.getTask(execution.getContext()); try { return attemptToExecuteTask(execution, app, taskToExecute); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, taskToExecute.getName(), app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, taskToExecute.getName(), app.getName()); throw e; } }
@Override protected StepPhase executeStep(ExecutionWrapper execution) { try { getStepLogger().debug(Messages.DELETING_IDLE_URIS); CloudControllerClient client = execution.getControllerClient(); boolean portBasedRouting = (boolean) execution.getContext() .getVariable(Constants.VAR_PORT_BASED_ROUTING); List<CloudApplicationExtended> apps = StepsUtil.getAppsToDeploy(execution.getContext()); for (CloudApplicationExtended app : apps) { deleteIdleRoutes(app, portBasedRouting, client); } getStepLogger().debug(Messages.IDLE_URIS_DELETED); return StepPhase.DONE; } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_DELETING_IDLE_ROUTES); throw e; } }
@Override protected StepPhase executeAsyncStep(ExecutionWrapper execution) throws Exception { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); CloudTask taskToExecute = StepsUtil.getTask(execution.getContext()); try { return attemptToExecuteTask(execution, app, taskToExecute); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, taskToExecute.getName(), app.getName()); throw e; } catch (SLException e) { getStepLogger().error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, taskToExecute.getName(), app.getName()); throw e; } }
@Override protected StepPhase executeStep(ExecutionWrapper execution) { try { getStepLogger().debug(Messages.DELETING_IDLE_URIS); CloudControllerClient client = execution.getControllerClient(); boolean portBasedRouting = (boolean) execution.getContext() .getVariable(Constants.VAR_PORT_BASED_ROUTING); List<CloudApplicationExtended> apps = StepsUtil.getAppsToDeploy(execution.getContext()); for (CloudApplicationExtended app : apps) { deleteIdleRoutes(app, portBasedRouting, client); } getStepLogger().debug(Messages.IDLE_URIS_DELETED); return StepPhase.DONE; } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); getStepLogger().error(e, Messages.ERROR_DELETING_IDLE_ROUTES); throw e; } }
@Override public AsyncExecutionState execute(ExecutionWrapper execution) { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); CloudTask task = StepsUtil.getStartedTask(execution.getContext()); try { return new PollExecuteTaskStatusDelegate(execution).execute(); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); execution.getStepLogger() .error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, task.getName(), app.getName()); throw e; } catch (SLException e) { execution.getStepLogger() .error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, task.getName(), app.getName()); throw e; } }
@Override public AsyncExecutionState execute(ExecutionWrapper execution) { CloudApplicationExtended app = StepsUtil.getApp(execution.getContext()); CloudTask task = StepsUtil.getStartedTask(execution.getContext()); try { return new PollExecuteTaskStatusDelegate(execution).execute(); } catch (CloudOperationException coe) { CloudControllerException e = new CloudControllerException(coe); execution.getStepLogger() .error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, task.getName(), app.getName()); throw e; } catch (SLException e) { execution.getStepLogger() .error(e, Messages.ERROR_EXECUTING_TASK_ON_APP, task.getName(), app.getName()); throw e; } }