pinal-shah commented on code in PR #476:
URL: https://github.com/apache/atlas/pull/476#discussion_r2560016208


##########
intg/src/main/java/org/apache/atlas/ApplicationProperties.java:
##########
@@ -124,36 +126,67 @@ public static Configuration set(Configuration 
configuration) throws AtlasExcepti
         return instance;
     }
 
-    public static Configuration get(String fileName) throws AtlasException {
-        String confLocation = 
System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+    public static Configuration getConf(String propertyFileName) throws 
AtlasException {
+        if (instance == null) {
+            synchronized (ApplicationProperties.class) {
+                if (instance == null) {
+                    set(get(propertyFileName));
+                }
+            }
+        }
+        return instance;
+    }
 
+    public static Configuration getConf(Configuration clientConf) throws 
AtlasException {
+        if (instance == null) {
+            synchronized (ApplicationProperties.class) {
+                if (instance == null) {
+                    set(clientConf);
+                }
+            }
+        }
+        return instance;
+    }
+
+    public static Configuration get(String fileName) throws AtlasException {
         try {
-            URL url;
+            URL url = null;
+
+            Path path = null;
+            path = Paths.get(fileName);
 
-            if (confLocation == null) {
-                LOG.info("Looking for {} in classpath", fileName);
+            if (path != null && path.getParent() != null) {
+                // Case A: User passed a full path
+                String confLocation = path.getParent().toString();
+                String propertyFileName = path.getFileName().toString();
 
-                url = 
ApplicationProperties.class.getClassLoader().getResource(fileName);
+                url = new File(confLocation, propertyFileName).toURI().toURL();
+                LOG.info("Loading {} from {}", fileName, url);

Review Comment:
   please review if line number 153 to 165 can be replaced by
   ```
   if (StringUtils.isNotEmpty(filepath) {
      File file = new File(filepath);
      if (file.exists()) {
         url = file.toURI().toURL();
      }
      
      if (url == null) {
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to