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.lib.aggregate;
020    
021    import org.apache.hadoop.classification.InterfaceAudience;
022    import org.apache.hadoop.classification.InterfaceStability;
023    import org.apache.hadoop.mapred.JobConf;
024    
025    /**
026     * This class implements a wrapper for a user defined value aggregator 
027     * descriptor.
028     * It serves two functions: One is to create an object of 
029     * ValueAggregatorDescriptor from the name of a user defined class that may be 
030     * dynamically loaded. The other is to delegate invocations of 
031     * generateKeyValPairs function to the created object.
032     */
033    @InterfaceAudience.Public
034    @InterfaceStability.Stable
035    public class UserDefinedValueAggregatorDescriptor extends org.apache.hadoop.
036        mapreduce.lib.aggregate.UserDefinedValueAggregatorDescriptor
037        implements ValueAggregatorDescriptor {
038    
039      /**
040       * Create an instance of the given class
041       * @param className the name of the class
042       * @return a dynamically created instance of the given class 
043       */
044      public static Object createInstance(String className) {
045        return org.apache.hadoop.mapreduce.lib.aggregate.
046          UserDefinedValueAggregatorDescriptor.createInstance(className);
047      }
048    
049      /**
050       * 
051       * @param className the class name of the user defined descriptor class
052       * @param job a configure object used for decriptor configuration
053       */
054      public UserDefinedValueAggregatorDescriptor(String className, JobConf job) {
055        super(className, job);
056        ((ValueAggregatorDescriptor)theAggregatorDescriptor).configure(job);
057      }
058    
059      /**
060       *  Do nothing.
061       */
062      public void configure(JobConf job) {
063    
064      }
065    
066    }