You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2017/02/22 13:01:34 UTC
incubator-atlas git commit: ATLAS-1502 - Fix for not getting atlas
application properties using PropertiesConfiguration sometimes,
so changed to ApplicationProperties
Repository: incubator-atlas
Updated Branches:
refs/heads/master f5f9fa099 -> dbfca6224
ATLAS-1502 - Fix for not getting atlas application properties using PropertiesConfiguration sometimes, so changed to ApplicationProperties
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/dbfca622
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/dbfca622
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/dbfca622
Branch: refs/heads/master
Commit: dbfca6224965574b5c6e9be0ebc846cb0439e944
Parents: f5f9fa0
Author: nixonrodrigues <ni...@freestoneinfotech.com>
Authored: Wed Feb 22 15:36:12 2017 +0530
Committer: kevalbhatt <kb...@apache.org>
Committed: Wed Feb 22 18:30:24 2017 +0530
----------------------------------------------------------------------
release-log.txt | 6 ++++
.../atlas/web/resources/AdminResource.java | 30 ++++++++++++++------
2 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dbfca622/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 29c98cf..14c026a 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,12 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
+ATLAS-1502 - Fix for not getting atlas application properties using PropertiesConfiguration sometimes, so changed to ApplicationProperties (nixonrodrigues via kevalbhatt)
+ATLAS-1586: type search improvement by avoiding unnecessary instantiation of type objects (mneethiraj)
+ATLAS-1583: fix incorrect metrics by import API (ashutoshm via mneethiraj)
+ATLAS-1571: fix for incorrect v1->v2 conversion of enum-type value (mneethiraj)
+ATLAS-1576: fix for NPE while handling unknown attributes (mneethiraj)
+ATLAS-1577: audit event generated for an entity overwrites previous event for the entity (mneethiraj)
ATLAS-1546: Changed to LOG.warn instead error in Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhatt)
ATLAS-1569 Clear contents of RequestContextV1 at the end of the request (mneethiraj)
ATLAS-1570 Fix for Taxonomy service test failures (apoorvnaik via mneethiraj)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dbfca622/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 9f207df..f11d2d1 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -19,8 +19,10 @@
package org.apache.atlas.web.resources;
import com.google.inject.Inject;
+import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasErrorCode;
+import org.apache.atlas.AtlasException;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasExportResult;
@@ -68,6 +70,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
+import org.apache.commons.configuration.Configuration;
import static org.apache.atlas.repository.converters.AtlasInstanceConverter.toAtlasBaseException;
@@ -96,7 +99,7 @@ public class AdminResource {
private static final String isEntityUpdateAllowed = "atlas.entity.update.allowed";
private static final String isEntityCreateAllowed = "atlas.entity.create.allowed";
private static final String editableEntityTypes = "atlas.ui.editable.entity.types";
- private static final String DEFAULT_EDITABLE_ENTITY_TYPES = "hdfs_path,hdfs_path,hbase_table,hbase_column,hbase_column_family,kafka_topic";
+ private static final String DEFAULT_EDITABLE_ENTITY_TYPES = "hdfs_path,hbase_table,hbase_column,hbase_column_family,kafka_topic";
private Response version;
private final ServiceState serviceState;
@@ -104,6 +107,15 @@ public class AdminResource {
private final AtlasTypeRegistry typeRegistry;
private final AtlasTypeDefStore typesDefStore;
private final AtlasEntityStore entityStore;
+ private static Configuration atlasProperties;
+
+ static {
+ try {
+ atlasProperties = ApplicationProperties.get();
+ } catch (Exception e) {
+ LOG.info("Failed to load application properties", e);
+ }
+ }
@Inject
public AdminResource(ServiceState serviceState, MetricsService metricsService,
@@ -225,10 +237,12 @@ public class AdminResource {
}
Response response;
-
+ Boolean enableTaxonomy = false;
try {
- PropertiesConfiguration configProperties = new PropertiesConfiguration("atlas-application.properties");
- Boolean enableTaxonomy = configProperties.getBoolean(isTaxonomyEnabled, false);
+ if(atlasProperties != null) {
+ enableTaxonomy = atlasProperties.getBoolean(isTaxonomyEnabled, false);
+ }
+
boolean isEntityUpdateAccessAllowed = false;
boolean isEntityCreateAccessAllowed = false;
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
@@ -255,12 +269,12 @@ public class AdminResource {
responseData.put(isTaxonomyEnabled, enableTaxonomy);
responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed);
responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed);
- responseData.put(editableEntityTypes, getEditableEntityTypes(configProperties));
+ responseData.put(editableEntityTypes, getEditableEntityTypes(atlasProperties));
responseData.put("userName", userName);
responseData.put("groups", groups);
response = Response.ok(responseData).build();
- } catch (JSONException | ConfigurationException e) {
+ } catch (JSONException e) {
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
@@ -411,10 +425,10 @@ public class AdminResource {
return result;
}
- private String getEditableEntityTypes(PropertiesConfiguration config) {
+ private String getEditableEntityTypes(Configuration config) {
String ret = DEFAULT_EDITABLE_ENTITY_TYPES;
- if (config.containsKey(editableEntityTypes)) {
+ if (config != null && config.containsKey(editableEntityTypes)) {
Object value = config.getProperty(editableEntityTypes);
if (value instanceof String) {