[ 
https://issues.apache.org/jira/browse/OOZIE-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14038324#comment-14038324
 ] 

Azrael commented on OOZIE-1890:
-------------------------------

Recently, I have been doing similar work. 
My thought is:
# Define default in code and sync oozie-default: create enum OozieConf based on 
oozie-default
# Prevent user to define invalid configuration : Warn it if configuration is 
not in OozieConf

{code:title=ConfigurationService}
public static enum OozieConf {
    COMPRESSION_OUTPUT_CODEC(CodecFactory.COMPRESSION_OUTPUT_CODEC, "NONE"),
    
OOZIE_MAPREDUCE_UBER_JAR_ENABLE(MapReduceActionExecutor.OOZIE_MAPREDUCE_UBER_JAR_ENABLE,
 "false"),
    OOZIE_BASE_URL(SLAEmailEventListener.OOZIE_BASE_URL, 
"http://localhost:8080/oozie";),
    ......
    ;

    public final String name;
    public final String defaultValue;

    OozieConf(String name, String defaultValue) {
        this.name = name;
        this.defaultValue = defaultValue;
    }
}

public void verifyConfigurationName() {
    for (Map.Entry<String, String> entry: configuration) {
        if (getOozieConf(entry.getKey()) == null ) {
            log.warn("Invalid configuration name [{0}] ", entry.getKey());
        }
    }
}

{code}
{code:title=Use case of configuration}
String oozieBaseUrl = ConfigurationService.get(conf, 
ConfigurationService.OozieConf.OOZIE_BASE_URL);
{code}

Maybe it need to be changed for {{3.Getting rid of code defaults}}.
I will upload initial patch.










> Make oozie-site empty and reconcile defaults between oozie-default and the 
> code
> -------------------------------------------------------------------------------
>
>                 Key: OOZIE-1890
>                 URL: https://issues.apache.org/jira/browse/OOZIE-1890
>             Project: Oozie
>          Issue Type: Bug
>          Components: core
>            Reporter: Robert Kanter
>
> As shwetha and puru suggested in OOZIE-1888, oozie-site vs oozie-default is a 
> point of confusion for users.  We've also had issues in the past where 
> they've had different values from each other and/or from the code's default 
> (i.e. {{conf.get(PROP_NAME, DEFAULT_VALUE)}}).
> We should make oozie-default the only source of truth by:
> # Putting all configuration properties in oozie-default.
> # Making oozie-site empty; if the user wants to change a property, they can 
> copy it out of the for-reference oozie-default.
> # Getting rid of the code defaults.  It's easy for these to be out of sync 
> with oozie-default, leading to confusion.  They aren't used anyway because 
> oozie-default should always be there (and will now have every property)
> This will require looking through all classes to make sure we're not missing 
> anything from oozie-default and also checking that we put the proper default 
> value (from all 3 sources) into oozie-default.  It may be nice to also 
> reorder the properties in oozie-default alphabetically (and also do this 
> going forward with new properties).
> Also, {{oozie.service.WorkflowAppService.system.libpath}} should be set to 
> "/user/$\{user.name\}/share/lib" (which is what OOZIE-1888 wanted to do).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to