    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.scheme;
    022
    023import java.io.IOException;
    024
    025import cascading.flow.FlowProcess;
    026import cascading.tap.Tap;
    027import cascading.tuple.Fields;
    028
    029/**
    030 * Class NullScheme is a {@link Scheme} that neither reads or writes any values.
    031 * <p/>
    032 * It is typically used as a placeholder where a Scheme instance is needed but generally ignored.
    033 */
    034public class NullScheme<Config, Input, Output, SourceContext, SinkContext> extends Scheme<Config, Input, Output, SourceContext, SinkContext>
    035  {
    036  public NullScheme()
    037    {
    038    }
    039
    040  public NullScheme( Fields sourceFields, Fields sinkFields )
    041    {
    042    super( sourceFields, sinkFields );
    043    }
    044
    045  @Override
    046  public void sourceConfInit( FlowProcess<? extends Config> flowProcess, Tap<Config, Input, Output> tap, Config conf )
    047    {
    048    }
    049
    050  @Override
    051  public void sinkConfInit( FlowProcess<? extends Config> flowProcess, Tap<Config, Input, Output> tap, Config conf )
    052    {
    053    }
    054
    055  @Override
    056  public boolean source( FlowProcess<? extends Config> flowProcess, SourceCall<SourceContext, Input> sourceCall ) throws IOException
    057    {
    058    return false;
    059    }
    060
    061  @Override
    062  public void sink( FlowProcess<? extends Config> flowProcess, SinkCall<SinkContext, Output> sinkCall ) throws IOException
    063    {
    064
    065    }
    066
    067  @Override
    068  public String toString()
    069    {
    070    return getClass().getSimpleName();
    071    }
    072  }