hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r537282 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/conf/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/mapred/ src/test/org/apache/hadoop/dfs/ src/test/org/apache/hadoop/mapred/
Date Fri, 11 May 2007 20:30:55 GMT
Author: cutting
Date: Fri May 11 13:30:53 2007
New Revision: 537282

URL: http://svn.apache.org/viewvc?view=rev&rev=537282
Log:
HADOOP-1343.  In Configuration, deprecate set(String,Object) and implement Iterable.  Contributed
by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/UpgradeUtilities.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestAggregates.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri May 11 13:30:53 2007
@@ -6,6 +6,9 @@
   1. HADOOP-1197.  In Configuration, deprecate getObject() and add
      getRaw(), which skips variable expansion. (omalley via cutting)
 
+  2. HADOOP-1343.  In Configuration, deprecate set(String,Object) and
+     implement Iterable. (omalley via cutting)
+
 
 Branch 0.13 (unreleased changes)
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java Fri May 11 13:30:53
2007
@@ -69,7 +69,7 @@
  * <tt>${basedir}</tt> is resolved to another property in this Configuration.
  * Then <tt>${user.name}</tt> is resolved to a System property.
  */
-public class Configuration {
+public class Configuration implements Iterable<Map.Entry<String,String>> {
   private static final Log LOG =
     LogFactory.getLog("org.apache.hadoop.conf.Configuration");
 
@@ -218,12 +218,21 @@
     return getProps().getProperty(name);
   }
 
-  /** Sets the value of the <code>name</code> property. */
+  /** Sets the value of the <code>name</code> property. 
+   * @deprecated
+   */
   public void set(String name, Object value) {
     getOverlay().setProperty(name, value.toString());
     getProps().setProperty(name, value.toString());
   }
   
+  /** Sets the value of the <code>name</code> property. 
+   */
+  public void set(String name, String value) {
+    getOverlay().setProperty(name, value);
+    getProps().setProperty(name, value);
+  }
+  
   private synchronized Properties getOverlay() {
     if (overlay==null){
       overlay=new Properties();
@@ -482,9 +491,30 @@
     return properties;
   }
 
-  /** @return Iterator&lt; Map.Entry&lt;String,String> >  */
+  /** @return Iterator&lt; Map.Entry&lt;String,String> >  
+   * @deprecated use <code>iterator()</code> instead 
+   */
   public Iterator entries() {
-    return getProps().entrySet().iterator();
+    return iterator();
+  }
+
+  /**
+   * Go through the list of String key-value pairs in the configuration.
+   * @return an iterator over the entries
+   */
+  public Iterator<Map.Entry<String, String>> iterator() {
+    // Get a copy of just the string to string pairs. After the old object
+    // methods that allow non-strings to be put into configurations are removed,
+    // we could replace properties with a Map<String,String> and get rid of this
+    // code.
+    Map<String,String> result = new HashMap<String,String>();
+    for(Map.Entry<Object,Object> item: getProps().entrySet()) {
+      if (item.getKey() instanceof String && 
+          item.getValue() instanceof String) {
+        result.put((String) item.getKey(), (String) item.getValue());
+      }
+    }
+    return result.entrySet().iterator();
   }
 
   private void loadResources(Properties props,

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Fri May 11 13:30:53 2007
@@ -1250,7 +1250,7 @@
   }
 
   private static void setStartupOption(Configuration conf, StartupOption opt) {
-    conf.set("dfs.datanode.startup", opt);
+    conf.set("dfs.datanode.startup", opt.toString());
   }
 
   static StartupOption getStartupOption(Configuration conf) {

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Fri May 11 13:30:53
2007
@@ -280,7 +280,7 @@
         
     // The web-server port can be ephemeral... ensure we have the correct info
     this.infoPort = this.infoServer.getPort();
-    conf.set("dfs.info.port", this.infoPort); 
+    conf.setInt("dfs.info.port", this.infoPort); 
     LOG.info("Web-server up at: " + conf.get("dfs.info.port"));
   }
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java Fri May 11 13:30:53
2007
@@ -20,12 +20,12 @@
 
 
 import java.io.IOException;
-import java.io.File;
 
 import java.util.StringTokenizer;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Map;
 
 import java.net.URL;
 import java.net.URLDecoder;
@@ -153,7 +153,7 @@
 
   public void setInputPath(Path dir) {
     dir = new Path(getWorkingDirectory(), dir);
-    set("mapred.input.dir", dir);
+    set("mapred.input.dir", dir.toString());
   }
 
   public void addInputPath(Path dir) {
@@ -261,7 +261,7 @@
 
   public void setOutputPath(Path dir) {
     dir = new Path(getWorkingDirectory(), dir);
-    set("mapred.output.dir", dir);
+    set("mapred.output.dir", dir.toString());
   }
 
   public InputFormat getInputFormat() {

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Fri May 11 13:30:53
2007
@@ -670,7 +670,7 @@
     this.conf.set("mapred.job.tracker", new String(this.localMachine + ":" + this.port));
     LOG.info("JobTracker up at: " + this.port);
     this.infoPort = this.infoServer.getPort();
-    this.conf.set("mapred.job.tracker.info.port", this.infoPort); 
+    this.conf.setInt("mapred.job.tracker.info.port", this.infoPort); 
     LOG.info("JobTracker webserver: " + this.infoServer.getPort());
   }
 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/UpgradeUtilities.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/UpgradeUtilities.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/UpgradeUtilities.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/UpgradeUtilities.java Fri May 11 13:30:53
2007
@@ -151,7 +151,7 @@
     Configuration conf = new Configuration();
     conf.set("dfs.name.dir", nameNodeDirs.toString());
     conf.set("dfs.data.dir", dataNodeDirs.toString());
-    conf.set("dfs.blockreport.intervalMsec", 10000);
+    conf.setInt("dfs.blockreport.intervalMsec", 10000);
     return conf;
   }
   

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java Fri May 11 13:30:53
2007
@@ -222,7 +222,7 @@
     JobConf result = new JobConf();
     result.set("fs.default.name", namenode);
     result.set("mapred.job.tracker", "localhost:"+jobTrackerPort);
-    result.set("mapred.job.tracker.info.port", jobTrackerInfoPort);
+    result.setInt("mapred.job.tracker.info.port", jobTrackerInfoPort);
     // for debugging have all task output sent to the test output
     JobClient.setTaskOutputFilter(result, JobClient.TaskStatusFilter.ALL);
     return result;

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java Fri May
11 13:30:53 2007
@@ -126,8 +126,8 @@
   protected JobConf createJobConf() {
     JobConf conf = super.createJobConf();
     conf.set("job.end.notification.url", getNotificationUrlTemplate());
-    conf.set("job.end.retry.attempts", 3);
-    conf.set("job.end.retry.interval", 200);
+    conf.setInt("job.end.retry.attempts", 3);
+    conf.setInt("job.end.retry.interval", 200);
     return conf;
   }
 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestAggregates.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestAggregates.java?view=diff&rev=537282&r1=537281&r2=537282
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestAggregates.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestAggregates.java Fri May 11 13:30:53
2007
@@ -93,8 +93,9 @@
     job.setReducerClass(ValueAggregatorReducer.class);
     job.setCombinerClass(ValueAggregatorCombiner.class);
 
-    job.set("aggregator.descriptor.num", 1);
-    job.set("aggregator.descriptor.0", "UserDefined,org.apache.hadoop.mapred.lib.aggregate.AggregatorTests");
+    job.setInt("aggregator.descriptor.num", 1);
+    job.set("aggregator.descriptor.0", 
+          "UserDefined,org.apache.hadoop.mapred.lib.aggregate.AggregatorTests");
 
     JobClient.runJob(job);
 



Mime
View raw message