@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); // There appears to be a bug in getCacheFiles() which returns null, // even though getLocalCacheFiles is deprecated... @SuppressWarnings("deprecation") Path[] localFiles = context.getLocalCacheFiles(); LOG.info("cache contents: " + Arrays.toString(localFiles)); System.out.println("cache contents: " + Arrays.toString(localFiles)); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // simply assume only one file in distributed cache. } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }
@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); beginDate = conf.get("beginDate"); endDate = conf.get("endDate"); // There appears to be a bug in getCacheFiles() which returns null, // even though getLocalCacheFiles is deprecated... @SuppressWarnings("deprecation") Path[] localFiles = context.getLocalCacheFiles(); LOG.info("cache contents: " + Arrays.toString(localFiles)); System.out.println("cache contents: " + Arrays.toString(localFiles)); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // simply assume only one file in distributed cache. } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }
@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); // There appears to be a bug in getCacheFiles() which returns null, // even though getLocalCacheFiles is deprecated... @SuppressWarnings("deprecation") Path[] localFiles = context.getLocalCacheFiles(); LOG.info("cache contents: " + Arrays.toString(localFiles)); System.out.println("cache contents: " + Arrays.toString(localFiles)); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // simply assume only one file in distributed cache. } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }
@Override public void setup(Context context) throws IOException { Configuration conf = context.getConfiguration(); Path[] localFiles = context.getLocalCacheFiles(); URI[] files = context.getCacheFiles(); Path[] localArchives = context.getLocalCacheArchives();
@Override public void setup(Context context) throws IOException { Configuration conf = context.getConfiguration(); Path[] files = context.getLocalCacheFiles(); Path[] archives = context.getLocalCacheArchives(); FileSystem fs = LocalFileSystem.get(conf);
Path[] cacheFiles = context.getLocalCacheFiles();
@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); beginDate = conf.get("beginDate"); endDate = conf.get("endDate"); @SuppressWarnings("deprecation") //Path[] localFiles = DistributedCache.getLocalCacheFiles(conf); Path[] localFiles = context.getLocalCacheFiles(); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // load Prefix Mapping from file prefixMap = (PrefixMapping) Class.forName(conf.get("PrefixMappingClass")).newInstance(); String prefixFileName = localFiles[1].toString(); if (prefixFileName.startsWith("file:")) { prefixFileName = prefixFileName.substring(5, prefixFileName.length()); } prefix = PrefixMapping.loadPrefix(prefixFileName, fst); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }
@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); beginDate = conf.get("beginDate"); endDate = conf.get("endDate"); @SuppressWarnings("deprecation") //Path[] localFiles = DistributedCache.getLocalCacheFiles(conf); Path[] localFiles = context.getLocalCacheFiles(); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // load Prefix Mapping from file prefixMap = (PrefixMapping) Class.forName(conf.get("PrefixMappingClass")).newInstance(); String prefixFileName = localFiles[1].toString(); if (prefixFileName.startsWith("file:")) { prefixFileName = prefixFileName.substring(5, prefixFileName.length()); } prefix = PrefixMapping.loadPrefix(prefixFileName, fst); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }
@Override public void setup(Context context) { try { Configuration conf = context.getConfiguration(); beginDate = conf.get("beginDate"); endDate = conf.get("endDate"); // There appears to be a bug in getCacheFiles() which returns null, // even though getLocalCacheFiles is deprecated... @SuppressWarnings("deprecation") Path[] localFiles = context.getLocalCacheFiles(); LOG.info("cache contents: " + Arrays.toString(localFiles)); System.out.println("cache contents: " + Arrays.toString(localFiles)); // load FST UriMapping from file fst = (UrlMapping) Class.forName(conf.get("UriMappingClass")).newInstance(); String fstFileName = localFiles[0].toString(); if (fstFileName.startsWith("file:")) { fstFileName = fstFileName.substring(5, fstFileName.length()); } fst.loadMapping(fstFileName); // simply assume only one file in distributed cache. } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error Initializing UriMapping"); } }