hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r643764 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/conf/Configuration.java src/java/org/apache/hadoop/io/serializer/SerializationFactory.java
Date Wed, 02 Apr 2008 07:21:23 GMT
Author: ddas
Date: Wed Apr  2 00:20:57 2008
New Revision: 643764

URL: http://svn.apache.org/viewvc?rev=643764&view=rev
Log:
HADOOP-3093. Adds Configuration.getStrings(name, default-value) and the corresponding setStrings.
Contributed by Amareshwari Sriramadasu.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/conf/Configuration.java
    hadoop/core/trunk/src/java/org/apache/hadoop/io/serializer/SerializationFactory.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=643764&r1=643763&r2=643764&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Apr  2 00:20:57 2008
@@ -173,6 +173,9 @@
 
     HADOOP-1228.  Ant task to generate Eclipse project files.  (tomwhite)
 
+    HADOOP-3093. Adds Configuration.getStrings(name, default-value) and
+    the corresponding setStrings. (Amareshwari Sriramadasu via ddas)
+
   OPTIMIZATIONS
 
     HADOOP-2790.  Fixed inefficient method hasSpeculativeTask by removing

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/conf/Configuration.java?rev=643764&r1=643763&r2=643764&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/conf/Configuration.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/conf/Configuration.java Wed Apr  2 00:20:57
2008
@@ -540,6 +540,36 @@
     return StringUtils.getStrings(valueString);
   }
 
+  /** 
+   * Get the comma delimited values of the <code>name</code> property as 
+   * an array of <code>String</code>s.  
+   * If no such property is specified then default value is returned.
+   * 
+   * @param name property name.
+   * @param defaultValue The default value
+   * @return property value as an array of <code>String</code>s, 
+   *         or default value. 
+   */
+  public String[] getStrings(String name, String... defaultValue) {
+    String valueString = get(name);
+    if (valueString == null) {
+      return defaultValue;
+    } else {
+      return StringUtils.getStrings(valueString);
+    }
+  }
+
+  /** 
+   * Set the array of string values for the <code>name</code> property as 
+   * as comma delimited values.  
+   * 
+   * @param name property name.
+   * @param values The values
+   */
+  public void setStrings(String name, String... values) {
+    set(name, StringUtils.arrayToString(values));
+  }
+ 
   /**
    * Load a class by name.
    * 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/io/serializer/SerializationFactory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/io/serializer/SerializationFactory.java?rev=643764&r1=643763&r2=643764&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/io/serializer/SerializationFactory.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/io/serializer/SerializationFactory.java Wed
Apr  2 00:20:57 2008
@@ -49,7 +49,8 @@
    */
   public SerializationFactory(Configuration conf) {
     super(conf);
-    for (String serializerName : conf.getStrings("io.serializations")) {
+    for (String serializerName : conf.getStrings("io.serializations", 
+      new String[]{"org.apache.hadoop.io.serializer.WritableSerialization"})) {
       add(serializerName);
     }
   }



Mime
View raw message