    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;
    022
    023import java.io.IOException;
    024import java.util.Collection;
    025import java.util.Map;
    026
    027import cascading.tap.Tap;
    028import cascading.tuple.TupleEntryCollector;
    029import cascading.tuple.TupleEntryIterator;
    030
    031/**
    032 *
    033 */
    034public class FlowProcessWrapper<Config> extends FlowProcess<Config>
    035  {
    036  final FlowProcess<Config> delegate;
    037
    038  public static FlowProcess undelegate( FlowProcess flowProcess )
    039    {
    040    if( flowProcess instanceof FlowProcessWrapper )
    041      return ( (FlowProcessWrapper) flowProcess ).getDelegate();
    042
    043    return flowProcess;
    044    }
    045
    046  public FlowProcessWrapper( FlowProcess delegate )
    047    {
    048    this.delegate = delegate;
    049    }
    050
    051  public FlowProcess getDelegate()
    052    {
    053    return delegate;
    054    }
    055
    056  @Override
    057  public FlowProcess copyWith( Config object )
    058    {
    059    return delegate.copyWith( object );
    060    }
    061
    062  @Override
    063  public String getID()
    064    {
    065    return delegate.getID();
    066    }
    067
    068  @Override
    069  public FlowSession getCurrentSession()
    070    {
    071    return delegate.getCurrentSession();
    072    }
    073
    074  @Override
    075  public void setCurrentSession( FlowSession currentSession )
    076    {
    077    delegate.setCurrentSession( currentSession );
    078    }
    079
    080  @Override
    081  public int getNumProcessSlices()
    082    {
    083    return delegate.getNumProcessSlices();
    084    }
    085
    086  @Override
    087  public int getCurrentSliceNum()
    088    {
    089    return delegate.getCurrentSliceNum();
    090    }
    091
    092  @Override
    093  public Object getProperty( String key )
    094    {
    095    return delegate.getProperty( key );
    096    }
    097
    098  @Override
    099  public Collection<String> getPropertyKeys()
    100    {
    101    return delegate.getPropertyKeys();
    102    }
    103
    104  @Override
    105  public Object newInstance( String className )
    106    {
    107    return delegate.newInstance( className );
    108    }
    109
    110  @Override
    111  public void keepAlive()
    112    {
    113    delegate.keepAlive();
    114    }
    115
    116  @Override
    117  public void increment( Enum counter, long amount )
    118    {
    119    delegate.increment( counter, amount );
    120    }
    121
    122  @Override
    123  public void increment( String group, String counter, long amount )
    124    {
    125    delegate.increment( group, counter, amount );
    126    }
    127
    128  @Override
    129  public long getCounterValue( Enum counter )
    130    {
    131    return delegate.getCounterValue( counter );
    132    }
    133
    134  @Override
    135  public long getCounterValue( String group, String counter )
    136    {
    137    return delegate.getCounterValue( group, counter );
    138    }
    139
    140  @Override
    141  public void setStatus( String status )
    142    {
    143    delegate.setStatus( status );
    144    }
    145
    146  @Override
    147  public boolean isCounterStatusInitialized()
    148    {
    149    return delegate.isCounterStatusInitialized();
    150    }
    151
    152  @Override
    153  public TupleEntryIterator openTapForRead( Tap tap ) throws IOException
    154    {
    155    return delegate.openTapForRead( tap );
    156    }
    157
    158  @Override
    159  public TupleEntryCollector openTapForWrite( Tap tap ) throws IOException
    160    {
    161    return delegate.openTapForWrite( tap );
    162    }
    163
    164  @Override
    165  public TupleEntryCollector openTrapForWrite( Tap trap ) throws IOException
    166    {
    167    return delegate.openTrapForWrite( trap );
    168    }
    169
    170  @Override
    171  public TupleEntryCollector openSystemIntermediateForWrite() throws IOException
    172    {
    173    return delegate.openSystemIntermediateForWrite();
    174    }
    175
    176  @Override
    177  public Config getConfig()
    178    {
    179    return delegate.getConfig();
    180    }
    181
    182  @Override
    183  public Config getConfigCopy()
    184    {
    185    return delegate.getConfigCopy();
    186    }
    187
    188  @Override
    189  public <C> C copyConfig( C jobConf )
    190    {
    191    return delegate.copyConfig( jobConf );
    192    }
    193
    194  @Override
    195  public <C> Map<String, String> diffConfigIntoMap( C defaultConfig, C updatedConfig )
    196    {
    197    return delegate.diffConfigIntoMap( defaultConfig, updatedConfig );
    198    }
    199
    200  @Override
    201  public Config mergeMapIntoConfig( Config defaultConfig, Map<String, String> map )
    202    {
    203    return delegate.mergeMapIntoConfig( defaultConfig, map );
    204    }
    205
    206  @Override
    207  public TupleEntryCollector getTrapCollectorFor( Tap trap )
    208    {
    209    return delegate.getTrapCollectorFor( trap );
    210    }
    211
    212  @Override
    213  public synchronized void closeTrapCollectors()
    214    {
    215    delegate.closeTrapCollectors();
    216    }
    217  }