You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@crail.apache.org by GitBox <gi...@apache.org> on 2019/05/28 13:03:57 UTC

[GitHub] [incubator-crail] PepperJo commented on a change in pull request #72: Allow namenode as parameter instead of conf file.

PepperJo commented on a change in pull request #72: Allow namenode as parameter instead of conf file.
URL: https://github.com/apache/incubator-crail/pull/72#discussion_r288091236
 
 

 ##########
 File path: client/src/main/java/org/apache/crail/conf/CrailConfiguration.java
 ##########
 @@ -33,9 +33,32 @@
 	private static final Logger LOG = CrailUtils.getLogger();
 	private ConcurrentHashMap<String, String> conf;
 
-	public CrailConfiguration() throws IOException {
+	private CrailConfiguration() {
 		conf = new ConcurrentHashMap<>();
-		Properties properties = loadProperties("crail-site.conf");
+	}
+
+	public static CrailConfiguration createEmptyConfiguration() {
+		return new CrailConfiguration();
+	}
+
+	public static CrailConfiguration createConfigurationFromFile() throws IOException {
+		CrailConfiguration cconf = createEmptyConfiguration();
+		String base = System.getenv("CRAIL_HOME");
+		if (base == null || base.isEmpty()) {
+			throw new IllegalArgumentException("CRAIL_HOME environment variable is not set or empty");
+		}
+		cconf.loadConfigurationFromFile(base + "/conf/crail-site.conf");
 
 Review comment:
   I recommend using File.separator instead of '/', makes it more portable.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services