001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package org.apache.hadoop.mapred;
020    
021    import java.io.IOException;
022    
023    import org.apache.hadoop.classification.InterfaceAudience;
024    import org.apache.hadoop.classification.InterfaceStability;
025    import org.apache.hadoop.fs.FileSystem;
026    import org.apache.hadoop.util.Progressable;
027    
028    /** 
029     * <code>OutputFormat</code> describes the output-specification for a 
030     * Map-Reduce job.
031     *
032     * <p>The Map-Reduce framework relies on the <code>OutputFormat</code> of the
033     * job to:<p>
034     * <ol>
035     *   <li>
036     *   Validate the output-specification of the job. For e.g. check that the 
037     *   output directory doesn't already exist. 
038     *   <li>
039     *   Provide the {@link RecordWriter} implementation to be used to write out
040     *   the output files of the job. Output files are stored in a 
041     *   {@link FileSystem}.
042     *   </li>
043     * </ol>
044     * 
045     * @see RecordWriter
046     * @see JobConf
047     * @deprecated Use {@link org.apache.hadoop.mapreduce.OutputFormat} instead.
048     */
049    @Deprecated
050    @InterfaceAudience.Public
051    @InterfaceStability.Stable
052    public interface OutputFormat<K, V> {
053    
054      /** 
055       * Get the {@link RecordWriter} for the given job.
056       *
057       * @param ignored
058       * @param job configuration for the job whose output is being written.
059       * @param name the unique name for this part of the output.
060       * @param progress mechanism for reporting progress while writing to file.
061       * @return a {@link RecordWriter} to write the output for the job.
062       * @throws IOException
063       */
064      RecordWriter<K, V> getRecordWriter(FileSystem ignored, JobConf job,
065                                         String name, Progressable progress)
066      throws IOException;
067    
068      /** 
069       * Check for validity of the output-specification for the job.
070       *  
071       * <p>This is to validate the output specification for the job when it is
072       * a job is submitted.  Typically checks that it does not already exist,
073       * throwing an exception when it already exists, so that output is not
074       * overwritten.</p>
075       *
076       * @param ignored
077       * @param job job configuration.
078       * @throws IOException when output should not be attempted
079       */
080      void checkOutputSpecs(FileSystem ignored, JobConf job) throws IOException;
081    }
082