001    /*
002     * Copyright (c) 2007-2015 Concurrent, 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    
021    package cascading.flow.hadoop;
022    
023    import java.beans.ConstructorProperties;
024    import java.util.Map;
025    import java.util.Properties;
026    
027    import cascading.flow.FlowConnector;
028    import cascading.flow.hadoop.planner.HadoopPlanner;
029    import cascading.flow.planner.FlowPlanner;
030    import cascading.pipe.Pipe;
031    import cascading.scheme.Scheme;
032    import cascading.scheme.hadoop.SequenceFile;
033    import cascading.tap.Tap;
034    
035    /**
036     * Use the HadoopFlowConnector to link source and sink {@link Tap} instances with an assembly of {@link Pipe} instances into
037     * an executable {@link HadoopFlow} for execution on an Apache Hadoop cluster.
038     *
039     * @see cascading.property.AppProps
040     * @see cascading.flow.FlowConnectorProps
041     * @see cascading.flow.FlowDef
042     * @see cascading.flow.hadoop.MapReduceFlow
043     */
044    public class HadoopFlowConnector extends FlowConnector
045      {
046      /**
047       * Constructor FlowConnector creates a new FlowConnector instance.
048       * <p/>
049       * All properties passed to Hadoop are retrieved from a default instantiation of the Hadoop
050       * {@link org.apache.hadoop.mapred.JobConf} which pulls all properties from the local CLASSPATH.
051       */
052      public HadoopFlowConnector()
053        {
054        }
055    
056      /**
057       * Constructor FlowConnector creates a new FlowConnector instance using the given {@link Properties} instance as
058       * default value for the underlying jobs. All properties are copied to a new native configuration instance.
059       *
060       * @param properties of type Properties
061       */
062      @ConstructorProperties({"properties"})
063      public HadoopFlowConnector( Map<Object, Object> properties )
064        {
065        super( properties );
066        }
067    
068      protected Class<? extends Scheme> getDefaultIntermediateSchemeClass()
069        {
070        return SequenceFile.class;
071        }
072    
073      protected FlowPlanner createFlowPlanner()
074        {
075        return new HadoopPlanner();
076        }
077      }