コード例 #1
0
 public void finishWorkflowItem(int step, StepExecutionItem item, StepExecutionResult result) {
   if (NodeDispatchStepExecutor.STEP_EXECUTION_TYPE.equals(item.getType())
       || item instanceof NodeStepExecutionItem) {
     // dont notify
   } else {
     notifyAllStepState(createIdentifier(), createStepStateChange(result), new Date());
   }
   stepContext.finishStepContext();
 }
コード例 #2
0
ファイル: StepPluginAdapter.java プロジェクト: rophy/rundeck
  @Override
  public StepExecutionResult executeWorkflowStep(
      final StepExecutionContext executionContext, final StepExecutionItem item)
      throws StepException {
    Map<String, Object> instanceConfiguration = getStepConfiguration(item);
    if (null != instanceConfiguration) {
      instanceConfiguration =
          DataContextUtils.replaceDataReferences(
              instanceConfiguration, executionContext.getDataContext());
    }
    final String providerName = item.getType();
    final PropertyResolver resolver =
        PropertyResolverFactory.createStepPluginRuntimeResolver(
            executionContext,
            instanceConfiguration,
            ServiceNameConstants.WorkflowStep,
            providerName);
    final PluginStepContext stepContext = PluginStepContextImpl.from(executionContext);
    final Map<String, Object> config =
        PluginAdapterUtility.configureProperties(
            resolver, getDescription(), plugin, PropertyScope.InstanceOnly);
    try {
      plugin.executeStep(stepContext, config);
    } catch (StepException e) {
      executionContext.getExecutionListener().log(Constants.ERR_LEVEL, e.getMessage());
      final StringWriter stringWriter = new StringWriter();
      e.printStackTrace(new PrintWriter(stringWriter));
      executionContext
          .getExecutionListener()
          .log(
              Constants.DEBUG_LEVEL,
              "Failed executing step plugin [" + providerName + "]: " + stringWriter.toString());

      return new StepExecutionResultImpl(e, e.getFailureReason(), e.getMessage());
    } catch (Throwable e) {
      final StringWriter stringWriter = new StringWriter();
      e.printStackTrace(new PrintWriter(stringWriter));
      executionContext
          .getExecutionListener()
          .log(
              Constants.DEBUG_LEVEL,
              "Failed executing step plugin [" + providerName + "]: " + stringWriter.toString());
      return new StepExecutionResultImpl(e, StepFailureReason.PluginFailed, e.getMessage());
    }
    return new StepExecutionResultImpl();
  }