View Javadoc

1   /* Copyright (c) 2008 Sascha Kohlmann
2    *
3    * This program is free software: you can redistribute it and/or modify
4    * it under the terms of the GNU Affero General Public License as published by
5    * the Free Software Foundation, either version 3 of the License, or
6    * (at your option) any later version.
7    *
8    * This program is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   * GNU Affero General Public License for more details.
12   *
13   * You should have received a copy of the GNU Affero General Public License
14   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15   */
16  package net.sf.eos.hadoop;
17  
18  import static net.sf.eos.config.ConfigurationKey.Type.CLASSNAME;
19  import net.sf.eos.config.ConfigurationKey;
20  
21  import org.apache.hadoop.fs.Path;
22  import org.apache.hadoop.mapred.JobConf;
23  
24  import java.io.IOException;
25  
26  /**
27   * Supports different strategies to fetch the cache path.
28   * @author Sascha Kohlmann
29   * @see FullyDistributedCacheStrategy
30   * @see TestDistributedCacheStrategy
31   */
32  public interface DistributedCacheStrategy {
33  
34      /** The key for the name of the strategy implementing class. */
35      @SuppressWarnings("nls")
36      @ConfigurationKey(type=CLASSNAME,
37                              description="Supports different strategies to fetch"
38                                          + " the cache path.")
39      String STRATEGY_IMPL_CONFIG_NAME =
40          "net.sf.eos.hadoop.DistributedCacheStrategy.impl";
41  
42      /**
43       * Strategies implementing classes must implement this method.
44       * @param conf the environment configuration to get the cache
45       * @return pathes to the chache.
46       * @throws IOException if an error occurs
47       */
48      Path[] distributedCachePathes(final JobConf conf) throws IOException;
49  }