keith-turner commented on a change in pull request #883: Fixes #842 Support multiple ways for running Fluo applications URL: https://github.com/apache/incubator-fluo/pull/883#discussion_r130752743
########## File path: modules/api/src/main/java/org/apache/fluo/api/config/FluoConfiguration.java ########## @@ -200,92 +288,152 @@ private void verifyApplicationName(String name) { } public FluoConfiguration setInstanceZookeepers(String zookeepers) { - return setNonEmptyString(CLIENT_ZOOKEEPER_CONNECT_PROP, zookeepers); + return setNonEmptyString(CONNECTION_ZOOKEEPERS_PROP, zookeepers); } public String getInstanceZookeepers() { - return getNonEmptyString(CLIENT_ZOOKEEPER_CONNECT_PROP, CLIENT_ZOOKEEPER_CONNECT_DEFAULT); + return getDepNonEmptyString(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP, + CONNECTION_ZOOKEEPERS_DEFAULT); } public String getAppZookeepers() { return getInstanceZookeepers() + "/" + getApplicationName(); } public FluoConfiguration setZookeeperTimeout(int timeout) { - return setPositiveInt(CLIENT_ZOOKEEPER_TIMEOUT_PROP, timeout); + return setPositiveInt(CONNECTION_ZOOKEEPER_TIMEOUT_PROP, timeout); } public int getZookeeperTimeout() { - return getPositiveInt(CLIENT_ZOOKEEPER_TIMEOUT_PROP, CLIENT_ZOOKEEPER_TIMEOUT_DEFAULT); + return getDepPositiveInt(CONNECTION_ZOOKEEPER_TIMEOUT_PROP, CLIENT_ZOOKEEPER_TIMEOUT_PROP, + CONNECTION_ZOOKEEPER_TIMEOUT_DEFAULT); } - public FluoConfiguration setClientRetryTimeout(int timeoutMS) { - Preconditions.checkArgument(timeoutMS >= -1, CLIENT_RETRY_TIMEOUT_MS_PROP + " must be >= -1"); - setProperty(CLIENT_RETRY_TIMEOUT_MS_PROP, timeoutMS); - return this; + @Deprecated + public FluoConfiguration setClientRetryTimeout(int timeoutMs) { + return setConnectionRetryTimeout(timeoutMs); } + @Deprecated public int getClientRetryTimeout() { - int retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CLIENT_RETRY_TIMEOUT_MS_DEFAULT); - Preconditions.checkArgument(retval >= -1, CLIENT_RETRY_TIMEOUT_MS_PROP + " must be >= -1"); + return getConnectionRetryTimeout(); + } + + /** + * @since 1.2.0 + */ + public FluoConfiguration setConnectionRetryTimeout(int timeoutMS) { + Preconditions.checkArgument(timeoutMS >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + + " must be >= -1"); + setProperty(CONNECTION_RETRY_TIMEOUT_MS_PROP, timeoutMS); + return this; + } + + /** + * @since 1.2.0 + */ + public int getConnectionRetryTimeout() { + int retval; + if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) { + retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); + } else { + retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); + } + Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1"); return retval; } public FluoConfiguration setAccumuloInstance(String accumuloInstance) { - return setNonEmptyString(CLIENT_ACCUMULO_INSTANCE_PROP, accumuloInstance); + return setNonEmptyString(ACCUMULO_INSTANCE_PROP, accumuloInstance); } public String getAccumuloInstance() { - return getNonEmptyString(CLIENT_ACCUMULO_INSTANCE_PROP); + return getDepNonEmptyString(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP); } public FluoConfiguration setAccumuloUser(String accumuloUser) { - return setNonEmptyString(CLIENT_ACCUMULO_USER_PROP, accumuloUser); + return setNonEmptyString(ACCUMULO_USER_PROP, accumuloUser); } public String getAccumuloUser() { - return getNonEmptyString(CLIENT_ACCUMULO_USER_PROP); + return getDepNonEmptyString(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP); } public FluoConfiguration setAccumuloPassword(String accumuloPassword) { - setProperty(CLIENT_ACCUMULO_PASSWORD_PROP, - verifyNotNull(CLIENT_ACCUMULO_PASSWORD_PROP, accumuloPassword)); + setProperty(ACCUMULO_PASSWORD_PROP, verifyNotNull(ACCUMULO_PASSWORD_PROP, accumuloPassword)); return this; } public String getAccumuloPassword() { - return verifyNotNull(CLIENT_ACCUMULO_PASSWORD_PROP, getString(CLIENT_ACCUMULO_PASSWORD_PROP)); + if (containsKey(ACCUMULO_PASSWORD_PROP)) { + return verifyNotNull(ACCUMULO_PASSWORD_PROP, getString(ACCUMULO_PASSWORD_PROP)); + } else if (containsKey(CLIENT_ACCUMULO_PASSWORD_PROP)) { + return verifyNotNull(CLIENT_ACCUMULO_PASSWORD_PROP, getString(CLIENT_ACCUMULO_PASSWORD_PROP)); + } + throw new NoSuchElementException(ACCUMULO_PASSWORD_PROP + " is not set!"); } public FluoConfiguration setAccumuloZookeepers(String zookeepers) { - return setNonEmptyString(CLIENT_ACCUMULO_ZOOKEEPERS_PROP, zookeepers); + return setNonEmptyString(ACCUMULO_ZOOKEEPERS_PROP, zookeepers); } public String getAccumuloZookeepers() { - return getNonEmptyString(CLIENT_ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_DEFAULT); + return getDepNonEmptyString(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP, + ACCUMULO_ZOOKEEPERS_DEFAULT); } /** * Sets Accumulo table. This property only needs to be set for FluoAdmin as it will be stored in * retrieved from Zookeeper for clients. */ public FluoConfiguration setAccumuloTable(String table) { - return setNonEmptyString(ADMIN_ACCUMULO_TABLE_PROP, table); + return setNonEmptyString(ACCUMULO_TABLE_PROP, table); } public String getAccumuloTable() { - return getNonEmptyString(ADMIN_ACCUMULO_TABLE_PROP); + return getDepNonEmptyString(ACCUMULO_TABLE_PROP, ADMIN_ACCUMULO_TABLE_PROP); } + @Deprecated public FluoConfiguration setAccumuloClasspath(String path) { setProperty(ADMIN_ACCUMULO_CLASSPATH_PROP, verifyNotNull(ADMIN_ACCUMULO_CLASSPATH_PROP, path)); return this; } + @Deprecated public String getAccumuloClasspath() { return getString(ADMIN_ACCUMULO_CLASSPATH_PROP, ADMIN_ACCUMULO_CLASSPATH_DEFAULT); } + /** + * @since 1.2.0 + */ + public FluoConfiguration setAccumuloJars(String path) { + setProperty(ACCUMULO_JARS_PROP, verifyNotNull(ACCUMULO_JARS_PROP, path)); + return this; + } + + /** + * @since 1.2.0 + */ + public String getAccumuloJars() { + return getString(ACCUMULO_JARS_PROP, ACCUMULO_JARS_DEFAULT); + } + + /** + * @since 1.2.0 + */ + public FluoConfiguration setHdfsRoot(String hdfsRoot) { + return setNonEmptyString(HDFS_ROOT_PROP, hdfsRoot); + } + + /** + * @since 1.2.0 + */ + public String getHdfsRoot() { Review comment: I think it would be nice to drop the H and name the method `getDfsRoot()`. Currently we only support Hadoop, but in the future we could support URIs for other dfs types. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services