Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-24

make Configuration an interface

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 0.7.2
    • None
    • conf
    • None

    Description

      The Configuration class should become an interface, e.g.:

      public interface Configuration {
      String get(String nam);
      String set(String name, String value);

      int getInt(String name);
      void setInt(String name, int value);
      float getFloat(String name);
      void setFloat(String name, float value);
      //... other utility methods based on get(String) and set(String,String) ...
      }

      An abstract class named ConfigurationBase should be implemented as follows:

      public abstract class ConfigurationBase implements Configuration {
      abstract public String get(String nam);
      abstract public String set(String name, String value);

      public int getInt(String name)

      { ... implementation in terms of get(String) ... }
      public void setInt(String name, int value) {... implementation in terms of set(String, String) ...}
      public float getFloat(String name) { ... implementation in terms of get(String) ... }

      public void setFloat(String name, float value)

      {... implementation in terms of set(String, String) ...}

      //... other utility methods based on get(String) and set(String,String) ...
      }

      A concrete, default implementation will be provided as follows:

      public class ConfigurationImpl implements Writable extends ConfigurationBase {
      private Properties properties;

      // implement abstract methods from ConfigurationBase
      public String get(String name)

      { ... implemented in terms of props ...}

      public String set(String name, String value)

      { .. implemented in terms of props ... }

      // Writable methods
      public write(DataOutputStream out);
      public readFields(DataInputStream in);

      // permit chaining of configurations
      public Configuration getDefaults();
      public void setDefaults(Configuration defaults);
      }

      Only code which creates configurations should need to be updated, so this shouldn't be a huge change.

      Attachments

        1. HADOOP-24-4.patch
          81 kB
          Gal Nitzan
        2. HADOOP-24-3.patch
          80 kB
          Gal Nitzan
        3. HADOOP-24-2.patch
          80 kB
          Gal Nitzan
        4. HADOOP-24.patch
          57 kB
          Gal Nitzan
        5. HADOOP-24.patch
          80 kB
          Gal Nitzan
        6. conf-with-factory.patch
          106 kB
          Gal Nitzan
        7. configuration.patch
          76 kB
          Gal Nitzan
        8. configuration.java
          6 kB
          Gal Nitzan

        Issue Links

          Activity

            People

              cutting Doug Cutting
              cutting Doug Cutting
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: