You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ap...@apache.org on 2017/05/23 22:07:10 UTC
[12/12] incubator-atlas git commit: ATLAS-1198: Spring Framework (v4
with Spring security) over Guice
ATLAS-1198: Spring Framework (v4 with Spring security) over Guice
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/35e5828f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/35e5828f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/35e5828f
Branch: refs/heads/master
Commit: 35e5828fb8649d14cfe4b1079237562f31186ad4
Parents: 35c7764
Author: apoorvnaik <an...@hortonworks.com>
Authored: Tue May 23 08:23:23 2017 -0700
Committer: apoorvnaik <an...@hortonworks.com>
Committed: Tue May 23 10:20:20 2017 -0700
----------------------------------------------------------------------
addons/falcon-bridge/pom.xml | 4 -
.../apache/atlas/falcon/hook/FalconHook.java | 8 +-
addons/hive-bridge/pom.xml | 4 -
addons/sqoop-bridge/pom.xml | 4 -
addons/storm-bridge/pom.xml | 27 -
.../atlas/authorize/AtlasAccessRequest.java | 12 +-
catalog/pom.xml | 15 -
.../java/org/apache/atlas/AtlasBaseClient.java | 46 +-
.../main/java/org/apache/atlas/AtlasClient.java | 90 +-
.../java/org/apache/atlas/AtlasClientV2.java | 32 +-
.../atlas/CreateUpdateEntitiesResult.java | 8 +-
.../java/org/apache/atlas/AtlasClientTest.java | 9 +-
common/pom.xml | 10 +-
.../org/apache/atlas/CommonConfiguration.java | 38 +
.../apache/atlas/annotation/AtlasService.java | 33 +
.../annotation/ConditionalOnAtlasProperty.java | 36 +
.../atlas/annotation/GraphTransaction.java | 28 +
.../java/org/apache/atlas/service/Services.java | 35 +-
.../atlas/utils/OnAtlasPropertyCondition.java | 53 +
distro/pom.xml | 3 +
distro/src/conf/atlas-log4j.xml | 15 +
graphdb/titan0/pom.xml | 9 +-
graphdb/titan1/pom.xml | 8 +-
intg/pom.xml | 5 +
.../java/org/apache/atlas/AtlasErrorCode.java | 2 +-
.../apache/atlas/model/legacy/EntityResult.java | 100 ++
.../apache/atlas/type/AtlasTypeRegistry.java | 11 +-
notification/pom.xml | 15 -
.../java/org/apache/atlas/hook/AtlasHook.java | 11 +-
.../apache/atlas/kafka/KafkaNotification.java | 8 +-
.../atlas/kafka/KafkaNotificationProvider.java | 43 -
.../atlas/kafka/NotificationProvider.java | 41 +
.../atlas/notification/NotificationModule.java | 37 -
pom.xml | 160 +--
repository/pom.xml | 70 +-
.../java/org/apache/atlas/GraphTransaction.java | 28 -
.../apache/atlas/GraphTransactionAdvisor.java | 63 +
.../atlas/GraphTransactionInterceptor.java | 16 +-
.../apache/atlas/RepositoryMetadataModule.java | 155 ---
.../atlas/discovery/DataSetLineageService.java | 22 +-
.../atlas/discovery/EntityDiscoveryService.java | 11 +-
.../atlas/discovery/EntityLineageService.java | 10 +-
.../graph/GraphBackedDiscoveryService.java | 29 +-
.../atlas/repository/MetadataRepository.java | 4 +-
.../repository/RepositoryConfiguration.java | 37 +
.../repository/audit/EntityAuditListener.java | 2 +
.../audit/HBaseBasedAuditRepository.java | 6 +-
.../audit/InMemoryEntityAuditRepository.java | 13 +-
.../audit/NoopEntityAuditRepository.java | 11 +-
.../AtlasAbstractFormatConverter.java | 2 +-
.../converters/AtlasEnumFormatConverter.java | 2 +-
.../converters/AtlasFormatConverters.java | 6 +-
.../converters/AtlasInstanceConverter.java | 21 +-
.../converters/AtlasObjectIdConverter.java | 3 +-
.../AtlasPrimitiveFormatConverter.java | 2 +-
.../repository/graph/AtlasGraphProvider.java | 7 +-
.../repository/graph/FullTextMapperV2.java | 20 +-
.../graph/GraphBackedMetadataRepository.java | 53 +-
.../graph/GraphBackedSearchIndexer.java | 2 +
.../graph/GraphSchemaInitializer.java | 2 +
.../graph/GraphToTypedInstanceMapper.java | 35 +-
.../repository/graph/HardDeleteHandler.java | 9 +-
.../repository/graph/SoftDeleteHandler.java | 12 +-
.../graph/TypedInstanceToGraphMapper.java | 50 +-
.../atlas/repository/impexp/ExportService.java | 9 +-
.../bootstrap/AtlasTypeDefStoreInitializer.java | 40 +-
.../store/graph/AtlasEntityStore.java | 6 -
.../store/graph/AtlasTypeDefGraphStore.java | 15 +-
.../graph/v1/AtlasEntityChangeNotifier.java | 21 +-
.../store/graph/v1/AtlasEntityDefStoreV1.java | 2 +-
.../store/graph/v1/AtlasEntityStoreV1.java | 32 +-
.../store/graph/v1/AtlasEntityStream.java | 2 +-
.../graph/v1/AtlasTypeDefGraphStoreV1.java | 16 +-
.../store/graph/v1/EntityGraphMapper.java | 32 +-
.../store/graph/v1/EntityGraphRetriever.java | 10 +-
.../store/graph/v1/HardDeleteHandlerV1.java | 7 +-
.../store/graph/v1/SoftDeleteHandlerV1.java | 9 +-
.../graph/v1/UniqAttrBasedEntityResolver.java | 9 -
.../typestore/GraphBackedTypeStore.java | 16 +-
.../typestore/StoreBackedTypeCache.java | 23 +-
.../atlas/services/DefaultMetadataService.java | 69 +-
.../apache/atlas/services/MetricsService.java | 9 +-
.../util/AtlasRepositoryConfiguration.java | 8 +-
.../org/apache/atlas/BaseRepositoryTest.java | 4 +-
.../atlas/RepositoryServiceLoadingTest.java | 2 +-
.../test/java/org/apache/atlas/TestModules.java | 231 ++++
.../java/org/apache/atlas/TestOnlyModule.java | 30 -
.../test/java/org/apache/atlas/TestUtils.java | 22 +-
.../discovery/DataSetLineageServiceTest.java | 8 +-
.../GraphBackedDiscoveryServiceTest.java | 4 +-
.../atlas/lineage/EntityLineageServiceTest.java | 8 +-
.../AbstractGremlinQueryOptimizerTest.java | 4 +-
...hBackedMetadataRepositoryDeleteTestBase.java | 32 +-
.../GraphBackedMetadataRepositoryTest.java | 8 +-
.../graph/GraphBackedSearchIndexerTest.java | 8 +-
.../atlas/repository/graph/GraphHelperTest.java | 6 +-
.../graph/GraphRepoMapperScaleTest.java | 8 +-
.../ReverseReferenceUpdateHardDeleteTest.java | 12 +-
.../ReverseReferenceUpdateSoftDeleteTest.java | 11 +-
.../graph/ReverseReferenceUpdateTestBase.java | 10 -
.../repository/impexp/ExportServiceTest.java | 34 +-
.../impexp/ImportServiceReportingTest.java | 4 +-
.../repository/impexp/ImportServiceTest.java | 4 +-
.../store/graph/AtlasEntityDefStoreV1Test.java | 8 +-
.../store/graph/AtlasTypeDefGraphStoreTest.java | 11 +-
.../graph/v1/AtlasDeleteHandlerV1Test.java | 13 +-
.../store/graph/v1/AtlasEntityStoreV1Test.java | 8 +-
.../store/graph/v1/HardDeleteHandlerV1Test.java | 9 +-
.../InverseReferenceUpdateHardDeleteV1Test.java | 10 +-
.../InverseReferenceUpdateSoftDeleteV1Test.java | 10 +-
.../graph/v1/InverseReferenceUpdateV1Test.java | 17 +-
.../store/graph/v1/SoftDeleteHandlerV1Test.java | 9 +-
.../typestore/GraphBackedTypeStoreTest.java | 7 +-
.../StoreBackedTypeCacheConfigurationTest.java | 42 -
.../typestore/StoreBackedTypeCacheTest.java | 7 +-
.../StoreBackedTypeCacheTestOnlyModule.java | 44 -
.../service/DefaultMetadataServiceTest.java | 15 +-
...StoreBackedTypeCacheMetadataServiceTest.java | 10 +-
.../services/EntityDiscoveryServiceTest.java | 3 +-
.../org/apache/atlas/query/GremlinTest.scala | 2 +-
.../org/apache/atlas/query/GremlinTest2.scala | 2 +-
.../apache/atlas/query/LineageQueryTest.scala | 2 +-
server-api/pom.xml | 58 -
.../org/apache/atlas/aspect/AtlasAspect.java | 68 --
.../apache/atlas/services/MetadataService.java | 8 +-
.../atlas/typesystem/types/TypeSystem.java | 4 +-
.../typesystem/types/TypeSystemProvider.java | 28 -
.../types/cache/DefaultTypeCache.java | 8 +-
typesystem/src/main/resources/atlas-log4j.xml | 15 +
webapp/pom.xml | 172 +--
.../src/main/java/org/apache/atlas/Atlas.java | 35 +-
.../NotificationEntityChangeListener.java | 4 +-
.../notification/NotificationHookConsumer.java | 6 +-
.../atlas/web/errors/AllExceptionMapper.java | 7 +-
.../web/errors/AtlasBaseExceptionMapper.java | 4 +-
.../web/errors/NotFoundExceptionMapper.java | 4 +-
.../atlas/web/filters/ActiveServerFilter.java | 4 +-
.../filters/AtlasAuthenticationEntryPoint.java | 21 +-
.../web/filters/AtlasAuthenticationFilter.java | 2 +
.../web/filters/AtlasAuthorizationFilter.java | 9 +-
.../web/filters/AtlasCSRFPreventionFilter.java | 32 +-
.../AtlasKnoxSSOAuthenticationFilter.java | 16 +-
.../apache/atlas/web/filters/AuditFilter.java | 8 +-
.../filters/StaleTransactionCleanupFilter.java | 15 +-
.../atlas/web/listeners/GuiceServletConfig.java | 190 ---
.../atlas/web/listeners/LoginProcessor.java | 4 +
.../atlas/web/resources/AdminResource.java | 14 +-
.../web/resources/DataSetLineageResource.java | 9 +-
.../atlas/web/resources/EntityResource.java | 22 +-
.../atlas/web/resources/EntityService.java | 3 +-
.../atlas/web/resources/LineageResource.java | 2 +
.../resources/MetadataDiscoveryResource.java | 2 +
.../atlas/web/resources/TaxonomyService.java | 5 +-
.../atlas/web/resources/TypesResource.java | 15 +-
.../apache/atlas/web/rest/DiscoveryREST.java | 2 +
.../org/apache/atlas/web/rest/EntityREST.java | 11 +-
.../org/apache/atlas/web/rest/LineageREST.java | 2 +
.../org/apache/atlas/web/rest/TypesREST.java | 4 +-
.../security/AtlasADAuthenticationProvider.java | 13 +-
.../AtlasAbstractAuthenticationProvider.java | 14 +-
.../AtlasAuthenticationFailureHandler.java | 9 +-
.../security/AtlasAuthenticationProvider.java | 34 +-
.../AtlasAuthenticationSuccessHandler.java | 9 +-
.../AtlasFileAuthenticationProvider.java | 14 +-
.../atlas/web/security/AtlasSecurityConfig.java | 169 +++
.../service/ActiveInstanceElectorModule.java | 50 -
.../service/ActiveInstanceElectorService.java | 30 +-
.../atlas/web/service/ActiveInstanceState.java | 4 +-
.../atlas/web/service/CuratorFactory.java | 4 +-
.../apache/atlas/web/service/ServiceModule.java | 41 -
.../apache/atlas/web/service/ServiceState.java | 5 +-
.../apache/atlas/web/service/UserService.java | 15 +-
.../org/apache/atlas/web/setup/AtlasSetup.java | 65 --
.../atlas/web/setup/AtlasSetupModule.java | 32 -
.../org/apache/atlas/web/setup/SetupSteps.java | 42 +-
webapp/src/main/resources/spring-security.xml | 45 +-
.../main/webapp/WEB-INF/applicationContext.xml | 9 +-
webapp/src/main/webapp/WEB-INF/web.xml | 53 +-
.../org/apache/atlas/examples/QuickStartIT.java | 2 +-
.../apache/atlas/examples/QuickStartV2IT.java | 3 +-
.../notification/EntityNotificationIT.java | 9 +-
.../NotificationHookConsumerIT.java | 13 +-
.../NotificationHookConsumerKafkaTest.java | 7 +-
.../atlas/web/adapters/TestEntitiesREST.java | 11 +-
.../atlas/web/adapters/TestEntityREST.java | 7 +-
.../web/integration/AdminJerseyResourceIT.java | 49 +
.../atlas/web/integration/BaseResourceIT.java | 669 +++++++++++
.../DataSetLineageJerseyResourceIT.java | 298 +++++
.../EntityDiscoveryJerseyResourceIT.java | 211 ++++
.../web/integration/EntityJerseyResourceIT.java | 1101 ++++++++++++++++++
.../EntityLineageJerseyResourceIT.java | 190 +++
.../integration/EntityV2JerseyResourceIT.java | 769 ++++++++++++
.../MetadataDiscoveryJerseyResourceIT.java | 267 +++++
.../integration/TypedefsJerseyResourceIT.java | 370 ++++++
.../web/integration/TypesJerseyResourceIT.java | 262 +++++
.../web/listeners/TestGuiceServletConfig.java | 82 --
.../apache/atlas/web/listeners/TestModule.java | 34 -
.../web/resources/AdminJerseyResourceIT.java | 49 -
.../atlas/web/resources/AdminResourceTest.java | 4 +-
.../atlas/web/resources/BaseResourceIT.java | 690 -----------
.../DataSetLineageJerseyResourceIT.java | 298 -----
.../EntityDiscoveryJerseyResourceIT.java | 227 ----
.../web/resources/EntityJerseyResourceIT.java | 953 ---------------
.../EntityLineageJerseyResourceIT.java | 190 ---
.../atlas/web/resources/EntityResourceTest.java | 22 +-
.../web/resources/EntityV2JerseyResourceIT.java | 779 -------------
.../MetadataDiscoveryJerseyResourceIT.java | 267 -----
.../web/resources/TypedefsJerseyResourceIT.java | 352 ------
.../web/resources/TypesJerseyResourceIT.java | 262 -----
.../web/security/FileAuthenticationTest.java | 14 +-
.../ActiveInstanceElectorServiceTest.java | 88 +-
.../service/SecureEmbeddedServerTestBase.java | 8 +-
.../apache/atlas/web/setup/SetupStepsTest.java | 31 +-
.../src/test/resources/test-spring-security.xml | 116 ++
webapp/src/test/webapp/WEB-INF/web.xml | 51 +-
215 files changed, 6363 insertions(+), 6539 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/addons/falcon-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/falcon-bridge/pom.xml b/addons/falcon-bridge/pom.xml
index aa55bd6..287b8e9 100644
--- a/addons/falcon-bridge/pom.xml
+++ b/addons/falcon-bridge/pom.xml
@@ -201,10 +201,6 @@
<version>${scala.version}</version>
</artifactItem>
<artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_${scala.binary.version}</artifactId>
<version>${kafka.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
----------------------------------------------------------------------
diff --git a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
index 842b2ce..3b384f8 100644
--- a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
+++ b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java
@@ -19,15 +19,12 @@
package org.apache.atlas.falcon.hook;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
import org.apache.atlas.AtlasConstants;
import org.apache.atlas.falcon.bridge.FalconBridge;
import org.apache.atlas.falcon.event.FalconEvent;
import org.apache.atlas.falcon.publisher.FalconEventPublisher;
import org.apache.atlas.hook.AtlasHook;
-import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
+import org.apache.atlas.kafka.NotificationProvider;
import org.apache.atlas.notification.hook.HookNotification;
import org.apache.atlas.typesystem.Referenceable;
import org.apache.falcon.entity.store.ConfigurationStore;
@@ -112,8 +109,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
STORE = ConfigurationStore.get();
- Injector injector = Guice.createInjector(new NotificationModule());
- notifInterface = injector.getInstance(NotificationInterface.class);
+ notificationInterface = NotificationProvider.get();
} catch (Exception e) {
LOG.error("Caught exception initializing the falcon hook.", e);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/addons/hive-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/pom.xml b/addons/hive-bridge/pom.xml
index c8dee7c..983a04f 100755
--- a/addons/hive-bridge/pom.xml
+++ b/addons/hive-bridge/pom.xml
@@ -249,10 +249,6 @@
<version>${scala.version}</version>
</artifactItem>
<artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_${scala.binary.version}</artifactId>
<version>${kafka.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/addons/sqoop-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/sqoop-bridge/pom.xml b/addons/sqoop-bridge/pom.xml
index 805d40d..d52167b 100644
--- a/addons/sqoop-bridge/pom.xml
+++ b/addons/sqoop-bridge/pom.xml
@@ -261,10 +261,6 @@
<version>${scala.version}</version>
</artifactItem>
<artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_${scala.binary.version}</artifactId>
<version>${kafka.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/addons/storm-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/pom.xml b/addons/storm-bridge/pom.xml
index 527fe32..5fb1be0 100644
--- a/addons/storm-bridge/pom.xml
+++ b/addons/storm-bridge/pom.xml
@@ -35,17 +35,6 @@
</properties>
<dependencies>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
-
<!-- apache atlas core dependencies -->
<dependency>
<groupId>org.apache.atlas</groupId>
@@ -231,22 +220,6 @@
<version>${scala.version}</version>
</artifactItem>
<artifactItem>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-servlet</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-throwingproviders</artifactId>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_${scala.binary.version}</artifactId>
<version>${kafka.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
index 9b405cc..7022081 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAccessRequest.java
@@ -17,15 +17,14 @@
*/
package org.apache.atlas.authorize;
-import java.util.Date;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
import org.apache.atlas.authorize.simple.AtlasAuthorizationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.Set;
+
public class AtlasAccessRequest {
private static Logger LOG = LoggerFactory.getLogger(AtlasAccessRequest.class);
@@ -39,7 +38,8 @@ public class AtlasAccessRequest {
private String clientIPAddress = null;
public AtlasAccessRequest(HttpServletRequest request, String user, Set<String> userGroups) {
- this(AtlasAuthorizationUtils.getAtlasResourceType(request.getServletPath()), "*", AtlasAuthorizationUtils
+ // Spring Security 4 Change => request.getServletPath() -> request.getPathInfo()
+ this(AtlasAuthorizationUtils.getAtlasResourceType(request.getPathInfo()), "*", AtlasAuthorizationUtils
.getAtlasAction(request.getMethod()), user, userGroups,AtlasAuthorizationUtils.getRequestIpAddress(request));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/catalog/pom.xml
----------------------------------------------------------------------
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 5f7bb8e..2828bed 100755
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -114,21 +114,6 @@
</dependency>
<dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-throwingproviders</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
index 3bdddd9..98da51e 100644
--- a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
@@ -17,19 +17,16 @@
*/
package org.apache.atlas;
-import static org.apache.atlas.security.SecurityProperties.TLS_ENABLED;
-
-import java.io.IOException;
-import java.net.ConnectException;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
+import com.google.common.annotations.VisibleForTesting;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientHandlerException;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
import org.apache.atlas.model.metrics.AtlasMetrics;
import org.apache.atlas.security.SecureClientUtils;
import org.apache.atlas.utils.AuthenticationUtil;
@@ -41,16 +38,17 @@ import org.codehaus.jettison.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.annotations.VisibleForTesting;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.atlas.security.SecurityProperties.TLS_ENABLED;
public abstract class AtlasBaseClient {
public static final String BASE_URI = "api/atlas/";
@@ -410,7 +408,7 @@ public abstract class AtlasBaseClient {
for (int i = 0; i < getNumberOfRetries(); i++) {
WebResource resource = resourceCreator.createResource();
try {
- LOG.debug("Using resource {} for {} times", resource.getURI(), i);
+ LOG.debug("Using resource {} for {} times", resource.getURI(), i + 1);
return callAPIWithResource(api, resource, requestObject, JSONObject.class);
} catch (ClientHandlerException che) {
if (i == (getNumberOfRetries() - 1)) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/client/src/main/java/org/apache/atlas/AtlasClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasClient.java b/client/src/main/java/org/apache/atlas/AtlasClient.java
index f503ade..ec482da 100755
--- a/client/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClient.java
@@ -20,9 +20,8 @@ package org.apache.atlas;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSet;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import com.sun.jersey.api.client.WebResource;
+import org.apache.atlas.model.legacy.EntityResult;
import org.apache.atlas.typesystem.Referenceable;
import org.apache.atlas.typesystem.Struct;
import org.apache.atlas.typesystem.TypesDef;
@@ -36,10 +35,6 @@ import org.apache.atlas.typesystem.types.utils.TypesUtil;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.security.UserGroupInformation;
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
@@ -49,18 +44,10 @@ import org.slf4j.LoggerFactory;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* Client for metadata.
@@ -255,76 +242,6 @@ public class AtlasClient extends AtlasBaseClient {
}
}
- @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
- @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
- @JsonIgnoreProperties(ignoreUnknown=true)
- @XmlRootElement
- @XmlAccessorType(XmlAccessType.PROPERTY)
- public static class EntityResult {
- private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
- public static final String OP_CREATED = "created";
- public static final String OP_UPDATED = "updated";
- public static final String OP_DELETED = "deleted";
-
- Map<String, List<String>> entities = new HashMap<>();
-
- public EntityResult() {
- //For gson
- }
-
- public EntityResult(List<String> created, List<String> updated, List<String> deleted) {
- set(OP_CREATED, created);
- set(OP_UPDATED, updated);
- set(OP_DELETED, deleted);
- }
-
- public void set(String type, List<String> list) {
- if (list != null && list.size() > 0) {
- entities.put(type, list);
- }
- }
-
- private List<String> get(String type) {
- List<String> list = entities.get(type);
- if (list == null) {
- list = new ArrayList<>();
- }
- return list;
- }
-
- public Map<String, List<String>> getEntities(){
- return entities;
- }
-
- public void setEntities(Map<String, List<String>> entities){
- this.entities = entities;
- }
-
- @JsonIgnore
- public List<String> getCreatedEntities() {
- return get(OP_CREATED);
- }
-
- @JsonIgnore
- public List<String> getUpdateEntities() {
- return get(OP_UPDATED);
- }
-
-
- @JsonIgnore
- public List<String> getDeletedEntities() {
- return get(OP_DELETED);
- }
-
- @Override
- public String toString() { return gson.toJson(this); }
-
- public static EntityResult fromString(String json) throws AtlasServiceException {
- return gson.fromJson(json, EntityResult.class);
- }
- }
-
/**
* Register the given type(meta model)
* @param typeAsJson type definition a jaon
@@ -470,11 +387,6 @@ public class AtlasClient extends AtlasBaseClient {
JSONObject response = callAPIWithBodyAndParams(API.GET_TYPE, null, typeName);
String typeJson = response.getString(DEFINITION);
return TypesSerialization.fromJson(typeJson);
- } catch (AtlasServiceException e) {
- if (Response.Status.NOT_FOUND.equals(e.getStatus())) {
- return null;
- }
- throw e;
} catch (JSONException e) {
throw new AtlasServiceException(e);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/client/src/main/java/org/apache/atlas/AtlasClientV2.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasClientV2.java b/client/src/main/java/org/apache/atlas/AtlasClientV2.java
index 10638ad..6141342 100644
--- a/client/src/main/java/org/apache/atlas/AtlasClientV2.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClientV2.java
@@ -24,7 +24,6 @@ import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.discovery.AtlasSearchResult;
import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
-import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
import org.apache.atlas.model.instance.EntityMutationResponse;
@@ -55,9 +54,14 @@ public class AtlasClientV2 extends AtlasBaseClient {
// Type APIs
public static final String TYPES_API = BASE_URI + "v2/types/";
private static final String TYPEDEFS_API = TYPES_API + "typedefs/";
+ private static final String TYPEDEF_BY_NAME = TYPES_API + "typedef/name/";
+ private static final String TYPEDEF_BY_GUID = TYPES_API + "typedef/guid/";
+
private static final String GET_BY_NAME_TEMPLATE = TYPES_API + "%s/name/%s";
private static final String GET_BY_GUID_TEMPLATE = TYPES_API + "%s/guid/%s";
+ private static final APIInfo GET_TYPEDEF_BY_NAME = new APIInfo(TYPEDEF_BY_NAME, HttpMethod.GET, Response.Status.OK);
+ private static final APIInfo GET_TYPEDEF_BY_GUID = new APIInfo(TYPEDEF_BY_GUID, HttpMethod.GET, Response.Status.OK);
private static final APIInfo GET_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.GET, Response.Status.OK);
private static final APIInfo CREATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.POST, Response.Status.OK);
private static final APIInfo UPDATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_API, HttpMethod.PUT, Response.Status.OK);
@@ -131,6 +135,24 @@ public class AtlasClientV2 extends AtlasBaseClient {
return callAPI(GET_ALL_TYPE_DEFS, AtlasTypesDef.class, searchFilter.getParams());
}
+ public boolean typeWithGuidExists(String guid) {
+ try {
+ callAPI(GET_TYPEDEF_BY_GUID, String.class, null, guid);
+ } catch (AtlasServiceException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean typeWithNameExists(String name) {
+ try {
+ callAPI(GET_TYPEDEF_BY_NAME, String.class, null, name);
+ } catch (AtlasServiceException e) {
+ return false;
+ }
+ return true;
+ }
+
public AtlasEnumDef getEnumDefByName(final String name) throws AtlasServiceException {
return getTypeDefByName(name, AtlasEnumDef.class);
}
@@ -389,13 +411,13 @@ public class AtlasClientV2 extends AtlasBaseClient {
}
private <T> String getAtlasPath(Class<T> typeDefClass) {
- if (typeDefClass.isAssignableFrom(AtlasEnumDef.class)) {
+ if (AtlasEnumDef.class.isAssignableFrom(typeDefClass)) {
return "enumdef";
- } else if (typeDefClass.isAssignableFrom(AtlasEntityDef.class)) {
+ } else if (AtlasEntityDef.class.isAssignableFrom(typeDefClass)) {
return "entitydef";
- } else if (typeDefClass.isAssignableFrom(AtlasClassificationDef.class)) {
+ } else if (AtlasClassificationDef.class.isAssignableFrom(typeDefClass)) {
return "classificationdef";
- } else if (typeDefClass.isAssignableFrom(AtlasStructDef.class)) {
+ } else if (AtlasStructDef.class.isAssignableFrom(typeDefClass)) {
return "structdef";
}
// Code should never reach this point
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java b/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
index 3f8760f..5e6d6db 100644
--- a/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
+++ b/client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
@@ -17,13 +17,13 @@
*/
package org.apache.atlas;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.atlas.AtlasClient.EntityResult;
import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.model.legacy.EntityResult;
import org.apache.atlas.type.AtlasType;
+import java.util.Collections;
+import java.util.List;
+
/**
* Result from creating or updating entities.
*/
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/client/src/test/java/org/apache/atlas/AtlasClientTest.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/atlas/AtlasClientTest.java b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
index 56c4ae6..0c78916 100644
--- a/client/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -21,7 +21,7 @@ import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
-
+import org.apache.atlas.model.legacy.EntityResult;
import org.apache.atlas.typesystem.Referenceable;
import org.apache.atlas.typesystem.json.InstanceSerialization;
import org.apache.commons.configuration.Configuration;
@@ -33,15 +33,14 @@ import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
import java.net.ConnectException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.anyString;
@@ -94,7 +93,7 @@ public class AtlasClientTest {
ClientResponse response = mock(ClientResponse.class);
when(response.getStatus()).thenReturn(Response.Status.CREATED.getStatusCode());
- JSONObject jsonResponse = new JSONObject(new AtlasClient.EntityResult(Arrays.asList("id"), null, null).toString());
+ JSONObject jsonResponse = new JSONObject(new EntityResult(Arrays.asList("id"), null, null).toString());
when(response.getEntity(String.class)).thenReturn(jsonResponse.toString());
when(response.getLength()).thenReturn(jsonResponse.length());
String entityJson = InstanceSerialization.toJson(new Referenceable("type"), true);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index 48df41f..bcbb5c5 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -36,8 +36,8 @@
</dependency>
<dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
</dependency>
<dependency>
@@ -65,6 +65,12 @@
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>com.google.guava</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/CommonConfiguration.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/CommonConfiguration.java b/common/src/main/java/org/apache/atlas/CommonConfiguration.java
new file mode 100644
index 0000000..8ef9f8b
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/CommonConfiguration.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class CommonConfiguration {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommonConfiguration.class);
+
+ @Bean
+ public org.apache.commons.configuration.Configuration getAtlasConfig() throws AtlasException {
+ try {
+ return ApplicationProperties.get();
+ } catch (AtlasException e) {
+ LOGGER.warn("AtlasConfig init failed", e);
+ throw e;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/annotation/AtlasService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/annotation/AtlasService.java b/common/src/main/java/org/apache/atlas/annotation/AtlasService.java
new file mode 100644
index 0000000..fe34027
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/annotation/AtlasService.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.annotation;
+
+import org.springframework.stereotype.Service;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Service
+@Inherited
+public @interface AtlasService {
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java b/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java
new file mode 100644
index 0000000..427e3a8
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/annotation/ConditionalOnAtlasProperty.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.annotation;
+
+import org.apache.atlas.utils.OnAtlasPropertyCondition;
+import org.springframework.context.annotation.Conditional;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Conditional(OnAtlasPropertyCondition.class)
+public @interface ConditionalOnAtlasProperty {
+ // Configured atlas property
+ String property();
+ // The default interface implementation should declare this as true
+ boolean isDefault() default false;
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java b/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
new file mode 100644
index 0000000..7120166
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/annotation/GraphTransaction.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.atlas.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface GraphTransaction {
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/service/Services.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/service/Services.java b/common/src/main/java/org/apache/atlas/service/Services.java
index 588dd8e..6f880e4 100644
--- a/common/src/main/java/org/apache/atlas/service/Services.java
+++ b/common/src/main/java/org/apache/atlas/service/Services.java
@@ -17,38 +17,49 @@
*/
package org.apache.atlas.service;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import org.apache.atlas.annotation.AtlasService;
+import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Profile;
-import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import java.util.List;
/**
* Utility for starting and stopping all services.
*/
-@Singleton
+@AtlasService
+@Profile("!test")
public class Services {
public static final Logger LOG = LoggerFactory.getLogger(Services.class);
- private final Set<Service> services;
+ private final List<Service> services;
+ private final Configuration configuration;
@Inject
- public Services(Set<Service> services) {
+ public Services(List<Service> services, Configuration configuration) {
this.services = services;
+ this.configuration = configuration;
}
+ @PostConstruct
public void start() {
- try {
- for (Service service : services) {
- LOG.info("Starting service {}", service.getClass().getName());
- service.start();
+ if (configuration.getBoolean("atlas.services.enabled", true)) {
+ try {
+ for (Service service : services) {
+ LOG.info("Starting service {}", service.getClass().getName());
+ service.start();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
- } catch (Exception e) {
- throw new RuntimeException(e);
}
}
+ @PreDestroy
public void stop() {
for (Service service : services) {
LOG.info("Stopping service {}", service.getClass().getName());
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java
new file mode 100644
index 0000000..ece6e37
--- /dev/null
+++ b/common/src/main/java/org/apache/atlas/utils/OnAtlasPropertyCondition.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.utils;
+
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.annotation.ConditionalOnAtlasProperty;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Condition;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+import org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor;
+
+public class OnAtlasPropertyCondition implements Condition {
+ private final Logger LOG = LoggerFactory.getLogger(OnAtlasPropertyCondition.class);
+
+ @Override
+ public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
+ boolean matches = false;
+ String propertyName = (String) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("property");
+ boolean isDefault = (Boolean) metadata.getAnnotationAttributes(ConditionalOnAtlasProperty.class.getName()).get("isDefault");
+ String className = ((AnnotationMetadataReadingVisitor) metadata).getClassName();
+
+ try {
+ Configuration configuration = ApplicationProperties.get();
+ String configuredProperty = configuration.getString(propertyName);
+ if (StringUtils.isNotEmpty(configuredProperty)) {
+ matches = configuredProperty.equals(className);
+ } else if (isDefault) matches = true;
+ } catch (AtlasException e) {
+ LOG.error("Unable to load atlas properties. Dependent bean configuration may fail");
+ }
+ return matches;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/distro/pom.xml
----------------------------------------------------------------------
diff --git a/distro/pom.xml b/distro/pom.xml
index f0962b6..3ffaee9 100644
--- a/distro/pom.xml
+++ b/distro/pom.xml
@@ -126,6 +126,9 @@ atlas.graph.index.search.solr.zookeeper-session-timeout=60000
<titan.storage.backend>berkeleyje</titan.storage.backend>
<titan.storage.properties>#Berkeley
atlas.graph.storage.directory=${sys:atlas.home}/data/berkley
+atlas.graph.storage.lock.clean-expired=true
+atlas.graph.storage.lock.expiry-time=500
+atlas.graph.storage.lock.wait-time=300
</titan.storage.properties>
<titan.index.backend>elasticsearch</titan.index.backend>
<titan.index.properties>#ElasticSearch
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/distro/src/conf/atlas-log4j.xml
----------------------------------------------------------------------
diff --git a/distro/src/conf/atlas-log4j.xml b/distro/src/conf/atlas-log4j.xml
index a79b722..e6c0d9f 100755
--- a/distro/src/conf/atlas-log4j.xml
+++ b/distro/src/conf/atlas-log4j.xml
@@ -69,6 +69,21 @@
<appender-ref ref="FILE"/>
</logger>
+ <logger name="org.springframework" additivity="false">
+ <level value="warn"/>
+ <appender-ref ref="console"/>
+ </logger>
+
+ <logger name="org.eclipse" additivity="false">
+ <level value="warn"/>
+ <appender-ref ref="console"/>
+ </logger>
+
+ <logger name="com.sun.jersey" additivity="false">
+ <level value="warn"/>
+ <appender-ref ref="console"/>
+ </logger>
+
<!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config -->
<logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false">
<level value="error"/>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/graphdb/titan0/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/titan0/pom.xml b/graphdb/titan0/pom.xml
index 71f2832..ceda1bb 100644
--- a/graphdb/titan0/pom.xml
+++ b/graphdb/titan0/pom.xml
@@ -51,7 +51,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
- <skip>false</skip>
+ <skip>${skipUTs}</skip>
</configuration>
</plugin>
</plugins>
@@ -81,13 +81,6 @@
<version>${guava.version}</version>
</dependency>
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/graphdb/titan1/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/titan1/pom.xml b/graphdb/titan1/pom.xml
index 5611193..fc0b2f6 100644
--- a/graphdb/titan1/pom.xml
+++ b/graphdb/titan1/pom.xml
@@ -71,7 +71,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
- <skip>false</skip>
+ <skip>${skipUTs}</skip>
</configuration>
</plugin>
<plugin>
@@ -106,12 +106,6 @@
</dependency>
<dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<scope>provided</scope>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/intg/pom.xml
----------------------------------------------------------------------
diff --git a/intg/pom.xml b/intg/pom.xml
index 7f3ab12..2a06ea9 100644
--- a/intg/pom.xml
+++ b/intg/pom.xml
@@ -67,6 +67,11 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index 298df6b..d723b2a 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -96,7 +96,7 @@ public enum AtlasErrorCode {
DISCOVERY_QUERY_FAILED(500, "ATLAS-500-00-004", "Discovery query failed {0}"),
FAILED_TO_OBTAIN_TYPE_UPDATE_LOCK(500, "ATLAS-500-00-005", "Failed to get the lock; another type update might be in progress. Please try again"),
FAILED_TO_OBTAIN_IMPORT_EXPORT_LOCK(500, "ATLAS-500-00-006", "Another import or export is in progress. Please try again"),
- NOTIFICATION_FAILED(500, "ATLAS-500-00-007", "Failed to notify for change {0}"),
+ NOTIFICATION_FAILED(500, "ATLAS-500-00-007", "Failed to notify {0} for change {1}"),
FAILED_TO_OBTAIN_GREMLIN_SCRIPT_ENGINE(500, "ATLAS-500-00-008", "Failed to obtain gremlin script engine: {0}"),
JSON_ERROR_OBJECT_MAPPER_NULL_RETURNED(500, "ATLAS-500-00-009", "ObjectMapper.readValue returned NULL for class: {0}"),
GREMLIN_SCRIPT_EXECUTION_FAILED(500, "ATLAS-500-00-00A", "Gremlin script execution failed: {0}"),
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java b/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java
new file mode 100644
index 0000000..e6cef97
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/legacy/EntityResult.java
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.model.legacy;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class EntityResult {
+ private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
+ public static final String OP_CREATED = "created";
+ public static final String OP_UPDATED = "updated";
+ public static final String OP_DELETED = "deleted";
+
+ Map<String, List<String>> entities = new HashMap<>();
+
+ public EntityResult() {
+ //For gson
+ }
+
+ public EntityResult(List<String> created, List<String> updated, List<String> deleted) {
+ set(OP_CREATED, created);
+ set(OP_UPDATED, updated);
+ set(OP_DELETED, deleted);
+ }
+
+ public void set(String type, List<String> list) {
+ if (list != null && list.size() > 0) {
+ entities.put(type, list);
+ }
+ }
+
+ private List<String> get(String type) {
+ List<String> list = entities.get(type);
+ if (list == null) {
+ list = new ArrayList<>();
+ }
+ return list;
+ }
+
+ public Map<String, List<String>> getEntities(){
+ return entities;
+ }
+
+ public void setEntities(Map<String, List<String>> entities){
+ this.entities = entities;
+ }
+
+ @JsonIgnore
+ public List<String> getCreatedEntities() {
+ return get(OP_CREATED);
+ }
+
+ @JsonIgnore
+ public List<String> getUpdateEntities() {
+ return get(OP_UPDATED);
+ }
+
+ @JsonIgnore
+ public List<String> getDeletedEntities() {
+ return get(OP_DELETED);
+ }
+
+ @Override
+ public String toString() { return gson.toJson(this); }
+
+ public static EntityResult fromString(String json) {
+ return gson.fromJson(json, EntityResult.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index 29ea603..1b3526b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -17,8 +17,6 @@
*/
package org.apache.atlas.type;
-import com.sun.jersey.spi.resource.Singleton;
-
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
@@ -31,7 +29,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -41,16 +41,13 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_PREFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_KEY_VAL_SEP;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_PREFIX;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUFFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.*;
/**
* registry for all types defined in Atlas.
*/
@Singleton
+@Component
public class AtlasTypeRegistry {
private static final Logger LOG = LoggerFactory.getLogger(AtlasStructType.class);
private static final int DEFAULT_LOCK_MAX_WAIT_TIME_IN_SECONDS = 15;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/pom.xml
----------------------------------------------------------------------
diff --git a/notification/pom.xml b/notification/pom.xml
index c4a1115..daa5d11 100644
--- a/notification/pom.xml
+++ b/notification/pom.xml
@@ -61,21 +61,6 @@
</dependency>
<dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
index 65b88e9..a8609e6 100644
--- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
+++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
@@ -19,12 +19,10 @@
package org.apache.atlas.hook;
import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.kafka.NotificationProvider;
import org.apache.atlas.notification.NotificationException;
import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.NotificationModule;
import org.apache.atlas.notification.hook.HookNotification;
import org.apache.atlas.security.InMemoryJAASConfiguration;
import org.apache.atlas.typesystem.Referenceable;
@@ -51,7 +49,7 @@ public abstract class AtlasHook {
protected static Configuration atlasProperties;
- protected static NotificationInterface notifInterface;
+ protected static NotificationInterface notificationInterface;
private static boolean logFailedMessages;
private static FailedMessagesLogger failedMessagesLogger;
@@ -86,8 +84,7 @@ public abstract class AtlasHook {
}
notificationRetryInterval = atlasProperties.getInt(ATLAS_NOTIFICATION_RETRY_INTERVAL, 1000);
- Injector injector = Guice.createInjector(new NotificationModule());
- notifInterface = injector.getInstance(NotificationInterface.class);
+ notificationInterface = NotificationProvider.get();
LOG.info("Created Atlas Hook");
}
@@ -118,7 +115,7 @@ public abstract class AtlasHook {
* @param maxRetries maximum number of retries while sending message to messaging system
*/
public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
- notifyEntitiesInternal(messages, maxRetries, notifInterface, logFailedMessages, failedMessagesLogger);
+ notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
}
@VisibleForTesting
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
index 77c1711..8bd31fd 100644
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
+++ b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
@@ -18,7 +18,6 @@
package org.apache.atlas.kafka;
import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Singleton;
import kafka.consumer.Consumer;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
@@ -46,8 +45,11 @@ import org.apache.zookeeper.server.ServerCnxnFactory;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
import scala.Option;
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
@@ -64,7 +66,8 @@ import java.util.concurrent.Future;
/**
* Kafka specific access point to the Atlas notification framework.
*/
-@Singleton
+@Component
+@Order(3)
public class KafkaNotification extends AbstractNotification implements Service {
public static final Logger LOG = LoggerFactory.getLogger(KafkaNotification.class);
@@ -105,6 +108,7 @@ public class KafkaNotification extends AbstractNotification implements Service {
*
* @throws AtlasException if the notification interface can not be created
*/
+ @Inject
public KafkaNotification(Configuration applicationProperties) throws AtlasException {
super(applicationProperties);
Configuration subsetConfiguration =
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java
deleted file mode 100644
index fd0e518..0000000
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotificationProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.kafka;
-
-import com.google.inject.Provider;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasException;
-import org.apache.commons.configuration.Configuration;
-
-/**
- * Provider class that provides KafkaNotification for Guice.
- */
-public class KafkaNotificationProvider implements Provider<KafkaNotification> {
-
- @Override
- @Provides
- @Singleton
- public KafkaNotification get() {
- try {
- Configuration applicationProperties = ApplicationProperties.get();
- return new KafkaNotification(applicationProperties);
- } catch(AtlasException e) {
- throw new RuntimeException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
new file mode 100644
index 0000000..2dd970e
--- /dev/null
+++ b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.kafka;
+
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.commons.configuration.Configuration;
+
+/**
+ * Provider class for Notification interfaces
+ */
+public class NotificationProvider {
+ private static KafkaNotification kafka;
+
+ public static KafkaNotification get() {
+ if (kafka == null) {
+ try {
+ Configuration applicationProperties = ApplicationProperties.get();
+ kafka = new KafkaNotification(applicationProperties);
+ } catch (AtlasException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return kafka;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java b/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java
deleted file mode 100644
index 44d08d3..0000000
--- a/notification/src/main/java/org/apache/atlas/notification/NotificationModule.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.notification;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import org.apache.atlas.kafka.KafkaNotification;
-import org.apache.atlas.kafka.KafkaNotificationProvider;
-
-/**
- * Notification module for Guice.
- *
- * NOTE: This module is loaded by hook clients like hive hook etc. Don't add any server specific bindings here.
- */
-public class NotificationModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(NotificationInterface.class).to(KafkaNotification.class).in(Singleton.class);
- bind(KafkaNotification.class).toProvider(KafkaNotificationProvider.class).in(Singleton.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cc8c94f..a93b8ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -496,9 +496,9 @@
<gson.version>2.5</gson.version>
<fastutil.version>6.5.16</fastutil.version>
<guice.version>4.1.0</guice.version>
- <spring.version>3.1.3.RELEASE</spring.version>
- <spring.security.version>3.1.3.RELEASE</spring.security.version>
- <spring-ldap-core.version>1.3.1.RELEASE</spring-ldap-core.version>
+ <spring.version>4.3.8.RELEASE</spring.version>
+ <spring.security.version>4.2.2.RELEASE</spring.security.version>
+ <spring-ldap-core.version>2.3.1.RELEASE</spring-ldap-core.version>
<javax.servlet.version>3.1.0</javax.servlet.version>
<guava.version>19.0</guava.version>
@@ -535,21 +535,9 @@
<atlas.surefire.options></atlas.surefire.options>
<aspectj.runtime.version>1.8.7</aspectj.runtime.version>
- <aspectj.skip>true</aspectj.skip>
</properties>
<profiles>
- <!-- Turn on this profile to instrument atlas server to collect performance metrics -->
- <profile>
- <id>perf</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <aspectj.skip>false</aspectj.skip>
- </properties>
- </profile>
-
<!-- Turning on this profile affects only tests and does not affect packaging -->
<profile>
<id>distributed</id>
@@ -687,18 +675,6 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
- <!-- AOP dependencies. -->
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectj.runtime.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjtools</artifactId>
- <version>${aspectj.runtime.version}</version>
- </dependency>
-
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
@@ -916,43 +892,13 @@
<version>${commons-collections.version}</version>
</dependency>
- <!-- utilities -->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <version>${guice.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-throwingproviders</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-servlet</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
+ <!--Javax inject-->
<dependency>
- <groupId>com.sun.jersey.contribs</groupId>
- <artifactId>jersey-guice</artifactId>
- <version>1.18.3</version>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>${javax-inject.version}</version>
</dependency>
-
+ <!-- utilities -->
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
@@ -998,6 +944,12 @@
</dependency>
<dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
@@ -1104,6 +1056,12 @@
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
+ <artifactId>titan-lucene</artifactId>
+ <version>${titan.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-hbase</artifactId>
<version>${titan.version}</version>
</dependency>
@@ -1203,6 +1161,73 @@
<version>${solr.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>${javax.servlet.version}</version>
+ </dependency>
+
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ <version>${spring.security.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-web</artifactId>
+ <version>${spring.security.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-config</artifactId>
+ <version>${spring.security.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-ldap</artifactId>
+ <version>${spring.security.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.ldap</groupId>
+ <artifactId>spring-ldap-core</artifactId>
+ <version>${spring-ldap-core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
<!-- atlas modules -->
<dependency>
<groupId>org.apache.atlas</groupId>
@@ -1603,6 +1628,11 @@
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.2.2</version>
+ </dependency>
</dependencies>
<build>
@@ -1747,12 +1777,6 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>aspectj-maven-plugin</artifactId>
- <version>1.8</version>
- </plugin>
-
- <plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>2.8.0</version>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/repository/pom.xml
----------------------------------------------------------------------
diff --git a/repository/pom.xml b/repository/pom.xml
index 54c779f..2573198 100755
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -76,21 +76,6 @@
</dependency>
<dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-throwingproviders</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</dependency>
@@ -168,6 +153,20 @@
<artifactId>atlas-hbase-server-shaded</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ <version>4.1.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -235,47 +234,6 @@
</properties>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>aspectj-maven-plugin</artifactId>
- <configuration>
- <complianceLevel>1.7</complianceLevel>
- <includes>
- <include>**/*.java</include>
- <include>**/*.aj</include>
- </includes>
- <XaddSerialVersionUID>true</XaddSerialVersionUID>
- <showWeaveInfo>true</showWeaveInfo>
- <aspectLibraries>
- <aspectLibrary>
- <groupId>org.apache.atlas</groupId>
- <artifactId>atlas-server-api</artifactId>
- </aspectLibrary>
- </aspectLibraries>
- </configuration>
- <executions>
- <execution>
- <id>compile_with_aspectj</id>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjtools</artifactId>
- <version>${aspectj.runtime.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.atlas</groupId>
- <artifactId>atlas-server-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
</plugins>
</build>
</project>