asqasq commented on issue #72: Allow namenode as parameter instead of conf file.
URL: https://github.com/apache/incubator-crail/pull/72#issuecomment-496189974
 
 
   One way to have more flexibility and be semantically consistent,
   would be to introduce three static functions to create an
   empty configuration, create a configuration from the default
   configuration file and create a configuration from the file given
   as parameter and set the current public constructor to private.
   
   The code would be something like this:
   
   ```
   private CrailConfiguration() {
     ...
   }
   
   public static CrailConfiguration createEmptyConfiguration() {
     ...
   }
   public static CrailConfiguration createConfigurationFromFile() {
     ...
   }
   public static CrailConfiguration createConfigurationFromFile(String path) {
     ...
   }
   ```
   
   The function `createEmptyConfiguration` instantiates an empty configuration.
   The user can set properties by calling `public void set(String key, String 
value)`
   and `public void setInt(String key, int level)`, two already existing 
functions.
   
   `createConfigurationFromFile` instantiates `CrailConfiguration` and
   loads the default configuration file. This would be the exact same
   behaviour as the current default public constructior `CrailConfiguration()`.
   
   `createConfigurationFromFile(String path)` would do the same as the above
   function, but read the configuration from the explicitely given full
   path to the configuration file, instead of loading the default
   configuration file.
   
   This implies a change to the applications. Applications cannot
   call `new CrailConfiguration()` anymore (constructor is private),
   but need to be changed to call `createConfigurationFromFile()`,
   which has the exact same semantic as the currently public
   `CrailConfiguration()` constructor.
   
   How does that sounds?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to