1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.eos.hadoop;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.apache.hadoop.filecache.DistributedCache;
21 import org.apache.hadoop.fs.Path;
22 import org.apache.hadoop.mapred.JobConf;
23
24 import java.io.IOException;
25 import java.util.ArrayList;
26 import java.util.List;
27
28
29
30
31
32 public class FullyDistributedCacheStrategy implements DistributedCacheStrategy {
33
34
35 private static final Log LOG =
36 LogFactory.getLog(FullyDistributedCacheStrategy.class.getName());
37
38
39
40
41 @SuppressWarnings("nls")
42 public Path[] distributedCachePathes(final JobConf conf) throws IOException
43 {
44 final List<Path> pathes = new ArrayList<Path>();
45 final Path[] pathList = DistributedCache.getLocalCacheFiles(conf);
46
47 for (final Path path : pathList) {
48 final Path qualified = new Path("file", "", path.toString());
49 LOG.info("path: " + path + " - qualified path: " + qualified);
50 pathes.add(qualified);
51 }
52
53 return pathes.toArray(new Path[pathList.length]);
54 }
55 }