Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 International Business Machines Corp.
   * 
   * See the NOTICE file distributed with this work for additional information
   * regarding copyright ownership. Licensed under the Apache License, 
   * Version 2.0 (the "License"); you may not use this file except in compliance
   * with the License. You may obtain a copy of the License at
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License 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.ibm.jbatch.container.impl;
 
 
 
 
 
     private final static String CLASSNAME = ExecutionElementControllerFactory.class.getName();
     private final static Logger logger = Logger.getLogger();
 
     public static IExecutionElementController getExecutionElementController(RuntimeJobExecutionHelper jobExecutionImplExecutionElement executionElement) {
 
         String methodName = "getExecutionElementController";
         
         if(.isLoggable(.)) { .logp (.methodName"Get Execution Element Controller for"executionElement.getId());}
         
         if (executionElement instanceof Step) {
             Step step = (Step)executionElement;
             
             Partition partition = step.getPartition();
             
             if (partition != null) {
                 
                 if (partition.getMapper() != null ) {
                     if (.isLoggable(.)) {
                         .logp(.methodName"Found partitioned step with mapper" , step);
                     }
 
                     return new PartitionedStepControllerImpl(jobExecutionImplstep);
                 }
                 
                 if (partition.getPlan() != null) {
                     if (partition.getPlan().getPartitions() != null) {
                         if (.isLoggable(.)) {
                             .logp(.methodName"Found partitioned step with plan"step);
                         }
 
                         return new PartitionedStepControllerImpl(jobExecutionImplstep);
                     }
                 }
             	
             }
             
             
             Batchlet batchlet = step.getBatchlet();
             
             if (batchlet != null) {
                 if(.isLoggable(.)) {  .logp (.methodName"Found batchlet"batchlet);}
                 if(.isLoggable(.)) {  .logp (.methodName"Found batchlet"batchlet.getRef());}
                 
                 if (step.getChunk() != null) {
                     throw new IllegalArgumentException("Step contains both a batchlet and a chunk.  Aborting.");
                 }       
                 return new BatchletStepControllerImpl(jobExecutionImplstep);
             } else {
                 Chunk chunk = step.getChunk();
                 if(.isLoggable(.)) {  .logp (.methodName"Found chunk"chunk);}
                 if (chunk == null) {
                     throw new IllegalArgumentException("Step does not contain either a batchlet or a chunk.  Aborting.");
                 }
                 return new ChunkStepControllerImpl(jobExecutionImplstep);
             }           
         } else if (executionElement instanceof Decision) {
             return new DecisionControllerImpl(jobExecutionImpl, (Decision)executionElement);
         } else if (executionElement instanceof Flow) {
             return new FlowControllerImpl(jobExecutionImpl, (Flow)executionElement);
         } else if (executionElement instanceof Split) {
             return new SplitControllerImpl(jobExecutionImpl, (Split)executionElement);
         }  else {
             throw new UnsupportedOperationException("Only support steps, flows, splits, and decisions so far.");
         }
        
    }
New to GrepCode? Check out our FAQ X