/*
(non-Javadoc)

@see
org.jboss.shrinkwrap.resolver.impl.maven.task.MavenWorkingSessionTask#execute(org.jboss.shrinkwrap.resolver.impl.maven
.MavenWorkingSession)
482232
@Override
    public MavenWorkingSession execute(MavenWorkingSession session) {

        // Get all declared dependencies
        final List<MavenDependency> dependencies = new ArrayList<MavenDependency>(session.getDeclaredDependencies());

        // Filter by scope
        final MavenResolutionFilter preResolutionFilter = new ScopeFilter(scopes);

        // For all declared dependencies which pass the filter, add 'em to the Set of dependencies to be resolved for
        // this request
        for (final MavenDependency candidate : dependencies) {
            if (preResolutionFilter.accepts(candidate, EMPTY_LIST, EMPTY_LIST)) {
                session.getDependenciesForResolution().add(candidate);
            }
        }
        return session;

    }
333099
@Override
    public void execute() throws ActivityException {
        Long instanceId = null;  // pre-existing instanceId
        String instanceIdSpec = getInstanceIdVariable();
        if (instanceIdSpec != null) {
            Object value = getValue(instanceIdSpec);
            if (value instanceof Long)
                instanceId = (Long) value;
            else if (value != null)
                instanceId = Long.parseLong(value.toString());
        }
        try {
            if (instanceId == null) {
                TaskInstance taskInstance = createTaskInstance();
                instanceId = taskInstance.getTaskInstanceId();
                if (instanceIdSpec != null)
                    setValue(instanceIdSpec, instanceId);
            }
            else {
                // update secondary owner
                updateOwningTransition(instanceId);
            }

            String taskInstCorrelationId = TaskAttributeConstant.TASK_CORRELATION_ID_PREFIX + instanceId;
            super.loginfo("Task instance created - ID " + instanceId);
            if (this.needSuspend()) {
                getEngine().createEventWaitInstance(
                        this.getActivityInstanceId(),
                        taskInstCorrelationId,
                        EventType.EVENTNAME_FINISH, true, true);
                EventWaitInstance received = registerWaitEvents(false,true);
                if (received!=null)
                        resume(getExternalEventInstanceDetails(received.getMessageDocumentId()),
                                         received.getCompletionCode());
            }
        } catch (Exception e) {
            throw new ActivityException(-1, e.getMessage(), e);
        }
    }
180049
@Override
   public void execute()  throws MojoExecutionException, MojoFailureException
   {
      ClassLoader oldCL = SecurityActions.getThreadContextClassLoader();
      try 
      {
         SecurityActions.setThreadContextClassLoader(SecurityActions.getClassLoader(ValidatorMojo.class));

         Validation.validate(getRarFile().toURI().toURL(), 
            getOutputDir(), getClasspath());
      }
      catch (Throwable t) 
      {
         t.printStackTrace();
      }
      finally
      {
         SecurityActions.setThreadContextClassLoader(oldCL);
      }
   }
152946
@Override
    public void execute() throws BuildException {
        try {
            ProvisioningFeatureDefinition feature = new SubsystemFeatureDefinitionImpl(null, this.featureManifestFile);
            setProperty(this.appliesToProperty, feature.getHeader("IBM-AppliesTo"));
            setProperty(this.descriptionProperty, feature.getHeader("Subsystem-Description", Locale.ENGLISH));
            String displayName = feature.getHeader("Subsystem-Name", Locale.ENGLISH);
            setProperty(this.displayNameProperty, displayName);
            setProperty(this.strippedDisplayNameProperty, getStrippedAssetName(displayName));
        } catch (IOException e) {
            throw new BuildException(e);
        }
    }
355737
@Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        final Log log = this.getLog();

        try {
            final ResourcesAggregator aggr = this.createResourcesAggregator();
            
            final Set<String> skinConfigurationFiles = this.findSkinConfigurationFiles();
            for (final String fileName : skinConfigurationFiles) {
                log.info("Aggregating: " + fileName);
                final File skinConfigurationFile = new File(this.skinSourceDirectory, fileName);
                final File skinOutputDirectory = new File(this.baseOutputDirectory, fileName).getParentFile();
                this.doAggregation(aggr, skinConfigurationFile, skinOutputDirectory);
            }
            
        } catch (AggregationException e) {
            throw new MojoExecutionException("aggregation failed", e);
        } catch (IOException e) {
            throw new MojoExecutionException("IOException occurred", e);
        }
    }
619218
@Override
    public void execute()
    {
        if ( "pom".equals( project.getPackaging() ) )
        {
            return;
        }

        File managedPath = new File( project.getBuild().getDirectory(), "src_managed" );
        String managedPathStr = managedPath.getAbsolutePath();
        if ( !project.getCompileSourceRoots().contains( managedPathStr ) )
        {
            project.addCompileSourceRoot( managedPathStr );
            getLog().debug( "Added source directory: " + managedPathStr );
        }
    }
626708
public void execute(DelegateExecution execution) {
    boolean isSkipExpressionEnabled = SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpression);
    if (!isSkipExpressionEnabled || (isSkipExpressionEnabled && !SkipExpressionUtil.shouldSkipFlowElement(execution, skipExpression))) {

      if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
        ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(serviceTaskId, execution.getProcessDefinitionId());
        if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME)) {
          String overrideClassName = taskElementProperties.get(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME).asText();
          if (StringUtils.isNotEmpty(overrideClassName) && !overrideClassName.equals(className)) {
            className = overrideClassName;
            activityBehaviorInstance = null;
          }
        }
      }
      
      if (activityBehaviorInstance == null) {
        activityBehaviorInstance = getActivityBehaviorInstance();
      }

      try {
        activityBehaviorInstance.execute(execution);
      } catch (BpmnError error) {
        ErrorPropagation.propagateError(error, execution);
      } catch (RuntimeException e) {
        if (!ErrorPropagation.mapException(e, (ExecutionEntity) execution, mapExceptions))
          throw e;
      }
    }
  }
436460
@Override
	public JobExecutionResult execute(String jobName) throws Exception {
		if (executor == null) {
			startNewSession();
		}

		Plan p = createProgramPlan(jobName);

		// Session management is disabled, revert this commit to enable
		//p.setJobId(jobID);
		//p.setSessionTimeout(sessionTimeout);

		JobExecutionResult result = executor.executePlan(p);

		this.lastJobExecutionResult = result;
		return result;
	}
10040
@Override
    public final void execute() throws TaskExecutionFailedException {
        long startTime = System.currentTimeMillis();

        try {
            executeImpl();
            log.info(createMessage("success", System.currentTimeMillis() - startTime));
        } catch (TaskExecutionFailedException ex) {
            log.error(createMessage("failure", System.currentTimeMillis() - startTime));
            throw ex;
        }
    }
818076
@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
	    try {
			final ResourcesAggregator aggr = this.createResourcesAggregator();
			
			final File fullOutputDirectory = new File(baseOutputDirectory, skinOutputDirectory);
			this.doAggregation(aggr, skinConfigurationFile, fullOutputDirectory);
		} catch (AggregationException e) {
			throw new MojoExecutionException("aggregation failed", e);
		} catch (IOException e) {
			throw new MojoExecutionException("IOException occurred", e);
		}
	}
468739
@Override
    public void execute()
    {
        if ( "pom".equals( project.getPackaging() ) )
        {
            getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" );
            return;
        }

        if ( skip )
        {
            getLog().info( "Skipping Scoverage execution" );
            return;
        }

        long ts = System.currentTimeMillis();

        SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects );

        long te = System.currentTimeMillis();
        getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) );
    }
320736
@Transactional
	public void execute(ProcessInstance processInstance) {
		HashIdLogger.log(this,"execute");
		TaskBase task = getCurrentTask(processInstance);
		if (processInstance.getStatus() == TaskStatus.DONE) {
			return;
		}
		while (true) {
			log.debug("processInstanceId={} processName={} taskId={} status={}",processInstance.getId(),task.getOwnerProcess().getName(),task.getTaskId(), processInstance.getStatus());
			boolean b = true;
			Audit audit = createAudit(processInstance, task);
			try {
				if (processInstance.getStatus()==TaskStatus.ABORTING)
				{
					// Someone (external) set our status to ABORTING.
					// Don't attempt to execute the current instruction just throw an abort error.
					throw new AbortException(processInstance.getComment());
				}
				if (processInstance.getStatus()==TaskStatus.TIMEOUT)
				{
					// Just throw an exception and the exception handler looks after it.
					throw new TimeoutException();
				}
				if (processInstance.getStatus()==TaskStatus.GO)
				{
					if (task instanceof TaskEnd) {
						throw new WorkflowException("Trying to restart an end task, should never happen "+task.toString());
					}
					log.debug("moving on from "+task.toString());
					// simple search for the task after this one.
					task = task.getNextTask(processInstance);
					if (task == null) {
						// There is no task, this should never happen
						throw new WorkflowException("Failed to find a next task");
					}
					// Not the end of the process, so ensure the next task is pending.
					audit.setTaskId(task.getTaskId());
					audit.setProcessDefinitionName(task.getOwnerProcess().getName());
					audit.setComment(trimComment(task.toString()));
					audit.setHandler(task.getHandler());
					task.loadTask(processInstance);
				}
				audit.setStatus(TaskStatus.PENDING);
				ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.PENDING);
				b = task.execute(processInstance);
			} catch (ContinueException e) {
				task = getCurrentTask(processInstance);
				continue;
			} catch (RetryException e) {
				task = getCurrentTask(processInstance);
				continue;
			} catch (ErrorException e) {
				audit.setStatus(TaskStatus.ERROR);
				if (!handleError(processInstance)) {
					// no appropriate handler, fall back to abort handler
					audit.setStatus(TaskStatus.ERROR);
					audit.setInterrupted(true);
					if (!handleAbort(processInstance)) {
						// Still no handler so we are screwed
						// Setting this status in the process 
						// instance will stop it
						processInstance.setStatus(TaskStatus.ABORTED);
					}
				} else {
					task = getCurrentTask(processInstance);
					continue;
				}
			} catch (AbortException e) {
				audit.setInterrupted(true);
				audit.setStatus(TaskStatus.ABORTED);
				audit.setComment(e.getMessage());
				if (!handleAbort(processInstance)) {
					// No handler found so just force an abort
					// Setting this status in the process instance will stop it
					processInstance.setStatus(TaskStatus.ABORTED);
					tickleParentProcess(processInstance,TaskStatus.ABORTED); // this should abort the sibling processes as well as the parent.
					break;
				} else {
					task = getCurrentTask(processInstance);
					continue;
				}
			} catch (TimeoutException e) {
				processInstance.getAudits().remove(audit);
				if (!handleTimeout(processInstance, audit)) {
					// No handler found so just force an abort
					// Setting this status in the process instance will stop it
					processInstance.setStatus(TaskStatus.ABORTED);
					tickleParentProcess(processInstance,processInstance.getStatus());
					break;
				} else {
					task = getCurrentTask(processInstance);
					continue;
				}
			}
			if (!b) {
				// task was not completed, exit the loop
				processInstance.setStatus(TaskStatus.WAIT);
				audit.setStatus(TaskStatus.WAIT);
				break;
			} else {
				if (task instanceof TaskEnd) {
					endOfProcessDetected(processInstance,audit);
					break;
				} else if (task instanceof TaskTry) {
					task = ((TaskTry)task).getFirstTask();
				} else if (task instanceof TaskIf) {
					task = ((TaskIf)task).getConditionalTask(processInstance);
				} else {
					task = getCurrentTask(processInstance).getNextTask(processInstance);
				}
				if (task == null) {
					throw new WorkflowException("Trying to step to a task when there is none");
				}
				// Not the end of the process, so ensure the next task is pending.
				task.loadTask(processInstance);
			}
		}
	}
90610
@Override
    public void execute() throws MojoExecutionException {
        try {
            ensureNotExisting();
            createDirectories();

            if ("blank".equalsIgnoreCase(skel)) {
                createApplicationConfiguration();
                createBlankPomFile();
                createPackageStructure();
                copyDefaultErrorTemplates();
            } else {
                createApplicationConfiguration();
                createPomFile();
                createPackageStructure();
                createDefaultController();
                createTests();
                copyAssets();
                createWelcomeTemplate();
                copyDefaultErrorTemplates();
            }

            printStartGuide();
        } catch (IOException e) {
            throw new MojoExecutionException("Error during project generation", e);
        }
    }
62697
@Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        generatingSite = false;
        final boolean shouldSkip = Boolean.parseBoolean(System.getProperty("dependency-check.skip", Boolean.toString(skip)));
        if (shouldSkip) {
            getLog().info("Skipping " + getName(Locale.US));
        } else {
            project.setContextValue("dependency-check-output-dir", this.outputDirectory);
            runCheck();
        }
    }
487457
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {
        try {
            return execute(listener, task.getServerIdentity(), task.getOperation());
        } catch (OperationFailedException e) {
            // Handle failures operation transformation failures
            final ServerIdentity identity = task.getServerIdentity();
            final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);
            final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
            listener.operationPrepared(result);
            recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));
            return 1; // 1 ms timeout since there is no reason to wait for the locally stored result
        }

    }
81811
public InvocationResult execute(String pom, String... goals) throws NaetherException {
        return execute( pom, Arrays.asList(goals) );
    }
104529
@Override
    public CompletableFuture<RootExecutionResultNode> execute(ExecutionContext context, FieldSubSelection fieldSubSelection) {
        return resolveSubSelection(context, fieldSubSelection)
                .thenApply(RootExecutionResultNode::new);
    }