You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2006/02/06 21:10:27 UTC

[jira] Created: (HADOOP-24) make Configuration an interface

make Configuration an interface
-------------------------------

         Key: HADOOP-24
         URL: http://issues.apache.org/jira/browse/HADOOP-24
     Project: Hadoop
        Type: Improvement
  Components: conf  
    Reporter: Doug Cutting


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412592 ] 

Gal Nitzan commented on HADOOP-24:
----------------------------------

I totaly agree with you Doug on API back compatibilty.

+1 for org.apache.hadoop.config

So if Configuration subclasses ConfigurationImpl you would not have to introduce changes in Nutch for now? and you can postpone it to a suitable time?



> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: HADOOP-24-4.patch

forgot to set abstract for getConfResource... in ConfigurationBase

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Doug Cutting updated HADOOP-24:
-------------------------------

    Status: Open  (was: Patch Available)

> make Configuration an interface
> -------------------------------
>
>                 Key: HADOOP-24
>                 URL: http://issues.apache.org/jira/browse/HADOOP-24
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.7.2
>            Reporter: Doug Cutting
>         Attachments: configuration.java, configuration.patch, HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412598 ] 

Doug Cutting commented on HADOOP-24:
------------------------------------

Right, we should not add dependencies to Nutch on as-yet-unreleased features in Hadoop.  But we want Nutch users to be able to use the current Hadoop trunk.  So once we've made the next Hadoop release, and upgraded Nutch's trunk to use that release, then we can introduce changes to Nutch.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Konstantin Shvachko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412285 ] 

Konstantin Shvachko commented on HADOOP-24:
-------------------------------------------

I think that all declarations and parameters should say Configuration that is the interface.
And the constructors should be the only places where ConfigurationImpl
appears explicitly. E.g. all occurrences
      private static ConfigurationImpl conf = new ConfigurationImpl();
should be replaced by
      private static Configuration conf = new ConfigurationImpl();
I haven't seen a lot of nutch code, but if it uses only the API, then
that should work. If it does construct config instances then there should be
a static newInstance() somewhere I guess.


> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: conf-with-factory.patch

I agree with you Doug. I also took the liberty to make the ConfigurationFactory an interface.

signed sealed and delivered (without missing classes I hope :-)  )

Gal.

> make Configuration an interface
> -------------------------------
>
>                 Key: HADOOP-24
>                 URL: http://issues.apache.org/jira/browse/HADOOP-24
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.7.2
>            Reporter: Doug Cutting
>         Attachments: conf-with-factory.patch, configuration.java, configuration.patch, HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "David Bowen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12378968 ] 

David Bowen commented on HADOOP-24:
-----------------------------------


The code contains getObject and setObject methods.  Is this a good idea - considering that it means that the ConfigurationImpl cannot be written out and read back without losing those values?  I think it would be better to remove these and maintain the ability to serialize and deserialize.  (Is there a reason not to have Configuration extend Writable?)

What is a use case for ConfigurationBase.getProperties() which returns an object of unknown type?  It might be better to have something like String[] getPropertyNames(String regex).  (And this should be in Configuration also.)  This allows for things like treating the property name space as a hierarchy, so that e.g. you can find all the properties beginning with some string.

- David




> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12451250 ] 
            
Gal Nitzan commented on HADOOP-24:
----------------------------------

Any comment???

> make Configuration an interface
> -------------------------------
>
>                 Key: HADOOP-24
>                 URL: http://issues.apache.org/jira/browse/HADOOP-24
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.7.2
>            Reporter: Doug Cutting
>         Attachments: conf-with-factory.patch, configuration.java, configuration.patch, HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Andrzej Bialecki (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12378972 ] 

Andrzej Bialecki  commented on HADOOP-24:
-----------------------------------------

In Nutch in many places we create objects with a "pseudo-singleton" semantics (i.e. one per task), that are costly to create. These methods were added to provide a convenient caching mechanism to carry around these objects within the same task. They don't have to be serialized/deserialized.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12445261 ] 
            
Gal Nitzan commented on HADOOP-24:
----------------------------------

Done.... for some reason attaching thw file did not produce an email.

> make Configuration an interface
> -------------------------------
>
>                 Key: HADOOP-24
>                 URL: http://issues.apache.org/jira/browse/HADOOP-24
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.7.2
>            Reporter: Doug Cutting
>         Attachments: conf-with-factory.patch, configuration.java, configuration.patch, HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412610 ] 

Gal Nitzan commented on HADOOP-24:
----------------------------------

Great, I shall rewrite and submit a new patch for review.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412376 ] 

Gal Nitzan commented on HADOOP-24:
----------------------------------

Hi,

In regards to the code compatibility - For Hadoop all new code is already included (tests also) is in this patch.

For Nutch I already have the patch ready and it is not that big a change since most code uses Configuration (so the actual change is only in construction) so ConfigurationImpl has a copy constructor that accepts a Configuration. I actualy tested it also. I can submit it here as well if we decide to use this patch.

I'm not sure it would be a good idea to change the current design/implementation just for the sake of compatibility. I think the design(Doug's) and the implementation are clean and shall be more understandable to implementers/extenders.



> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12444508 ] 
            
Doug Cutting commented on HADOOP-24:
------------------------------------

When I apply this to trunk things don't compile.  I think you forgot to include ConfigurationImpl.java.

I also wonder if, since we're editing all the places where a configuration is constructed, we might change things to use a factory.  So, instead of 'new ConfigurationImpl()' we'd have something like 'ConfigurationFactory.get()'.  That way, we could in the future change the default implementation without changing all of these places again.  E.g., if you're nesting Hadoop in JMX then you might specify a JMX configuration factory as the default.  Does that make sense?


> make Configuration an interface
> -------------------------------
>
>                 Key: HADOOP-24
>                 URL: http://issues.apache.org/jira/browse/HADOOP-24
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.7.2
>            Reporter: Doug Cutting
>         Attachments: configuration.java, configuration.patch, HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412253 ] 

Doug Cutting commented on HADOOP-24:
------------------------------------

I finally had a chance to look closely at this.  One problem I now see is that it's incompatible: code that previously called 'new Configuration()' has to be updated to instead call 'new ConfigurationImpl()'.  Nutch is a good test-case for back-compatibility, since it uses so much of Hadoop's APIs.  Ideally we can figure out a way to do this so that, e.g., the new Hadoop jar can be dropped into existing Nutch and work correctly.

I think this means that the interface cannot be named 'Configuration'.  Instead we should probably call it ConfigurationInterface, and change ConfigurationImpl to be Configuration.  Does that sound like a good solution?

Thanks for the patch, and thanks for your patience!

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: HADOOP-24.patch

Hi,

I have implemented the configuration interface.

Remarks would be appreciated.

Gal.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: HADOOP-24.patch

Fix previous patch. Forgot to add the actual files :)

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: HADOOP-24-2.patch

Added some missing interfaces

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12412580 ] 

Doug Cutting commented on HADOOP-24:
------------------------------------

API back-compatibility is important.  We'd like folks to be able to upgrade to new releases without having to change their code.  The convention we've had is that, code which compiles against release 0.X without deprecation warnings will still compile against release 0.X+1, but may require changes to compile against release 0.X+2.  Is that reasonable?

If so, then 'new Configuration()' must still create a usable configuration and not a compilation error in release 0.3.  It may be deprecated, but it should still work.  Yes, this is a pain, since Configuration would be a great name for the interface, but there's code out there (more than just Nutch) that we should try not to break.  Nutch is a good, public test case for this sort of back-compatibility, that's the reason I mention it.

Another approach might be to use a new package.  We could put the new classes in org.apache.hadoop.config, and then have org.apache.hadoop.conf.Configuration be a deprecated subclass of org.apache.hadoop.config.ConfigurationImpl.  Then, after 0.3 is released, we could remove the entire org.apache.hadoop.conf package.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24-4.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HADOOP-24?page=all ]

Gal Nitzan updated HADOOP-24:
-----------------------------

    Attachment: HADOOP-24-3.patch

Last minute changes :(

Had to move getObject setObject to ConfigurationImpl

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24-2.patch, HADOOP-24-3.patch, HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (HADOOP-24) make Configuration an interface

Posted by "Gal Nitzan (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HADOOP-24?page=comments#action_12378979 ] 

Gal Nitzan commented on HADOOP-24:
----------------------------------

Since this is my first interaction with Hadoop code "on a first name basis" :) I didn't want to rock the boat too much.

My first goal was to implement the interfaces and the implementation with as little as possible major changes all arround the code. As it is now all test are still working and nothing broken.

So if the patch would "pass" the reviews it would be easier to make additions when all blocks are in place.

getPropertyNames is good idea to add as an interface to configuration.

Thanks.

> make Configuration an interface
> -------------------------------
>
>          Key: HADOOP-24
>          URL: http://issues.apache.org/jira/browse/HADOOP-24
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Reporter: Doug Cutting
>  Attachments: HADOOP-24.patch, HADOOP-24.patch
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira