001    /*
002     * Copyright (c) 2007-2014 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;
022    
023    import java.util.List;
024    
025    import cascading.pipe.Pipe;
026    
027    /**
028     * Interface AssemblyPlanner is used to allow for lazy evaluation of a pipe assembly during planning of a {@link Flow}.
029     * <p/>
030     * This allows for new languages or frameworks that may require additional meta-data from the
031     * underlying platform or environment. Specifically field names and type information from incoming source
032     * and outgoing sink {@link cascading.tap.Tap}s.
033     * <p/>
034     * AssemblyPlanner implementations are handed to a {@link cascading.flow.planner.FlowPlanner}
035     * instance in the order they should be evaluated.
036     * Every instance has the opportunity to replace any prior tails with new branches and paths.
037     * <p/>
038     * Every instance of AssemblyPlanner evaluated is given the current {@link FlowDef} used on the current
039     * {@link FlowConnector}, the current Flow instance (only initialized with source and sink Taps provided by the
040     * FlowDef), and the tails provided by the FlowDef or those returned by prior AssemblyPlanner instances.
041     * <p/>
042     * An AssemblyPlanner cannot change or modify the Flow, or change out any Taps used as sources, sinks, traps, or
043     * checkpoints.
044     * <p/>
045     * This is an experimental API and subject to change without notice.
046     */
047    public interface AssemblyPlanner
048      {
049      interface Context
050        {
051        FlowDef getFlowDef();
052    
053        Flow getFlow();
054    
055        List<Pipe> getTails();
056        }
057    
058      /**
059       * Called when this AssemblyPlanner instance should return any additional tail Pipe instances for used
060       * when completing the Flow plan.
061       *
062       * @param context parameter object of the Context
063       * @return tail Pipe instances to replace the given tails
064       */
065      List<Pipe> resolveTails( Context context );
066      }