atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [01/50] [abbrv] incubator-atlas git commit: loading properties from conf directory in deployment
Date Wed, 13 May 2015 21:27:42 GMT
Repository: incubator-atlas
Updated Branches:
  refs/remotes/origin/master [created] 215d7400d


loading properties from conf directory in deployment


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/e631ed0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/e631ed0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/e631ed0a

Branch: refs/remotes/origin/master
Commit: e631ed0a1390e04341c11e49d09ee0f29737aaf3
Parents: ee6126f
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Wed Apr 29 12:52:03 2015 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Wed Apr 29 12:52:03 2015 +0530

----------------------------------------------------------------------
 addons/hive-bridge/pom.xml                      |  2 +-
 .../apache/hadoop/metadata/PropertiesUtil.java  | 25 +++++++++++++++-----
 .../metadata/discovery/HiveLineageService.java  |  3 ++-
 .../repository/graph/TitanGraphProvider.java    |  5 ++--
 src/bin/metadata-config.sh                      |  2 +-
 5 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e631ed0a/addons/hive-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/pom.xml b/addons/hive-bridge/pom.xml
index 61902ce..b908847 100755
--- a/addons/hive-bridge/pom.xml
+++ b/addons/hive-bridge/pom.xml
@@ -208,7 +208,7 @@
                             <value>${project.build.directory}/logs</value>
                         </systemProperty>
                         <systemProperty>
-                            <name>metadata.properties.location</name>
+                            <name>metadata.conf</name>
                             <value>addons/hive-bridge/src/test/resources</value>
                         </systemProperty>
                     </systemProperties>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e631ed0a/repository/src/main/java/org/apache/hadoop/metadata/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/hadoop/metadata/PropertiesUtil.java b/repository/src/main/java/org/apache/hadoop/metadata/PropertiesUtil.java
index cd8911b..d30c4cc 100644
--- a/repository/src/main/java/org/apache/hadoop/metadata/PropertiesUtil.java
+++ b/repository/src/main/java/org/apache/hadoop/metadata/PropertiesUtil.java
@@ -20,18 +20,31 @@ package org.apache.hadoop.metadata;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 public class PropertiesUtil {
+    private static final Logger LOG = LoggerFactory.getLogger(PropertiesUtil.class);
+
     private static final String APPLICATION_PROPERTIES = "application.properties";
 
-    public static final PropertiesConfiguration getApplicationProperties() throws ConfigurationException
{
-        String proprtiesLocation = System.getProperty("metadata.properties.location");
-        if (proprtiesLocation == null) {
-            return new PropertiesConfiguration(PropertiesUtil.class.getResource("/" + APPLICATION_PROPERTIES));
-        } else {
-            return new PropertiesConfiguration(new File(proprtiesLocation, APPLICATION_PROPERTIES));
+    public static final PropertiesConfiguration getApplicationProperties() throws MetadataException
{
+        String confLocation = System.getProperty("metadata.conf");
+        URL url;
+        try {
+            if (confLocation == null) {
+                url = PropertiesUtil.class.getResource("/" + APPLICATION_PROPERTIES);
+            } else {
+                url = new File(confLocation, APPLICATION_PROPERTIES).toURI().toURL();
+            }
+            LOG.info("Loading {} from {}", APPLICATION_PROPERTIES, url);
+            return new PropertiesConfiguration(url);
+        } catch (Exception e) {
+            throw new MetadataException("Failed to load application properties", e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e631ed0a/repository/src/main/java/org/apache/hadoop/metadata/discovery/HiveLineageService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/hadoop/metadata/discovery/HiveLineageService.java
b/repository/src/main/java/org/apache/hadoop/metadata/discovery/HiveLineageService.java
index 3cd120a..c79cde3 100644
--- a/repository/src/main/java/org/apache/hadoop/metadata/discovery/HiveLineageService.java
+++ b/repository/src/main/java/org/apache/hadoop/metadata/discovery/HiveLineageService.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.metadata.discovery;
 import com.thinkaurelius.titan.core.TitanGraph;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.hadoop.metadata.MetadataException;
 import org.apache.hadoop.metadata.PropertiesUtil;
 import org.apache.hadoop.metadata.discovery.graph.DefaultGraphPersistenceStrategy;
 import org.apache.hadoop.metadata.discovery.graph.GraphBackedDiscoveryService;
@@ -70,7 +71,7 @@ public class HiveLineageService implements LineageService {
                     conf.getString("metadata.lineage.hive.process.inputs.name", "inputTables");
             HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME =
                     conf.getString("metadata.lineage.hive.process.outputs.name", "outputTables");
-        } catch (ConfigurationException e) {
+        } catch (MetadataException e) {
             throw new RuntimeException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e631ed0a/repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphProvider.java
b/repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphProvider.java
index c83d083..0647a84 100755
--- a/repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphProvider.java
+++ b/repository/src/main/java/org/apache/hadoop/metadata/repository/graph/TitanGraphProvider.java
@@ -23,6 +23,7 @@ import com.thinkaurelius.titan.core.TitanGraph;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.hadoop.metadata.MetadataException;
 import org.apache.hadoop.metadata.PropertiesUtil;
 
 import javax.inject.Singleton;
@@ -38,7 +39,7 @@ public class TitanGraphProvider implements GraphProvider<TitanGraph>
{
      */
     private static final String METADATA_PREFIX = "metadata.graph.";
 
-    private static Configuration getConfiguration() throws ConfigurationException {
+    private static Configuration getConfiguration() throws MetadataException {
         PropertiesConfiguration configProperties = PropertiesUtil.getApplicationProperties();
 
         Configuration graphConfig = new PropertiesConfiguration();
@@ -62,7 +63,7 @@ public class TitanGraphProvider implements GraphProvider<TitanGraph>
{
         Configuration config;
         try {
             config = getConfiguration();
-        } catch (ConfigurationException e) {
+        } catch (MetadataException e) {
             throw new RuntimeException(e);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e631ed0a/src/bin/metadata-config.sh
----------------------------------------------------------------------
diff --git a/src/bin/metadata-config.sh b/src/bin/metadata-config.sh
index b787e29..f2dcec5 100755
--- a/src/bin/metadata-config.sh
+++ b/src/bin/metadata-config.sh
@@ -99,7 +99,7 @@ mkdir -p $METADATA_LOG_DIR
 
 pushd ${BASEDIR} > /dev/null
 
-JAVA_PROPERTIES="$METADATA_OPTS $METADATA_PROPERTIES -Dmetadata.log.dir=$METADATA_LOG_DIR
-Dmetadata.home=${METADATA_HOME_DIR}"
+JAVA_PROPERTIES="$METADATA_OPTS $METADATA_PROPERTIES -Dmetadata.log.dir=$METADATA_LOG_DIR
-Dmetadata.home=${METADATA_HOME_DIR} -Dmetadata.conf=${METADATA_CONF}"
 shift
 
 while [[ ${1} =~ ^\-D ]]; do


Mime
View raw message