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 cascading.tap.Tap;
025import cascading.tuple.TupleEntry;
026
027/**
028 * SinkCall provides access to the current {@link Scheme#sink(cascading.flow.FlowProcess, SinkCall)} invocation
029 * arguments.
030 * <p>
031 * Use the Context to store thread local values.
032 *
033 * @param <Context>
034 * @param <Output>
035 */
036public interface SinkCall<Context, Output>
037  {
038  /**
039   * Method getContext returns the context of this SinkCall object.
040   *
041   * @return the context (type C) of this SinkCall object.
042   */
043  Context getContext();
044
045  /**
046   * Method setContext sets the context of this SinkCall object.
047   *
048   * @param context the context of this SinkCall object.
049   */
050  void setContext( Context context );
051
052  /**
053   * Method getOutgoingEntry returns the final {@link TupleEntry} to be passed to the
054   * {@link #getOutput()} output handler.
055   * <p>
056   * That is, the result of calling getOutgoingEntry() should be passed directly to the
057   * platform specific output handler returned by getOutput().
058   * <p>
059   * Note the returned value from this method cannot be modified.
060   *
061   * @return TupleEntry
062   */
063  TupleEntry getOutgoingEntry();
064
065  Output getOutput();
066
067  /**
068   * Method getTap returns the parent {@link Tap} instance that encapsulates the current {@link Scheme} instance.
069   *
070   * @return the parent Tap
071   */
072  Tap getTap();
073  }