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