List of usage examples for org.apache.hadoop.conf Configuration isDeprecated
public static boolean isDeprecated(String key)
key
is deprecated. From source file:com.michaeljones.hellohadoopworldmaven.HelloHdfs.java
public boolean checkForDeprecatedConfig(boolean dumpAll) { PrintWriter dumpOut = null;//from ww w .jav a2 s . c om boolean hasDeprecation = false; try { dumpOut = new PrintWriter(new BufferedWriter(new FileWriter(configDumpFileName))); Iterator<Map.Entry<String, String>> iterator = hadoopConfig.iterator(); while (iterator.hasNext()) { Map.Entry<String, String> entry = iterator.next(); String key = entry.getKey(); String value = entry.getValue(); boolean deprecated = Configuration.isDeprecated(key); if (deprecated) { hasDeprecation = true; dumpOut.println("Key: " + key + "Value: " + value + " DEPRECATED."); } else if (dumpAll) { dumpOut.println("Key: " + key + "Value: " + value); } } } catch (FileNotFoundException ex) { Logger.getLogger(HelloHdfs.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(HelloHdfs.class.getName()).log(Level.SEVERE, null, ex); } finally { if (dumpOut != null) { dumpOut.close(); } } return hasDeprecation; }
From source file:org.apache.tez.mapreduce.hadoop.MultiStageMRConfigUtil.java
License:Apache License
@Private static Configuration extractStageConf(Configuration baseConf, String prefix) { Configuration strippedConf = new Configuration(false); Configuration conf = new Configuration(false); Iterator<Entry<String, String>> confEntries = baseConf.iterator(); while (confEntries.hasNext()) { Entry<String, String> entry = confEntries.next(); String key = entry.getKey(); if (key.startsWith(prefix)) { // Ignore keys for other intermediate stages in case of an initial or final stage. if (prefix.equals("") && key.startsWith(MRJobConfig.MRR_INTERMEDIATE_STAGE_PREFIX)) { continue; }/*from ww w.j a v a 2 s. c o m*/ String newKey = key.replace(prefix, ""); strippedConf.set(newKey, entry.getValue()); } else { // Ignore keys for other intermediate stages. if (key.startsWith(MRJobConfig.MRR_INTERMEDIATE_STAGE_PREFIX)) { continue; } // Set all base keys in the new conf conf.set(key, entry.getValue()); } } // Replace values from strippedConf into the finalConf. Override values // which may have been copied over from the baseConf root level. Iterator<Entry<String, String>> entries = strippedConf.iterator(); while (entries.hasNext()) { Entry<String, String> entry = entries.next(); if (!Configuration.isDeprecated(entry.getKey())) { conf.set(entry.getKey(), entry.getValue()); } } return conf; }
From source file:org.janusgraph.hadoop.compat.h2.ImmutableConfiguration.java
License:Apache License
public static boolean isDeprecated(String key) { return Configuration.isDeprecated(key); }