    001/*
    002 * Copyright (c) 2016-2017 Chris K Wensel <chris@wensel.net>. All Rights Reserved.
    003 * Copyright (c) 2007-2017 Xplenty, Inc. All Rights Reserved.
    004 *
    005 * Project and contact information: http://www.cascading.org/
    006 *
    007 * This file is part of the Cascading project.
    008 *
    009 * Licensed under the Apache License, Version 2.0 (the "License");
    010 * you may not use this file except in compliance with the License.
    011 * You may obtain a copy of the License at
    012 *
    013 *     http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing, software
    016 * distributed under the License is distributed on an "AS IS" BASIS,
    017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    018 * See the License for the specific language governing permissions and
    019 * limitations under the License.
    020 */
    021
    022package cascading.flow;
    023
    024import java.io.IOException;
    025import java.util.Collection;
    026import java.util.Map;
    027
    028import cascading.tap.Tap;
    029import cascading.tuple.TupleEntryCollector;
    030import cascading.tuple.TupleEntryIterator;
    031
    032/**
    033 *
    034 */
    035public class FlowProcessWrapper<Config> extends FlowProcess<Config>
    036  {
    037  final FlowProcess<Config> delegate;
    038
    039  public static FlowProcess undelegate( FlowProcess flowProcess )
    040    {
    041    if( flowProcess instanceof FlowProcessWrapper )
    042      return ( (FlowProcessWrapper) flowProcess ).getDelegate();
    043
    044    return flowProcess;
    045    }
    046
    047  public FlowProcessWrapper( FlowProcess delegate )
    048    {
    049    this.delegate = delegate;
    050    }
    051
    052  public FlowProcess getDelegate()
    053    {
    054    return delegate;
    055    }
    056
    057  @Override
    058  public FlowProcessContext getFlowProcessContext()
    059    {
    060    return delegate.getFlowProcessContext();
    061    }
    062
    063  @Override
    064  public FlowProcess copyWith( Config object )
    065    {
    066    return delegate.copyWith( object );
    067    }
    068
    069  @Override
    070  public String getID()
    071    {
    072    return delegate.getID();
    073    }
    074
    075  @Override
    076  public FlowSession getCurrentSession()
    077    {
    078    return delegate.getCurrentSession();
    079    }
    080
    081  @Override
    082  public void setCurrentSession( FlowSession currentSession )
    083    {
    084    delegate.setCurrentSession( currentSession );
    085    }
    086
    087  @Override
    088  public int getNumProcessSlices()
    089    {
    090    return delegate.getNumProcessSlices();
    091    }
    092
    093  @Override
    094  public int getCurrentSliceNum()
    095    {
    096    return delegate.getCurrentSliceNum();
    097    }
    098
    099  @Override
    100  public Object getProperty( String key )
    101    {
    102    return delegate.getProperty( key );
    103    }
    104
    105  @Override
    106  public Collection<String> getPropertyKeys()
    107    {
    108    return delegate.getPropertyKeys();
    109    }
    110
    111  @Override
    112  public Object newInstance( String className )
    113    {
    114    return delegate.newInstance( className );
    115    }
    116
    117  @Override
    118  public void keepAlive()
    119    {
    120    delegate.keepAlive();
    121    }
    122
    123  @Override
    124  public void increment( Enum counter, long amount )
    125    {
    126    delegate.increment( counter, amount );
    127    }
    128
    129  @Override
    130  public void increment( String group, String counter, long amount )
    131    {
    132    delegate.increment( group, counter, amount );
    133    }
    134
    135  @Override
    136  public long getCounterValue( Enum counter )
    137    {
    138    return delegate.getCounterValue( counter );
    139    }
    140
    141  @Override
    142  public long getCounterValue( String group, String counter )
    143    {
    144    return delegate.getCounterValue( group, counter );
    145    }
    146
    147  @Override
    148  public void setStatus( String status )
    149    {
    150    delegate.setStatus( status );
    151    }
    152
    153  @Override
    154  public boolean isCounterStatusInitialized()
    155    {
    156    return delegate.isCounterStatusInitialized();
    157    }
    158
    159  @Override
    160  public TupleEntryIterator openTapForRead( Tap tap ) throws IOException
    161    {
    162    return delegate.openTapForRead( tap );
    163    }
    164
    165  @Override
    166  public TupleEntryCollector openTapForWrite( Tap tap ) throws IOException
    167    {
    168    return delegate.openTapForWrite( tap );
    169    }
    170
    171  @Override
    172  public TupleEntryCollector openTrapForWrite( Tap trap ) throws IOException
    173    {
    174    return delegate.openTrapForWrite( trap );
    175    }
    176
    177  @Override
    178  public TupleEntryCollector openSystemIntermediateForWrite() throws IOException
    179    {
    180    return delegate.openSystemIntermediateForWrite();
    181    }
    182
    183  @Override
    184  public Config getConfig()
    185    {
    186    return delegate.getConfig();
    187    }
    188
    189  @Override
    190  public Config getConfigCopy()
    191    {
    192    return delegate.getConfigCopy();
    193    }
    194
    195  @Override
    196  public <C> C copyConfig( C jobConf )
    197    {
    198    return delegate.copyConfig( jobConf );
    199    }
    200
    201  @Override
    202  public <C> Map<String, String> diffConfigIntoMap( C defaultConfig, C updatedConfig )
    203    {
    204    return delegate.diffConfigIntoMap( defaultConfig, updatedConfig );
    205    }
    206
    207  @Override
    208  public Config mergeMapIntoConfig( Config defaultConfig, Map<String, String> map )
    209    {
    210    return delegate.mergeMapIntoConfig( defaultConfig, map );
    211    }
    212
    213  @Override
    214  public TupleEntryCollector getTrapCollectorFor( Tap trap )
    215    {
    216    return delegate.getTrapCollectorFor( trap );
    217    }
    218
    219  @Override
    220  public synchronized void closeTrapCollectors()
    221    {
    222    delegate.closeTrapCollectors();
    223    }
    224  }