001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.commons.pipeline.driver;
019
020 import org.apache.commons.pipeline.Stage;
021 import org.apache.commons.pipeline.StageContext;
022 import org.apache.commons.pipeline.StageDriver;
023 import org.apache.commons.pipeline.StageDriverFactory;
024
025 /**
026 * Factory for SynchronousStageDriver objects.
027 *
028 *
029 */
030 public class SynchronousStageDriverFactory implements StageDriverFactory {
031
032 /** Creates a new instance of SynchronousStageDriverFactory */
033 public SynchronousStageDriverFactory() {
034 }
035
036 /**
037 * Creates a new {@link SynchronousStageDriver} based upon this factory's configuration.
038 * @param stage the stage to be run by the newly created driver
039 * @param context the context in which the stage will be run
040 * @return the newly created and configured driver
041 */
042 public StageDriver createStageDriver(Stage stage, StageContext context) {
043 return new SynchronousStageDriver(stage, context, this.faultTolerance);
044 }
045
046 /**
047 * Holds value of property faultTolerance. Default value is {@link FaultTolerance.NONE}.
048 */
049 private FaultTolerance faultTolerance = FaultTolerance.NONE;
050
051 /**
052 * Getter for property faultTolerance.
053 * @return Value of property faultTolerance.
054 */
055 public FaultTolerance getFaultTolerance() {
056 return this.faultTolerance;
057 }
058
059 /**
060 * Setter for property faultTolerance.
061 * @param faultTolerance New value of property faultTolerance.
062 */
063 public void setFaultTolerance(FaultTolerance faultTolerance) {
064 this.faultTolerance = faultTolerance;
065 }
066 }