001/*
002 * Copyright (c) 2007-2017 Xplenty, Inc. All Rights Reserved.
003 *
004 * Project and contact information: http://www.cascading.org/
005 *
006 * This file is part of the Cascading project.
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *     http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020
021package cascading.flow.local.planner;
022
023import java.util.Properties;
024
025import cascading.flow.FlowDef;
026import cascading.flow.FlowStep;
027import cascading.flow.local.LocalFlow;
028import cascading.flow.local.LocalFlowStep;
029import cascading.flow.planner.BaseFlowStepFactory;
030import cascading.flow.planner.FlowPlanner;
031import cascading.flow.planner.PlannerInfo;
032import cascading.flow.planner.PlatformInfo;
033import cascading.flow.planner.graph.ElementGraph;
034import cascading.flow.planner.process.FlowNodeGraph;
035import cascading.flow.planner.process.FlowStepFactory;
036import cascading.tap.Tap;
037import cascading.util.Version;
038
039/**
040 *
041 */
042public class LocalPlanner extends FlowPlanner<LocalFlow, Properties>
043  {
044  public static final String PLATFORM_NAME = "local";
045
046  public LocalPlanner()
047    {
048    }
049
050  @Override
051  public Properties getDefaultConfig()
052    {
053    return null;
054    }
055
056  @Override
057  public PlannerInfo getPlannerInfo( String registryName )
058    {
059    return new PlannerInfo( getClass().getSimpleName(), PLATFORM_NAME, registryName );
060    }
061
062  @Override
063  public PlatformInfo getPlatformInfo()
064    {
065    return new PlatformInfo( "local", "Xplenty, Inc.", Version.getRelease() );
066    }
067
068  protected LocalFlow createFlow( FlowDef flowDef )
069    {
070    return new LocalFlow( getPlatformInfo(), getDefaultProperties(), getDefaultConfig(), flowDef );
071    }
072
073  @Override
074  public FlowStepFactory<Properties> getFlowStepFactory()
075    {
076    return new BaseFlowStepFactory<Properties>( getFlowNodeFactory() )
077    {
078    @Override
079    public FlowStep<Properties> createFlowStep( ElementGraph stepElementGraph, FlowNodeGraph flowNodeGraph )
080      {
081      return new LocalFlowStep( stepElementGraph, flowNodeGraph );
082      }
083    };
084    }
085
086  @Override
087  protected Tap makeTempTap( String prefix, String name )
088    {
089    return null;
090    }
091  }