Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"). You may not
   * use this file except in compliance with the License. A copy of the License is
   * located at
   * 
   * http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed on
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.simpleworkflow.flow.worker;
 
 
 
 
 public class GenericWorkflowWorker extends GenericWorker {
 
     private static final Log log = LogFactory.getLog(GenericWorkflowWorker.class);
 
     private static final String THREAD_NAME_PREFIX = "SWF Decider ";
 
 
     public GenericWorkflowWorker() {
         setIdentity(ManagementFactory.getRuntimeMXBean().getName());
     }
 
     public GenericWorkflowWorker(AmazonSimpleWorkflow serviceString domainString taskListToPoll) {
         this();
         setService(service);
         setDomain(domain);
         setTaskListToPoll(taskListToPoll);
     }
 
         return ;
     }
 
     public void setWorkflowDefinitionFactoryFactory(WorkflowDefinitionFactoryFactory workflowDefinitionFactoryFactory) {
         this. = workflowDefinitionFactoryFactory;
     }
 
     protected DecisionTaskPoller createWorkflowPoller() {
         DecisionTaskPoller poller = new DecisionTaskPoller();
         return poller;
     }
 
     @Override
     protected void checkRequredProperties() {
         checkRequiredProperty("workflowDefinitionFactoryFactory");
     }
 
     @Override
     protected String getPollThreadNamePrefix() {
         return  + getTaskListToPoll() + " ";
     }
 
     @Override
     protected TaskPoller createPoller() {
         DecisionTaskPoller result = new DecisionTaskPoller();
         result.setDomain(getDomain());
         result.setIdentity(getIdentity());
         result.setService(getService());
         result.setTaskListToPoll(getTaskListToPoll());
         return result;
     }
 
     @Override
     public void registerTypesToPoll() {
     }
 
     @Override
     public String toString() {
         return this.getClass().getSimpleName() + "[super=" + super.toString() + ", workflowDefinitionFactoryFactory="
                 +  + "]";
     }
 
     public static void registerWorkflowTypes(AmazonSimpleWorkflow serviceString domainString defaultTaskList,
             WorkflowDefinitionFactoryFactory workflowDefinitionFactoryFactory) {
         for (WorkflowType typeToRegister : workflowDefinitionFactoryFactory.getWorkflowTypesToRegister()) {
            WorkflowDefinitionFactory workflowDefinitionFactory = workflowDefinitionFactoryFactory.getWorkflowDefinitionFactory(typeToRegister);
            WorkflowTypeRegistrationOptions registrationOptions = workflowDefinitionFactory.getWorkflowRegistrationOptions();
            if (registrationOptions != null) {
                WorkflowType workflowType = workflowDefinitionFactory.getWorkflowType();
                try {
                    registerWorkflowType(servicedomainworkflowTyperegistrationOptionsdefaultTaskList);
                }
                catch (TypeAlreadyExistsException ex) {
                    if (.isTraceEnabled()) {
                        .trace("Workflow Type already registered: " + workflowType);
                    }
                }
            }
        }
    }
    public static void registerWorkflowType(AmazonSimpleWorkflow serviceString domainWorkflowType workflowType,
            WorkflowTypeRegistrationOptions registrationOptionsString defaultTaskList) {
        RegisterWorkflowTypeRequest registerWorkflow = new RegisterWorkflowTypeRequest();
        registerWorkflow.setDomain(domain);
        registerWorkflow.setName(workflowType.getName());
        registerWorkflow.setVersion(workflowType.getVersion());
        String taskList = registrationOptions.getDefaultTaskList();
        if (taskList == null) {
            taskList = defaultTaskList;
        }
        else if (taskList.equals(.)) {
            taskList = null;
        }
        if (taskList != null && !taskList.isEmpty()) {
            registerWorkflow.setDefaultTaskList(new TaskList().withName(taskList));
        }
        registerWorkflow.setDefaultChildPolicy(registrationOptions.getDefaultChildPolicy().toString());
        registerWorkflow.setDefaultTaskStartToCloseTimeout(FlowHelpers.secondsToDuration(registrationOptions.getDefaultTaskStartToCloseTimeoutSeconds()));
        registerWorkflow.setDefaultExecutionStartToCloseTimeout(FlowHelpers.secondsToDuration(registrationOptions.getDefaultExecutionStartToCloseTimeoutSeconds()));
        registerWorkflow.setDefaultTaskPriority(FlowHelpers.taskPriorityToString(registrationOptions.getDefaultTaskPriority()));
        
        String description = registrationOptions.getDescription();
        if (description != null) {
            registerWorkflow.setDescription(description);
        }
        service.registerWorkflowType(registerWorkflow);
    }
New to GrepCode? Check out our FAQ X