You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/11/12 18:14:50 UTC
[41/42] atlas git commit: ATLAS-2251: Remove TypeSystem and related
implementation, to avoid unncessary duplicate of type details in cache
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
index f7404ae..773a1e8 100755
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
@@ -19,18 +19,16 @@
package org.apache.atlas.hive.hook;
import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
import com.sun.jersey.api.client.ClientResponse;
import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.hive.HiveITBase;
import org.apache.atlas.hive.bridge.HiveMetaStoreBridge;
import org.apache.atlas.hive.model.HiveDataTypes;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.commons.lang.RandomStringUtils;
+import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.v1.model.instance.Id;
+import org.apache.atlas.v1.model.instance.Struct;
+import org.apache.atlas.v1.model.instance.Referenceable;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.metastore.TableType;
@@ -182,7 +180,7 @@ public class HiveHookIT extends HiveITBase {
private void verifyTimestamps(Referenceable ref, String property, long expectedTime) throws ParseException {
//Verify timestamps.
String createTimeStr = (String) ref.get(property);
- Date createDate = TypeSystem.getInstance().getDateFormat().parse(createTimeStr);
+ Date createDate = AtlasBaseTypeDef.DATE_FORMATTER.parse(createTimeStr);
Assert.assertNotNull(createTimeStr);
if (expectedTime > 0) {
@@ -1262,7 +1260,7 @@ public class HiveHookIT extends HiveITBase {
String guid2 = assertColumnIsRegistered(HiveMetaStoreBridge.getColumnQualifiedName(tbqn, "id_new"));
assertEquals(guid2, guid);
- assertTrue(atlasClient.getEntity(guid2).getTraits().contains(trait));
+ assertTrue(atlasClient.getEntity(guid2).getTraitNames().contains(trait));
}
@Test
@@ -1349,15 +1347,15 @@ public class HiveHookIT extends HiveITBase {
@Test
public void testAlterTableBucketingClusterSort() throws Exception {
String tableName = createTable();
- ImmutableList<String> cols = ImmutableList.of("id");
+ List<String> cols = Collections.singletonList("id");
runBucketSortQuery(tableName, 5, cols, cols);
- cols = ImmutableList.of("id", NAME);
+ cols = Arrays.asList("id", NAME);
runBucketSortQuery(tableName, 2, cols, cols);
}
- private void runBucketSortQuery(String tableName, final int numBuckets, final ImmutableList<String> bucketCols,
- final ImmutableList<String> sortCols) throws Exception {
+ private void runBucketSortQuery(String tableName, final int numBuckets, final List<String> bucketCols,
+ final List<String> sortCols) throws Exception {
final String fmtQuery = "alter table %s CLUSTERED BY (%s) SORTED BY (%s) INTO %s BUCKETS";
String query = String.format(fmtQuery, tableName, stripListBrackets(bucketCols.toString()),
stripListBrackets(sortCols.toString()), numBuckets);
@@ -1375,8 +1373,8 @@ public class HiveHookIT extends HiveITBase {
}
private void verifyBucketSortingProperties(Referenceable tableRef, int numBuckets,
- ImmutableList<String> bucketColNames,
- ImmutableList<String> sortcolNames) throws Exception {
+ List<String> bucketColNames,
+ List<String> sortcolNames) throws Exception {
Referenceable sdRef = (Referenceable) tableRef.get(HiveMetaStoreBridge.STORAGE_DESC);
Assert.assertEquals(((scala.math.BigInt) sdRef.get(HiveMetaStoreBridge.STORAGE_NUM_BUCKETS)).intValue(),
numBuckets);
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/sqoop-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/sqoop-bridge/pom.xml b/addons/sqoop-bridge/pom.xml
index d46d8a9..5a9305e 100644
--- a/addons/sqoop-bridge/pom.xml
+++ b/addons/sqoop-bridge/pom.xml
@@ -94,11 +94,6 @@
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- </dependency>
-
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v1</artifactId>
@@ -155,13 +150,6 @@
<type>pom</type>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
@@ -206,21 +194,6 @@
<version>${project.version}</version>
</artifactItem>
<artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-native_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-core_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-ast_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>atlas-client-common</artifactId>
<version>${project.version}</version>
@@ -237,11 +210,6 @@
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
- <artifactId>atlas-typesystem</artifactId>
- <version>${project.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>${project.groupId}</groupId>
<artifactId>atlas-intg</artifactId>
<version>${project.version}</version>
</artifactItem>
@@ -256,28 +224,8 @@
<version>${project.version}</version>
</artifactItem>
<artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-compiler</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-reflect</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scalap</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
- <artifactId>kafka_${scala.binary.version}</artifactId>
+ <artifactId>kafka_${kafka.scala.binary.version}</artifactId>
<version>${kafka.version}</version>
</artifactItem>
<artifactItem>
@@ -285,11 +233,6 @@
<artifactId>kafka-clients</artifactId>
<version>${kafka.version}</version>
</artifactItem>
- <artifactItem>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- </artifactItem>
</artifactItems>
</configuration>
</execution>
@@ -363,7 +306,7 @@
</systemProperty>
<systemProperty>
<key>atlas.conf</key>
- <value>${project.build.directory}/../../../typesystem/target/test-classes</value>
+ <value>${project.build.directory}/../../../intg/target/test-classes</value>
</systemProperty>
<systemProperty>
<key>atlas.home</key>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
----------------------------------------------------------------------
diff --git a/addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java b/addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
index 50e20fa..5ded92c 100644
--- a/addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
+++ b/addons/sqoop-bridge/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java
@@ -26,9 +26,10 @@ import org.apache.atlas.hive.bridge.HiveMetaStoreBridge;
import org.apache.atlas.hive.model.HiveDataTypes;
import org.apache.atlas.hook.AtlasHook;
import org.apache.atlas.hook.AtlasHookException;
-import org.apache.atlas.notification.hook.HookNotification;
+import org.apache.atlas.model.notification.HookNotification;
+import org.apache.atlas.v1.model.instance.Referenceable;
+import org.apache.atlas.v1.model.notification.HookNotificationV1.EntityCreateRequest;
import org.apache.atlas.sqoop.model.SqoopDataTypes;
-import org.apache.atlas.typesystem.Referenceable;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang3.StringUtils;
import org.apache.sqoop.SqoopJobDataPublisher;
@@ -185,8 +186,8 @@ public class SqoopHook extends SqoopJobDataPublisher {
Referenceable procRef = createSqoopProcessInstance(dbStoreRef, hiveTableRef, data, clusterName);
int maxRetries = atlasProperties.getInt(HOOK_NUM_RETRIES, 3);
- HookNotification.HookNotificationMessage message =
- new HookNotification.EntityCreateRequest(AtlasHook.getUser(), dbStoreRef, dbRef, hiveTableRef, procRef);
+ HookNotification message =
+ new EntityCreateRequest(AtlasHook.getUser(), dbStoreRef, dbRef, hiveTableRef, procRef);
AtlasHook.notifyEntities(Arrays.asList(message), maxRetries);
}
catch(Exception e) {
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/storm-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/pom.xml b/addons/storm-bridge/pom.xml
index 16104ca..e57c021 100644
--- a/addons/storm-bridge/pom.xml
+++ b/addons/storm-bridge/pom.xml
@@ -38,11 +38,6 @@
<!-- apache atlas core dependencies -->
<dependency>
<groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-v1</artifactId>
</dependency>
@@ -124,13 +119,6 @@
<type>war</type>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
@@ -160,21 +148,6 @@
<version>${project.version}</version>
</artifactItem>
<artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-native_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-core_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.json4s</groupId>
- <artifactId>json4s-ast_${scala.binary.version}</artifactId>
- <version>${json.version}</version>
- </artifactItem>
- <artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>atlas-client-common</artifactId>
<version>${project.version}</version>
@@ -191,11 +164,6 @@
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
- <artifactId>atlas-typesystem</artifactId>
- <version>${project.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>${project.groupId}</groupId>
<artifactId>hive-bridge</artifactId>
<version>${project.version}</version>
</artifactItem>
@@ -220,28 +188,8 @@
<version>${project.version}</version>
</artifactItem>
<artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-compiler</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-reflect</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>org.scala-lang</groupId>
- <artifactId>scalap</artifactId>
- <version>${scala.version}</version>
- </artifactItem>
- <artifactItem>
<groupId>org.apache.kafka</groupId>
- <artifactId>kafka_${scala.binary.version}</artifactId>
+ <artifactId>kafka_${kafka.scala.binary.version}</artifactId>
<version>${kafka.version}</version>
</artifactItem>
<artifactItem>
@@ -300,11 +248,6 @@
<version>${hadoop.version}</version>
</artifactItem>
<artifactItem>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- </artifactItem>
- <artifactItem>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
@@ -347,60 +290,6 @@
<build>
<plugins>
<plugin>
- <groupId>net.alchim31.maven</groupId>
- <artifactId>scala-maven-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>scala-compile-first</id>
- <phase>process-resources</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>scala-test-compile-first</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <scalaVersion>${scala.version}</scalaVersion>
- <recompileMode>incremental</recompileMode>
- <useZincServer>true</useZincServer>
- <source>1.7</source>
- <target>1.7</target>
- <args>
- <arg>-unchecked</arg>
- <arg>-deprecation</arg>
- <arg>-feature</arg>
- </args>
- <jvmArgs>
- <jvmArg>-Xmx512m</jvmArg>
- </jvmArgs>
- <!--
- <javacArgs>
- <javacArg>-source</javacArg>
- <javacArg>${java.version}</javacArg>
- <javacArg>-target</javacArg>
- <javacArg>${java.version}</javacArg>
- </javacArgs>
- -->
- <!-- The following plugin is required to use quasiquotes in Scala 2.10 and is used
- by Spark SQL for code generation. -->
- <!--<compilerPlugins>
- <compilerPlugin>
- <groupId>org.scalamacros</groupId>
- <artifactId>paradise_${scala.version}</artifactId>
- <version>${scala.macros.version}</version>
- </compilerPlugin>
- </compilerPlugins>-->
- </configuration>
- </plugin>
-
- <plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
@@ -437,7 +326,7 @@
</systemProperty>
<systemProperty>
<key>atlas.conf</key>
- <value>${project.build.directory}/../../../typesystem/target/test-classes</value>
+ <value>${project.build.directory}/../../../intg/target/test-classes</value>
</systemProperty>
<systemProperty>
<key>atlas.home</key>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java b/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
index c3df8fc..57fc7a1 100644
--- a/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
+++ b/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java
@@ -18,6 +18,7 @@
package org.apache.atlas.storm.hook;
+import org.apache.atlas.v1.model.instance.Referenceable;
import org.apache.storm.ISubmitterHook;
import org.apache.storm.generated.Bolt;
import org.apache.storm.generated.SpoutSpec;
@@ -29,7 +30,6 @@ import org.apache.atlas.AtlasConstants;
import org.apache.atlas.hive.bridge.HiveMetaStoreBridge;
import org.apache.atlas.hook.AtlasHook;
import org.apache.atlas.storm.model.StormDataTypes;
-import org.apache.atlas.typesystem.Referenceable;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/addons/storm-bridge/src/test/java/org/apache/atlas/storm/hook/StormAtlasHookIT.java
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/src/test/java/org/apache/atlas/storm/hook/StormAtlasHookIT.java b/addons/storm-bridge/src/test/java/org/apache/atlas/storm/hook/StormAtlasHookIT.java
index e0800b8..5fef38d 100644
--- a/addons/storm-bridge/src/test/java/org/apache/atlas/storm/hook/StormAtlasHookIT.java
+++ b/addons/storm-bridge/src/test/java/org/apache/atlas/storm/hook/StormAtlasHookIT.java
@@ -21,8 +21,8 @@ package org.apache.atlas.storm.hook;
import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasClient;
import org.apache.atlas.hive.bridge.HiveMetaStoreBridge;
+import org.apache.atlas.v1.model.instance.Referenceable;
import org.apache.atlas.storm.model.StormDataTypes;
-import org.apache.atlas.typesystem.Referenceable;
import org.apache.atlas.utils.AuthenticationUtil;
import org.apache.commons.configuration.Configuration;
import org.apache.storm.ILocalCluster;
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/authorization/pom.xml
----------------------------------------------------------------------
diff --git a/authorization/pom.xml b/authorization/pom.xml
index 143c4e4..f210a2f 100644
--- a/authorization/pom.xml
+++ b/authorization/pom.xml
@@ -42,8 +42,15 @@
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/client-v1/pom.xml
----------------------------------------------------------------------
diff --git a/client/client-v1/pom.xml b/client/client-v1/pom.xml
index 2b492bb..e25a308 100644
--- a/client/client-v1/pom.xml
+++ b/client/client-v1/pom.xml
@@ -31,18 +31,13 @@
<dependencies>
<dependency>
<groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.atlas</groupId>
<artifactId>atlas-client-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
- <classifier>tests</classifier>
- <scope>test</scope>
+ <artifactId>atlas-common</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/client-v1/src/main/java/org/apache/atlas/AtlasClient.java
----------------------------------------------------------------------
diff --git a/client/client-v1/src/main/java/org/apache/atlas/AtlasClient.java b/client/client-v1/src/main/java/org/apache/atlas/AtlasClient.java
index 8bbc89b..bcdec71 100644
--- a/client/client-v1/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/client-v1/src/main/java/org/apache/atlas/AtlasClient.java
@@ -19,19 +19,16 @@
package org.apache.atlas;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableSet;
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;
-import org.apache.atlas.typesystem.json.InstanceSerialization;
-import org.apache.atlas.typesystem.json.TypesSerialization;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
+import org.apache.atlas.v1.model.instance.Referenceable;
+import org.apache.atlas.v1.model.instance.Struct;
+import org.apache.atlas.v1.model.typedef.AttributeDefinition;
+import org.apache.atlas.v1.model.typedef.TraitTypeDefinition;
+import org.apache.atlas.v1.model.typedef.TypesDef;
+import org.apache.atlas.v1.typesystem.types.utils.TypesUtil;
+import org.apache.atlas.type.AtlasType;
import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-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;
@@ -45,10 +42,7 @@ import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
+import java.util.*;
/**
* Client for metadata.
@@ -276,7 +270,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
*/
public List<String> createType(TypesDef typeDef) throws AtlasServiceException {
- return createType(TypesSerialization.toJson(typeDef));
+ return createType(AtlasType.toV1Json(typeDef));
}
/**
@@ -287,11 +281,11 @@ public class AtlasClient extends AtlasBaseClient {
* @return the list of types created
* @throws AtlasServiceException
*/
- public List<String> createTraitType(String traitName, ImmutableSet<String> superTraits, AttributeDefinition... attributeDefinitions) throws AtlasServiceException {
- HierarchicalTypeDefinition<TraitType> piiTrait =
- TypesUtil.createTraitTypeDef(traitName, superTraits, attributeDefinitions);
+ public List<String> createTraitType(String traitName, Set<String> superTraits, AttributeDefinition... attributeDefinitions) throws AtlasServiceException {
+ TraitTypeDefinition piiTrait =
+ TypesUtil.createTraitTypeDef(traitName, null, superTraits, Arrays.asList(attributeDefinitions));
- String traitDefinitionAsJSON = TypesSerialization.toJson(piiTrait, true);
+ String traitDefinitionAsJSON = AtlasType.toV1Json(piiTrait);
LOG.debug("Creating trait type {} {}", traitName, traitDefinitionAsJSON);
return createType(traitDefinitionAsJSON);
}
@@ -332,7 +326,7 @@ public class AtlasClient extends AtlasBaseClient {
* @throws AtlasServiceException
*/
public List<String> updateType(TypesDef typeDef) throws AtlasServiceException {
- return updateType(TypesSerialization.toJson(typeDef));
+ return updateType(AtlasType.toV1Json(typeDef));
}
/**
@@ -396,7 +390,7 @@ public class AtlasClient extends AtlasBaseClient {
try {
JSONObject response = callAPIWithBodyAndParams(API_V1.GET_TYPE, null, typeName);
String typeJson = response.getString(DEFINITION);
- return TypesSerialization.fromJson(typeJson);
+ return AtlasType.fromV1Json(typeJson, TypesDef.class);
} catch (JSONException e) {
throw new AtlasServiceException(e);
}
@@ -442,7 +436,7 @@ public class AtlasClient extends AtlasBaseClient {
private JSONArray getEntitiesArray(Collection<Referenceable> entities) {
JSONArray entityArray = new JSONArray(entities.size());
for (Referenceable entity : entities) {
- entityArray.put(InstanceSerialization.toJson(entity, true));
+ entityArray.put(AtlasType.toV1Json(entity));
}
return entityArray;
}
@@ -500,7 +494,7 @@ public class AtlasClient extends AtlasBaseClient {
* @param entity entity definition
*/
public EntityResult updateEntity(String guid, Referenceable entity) throws AtlasServiceException {
- String entityJson = InstanceSerialization.toJson(entity, true);
+ String entityJson = AtlasType.toV1Json(entity);
LOG.debug("Updating entity id {} with {}", guid, entityJson);
JSONObject response = callAPIWithBodyAndParams(API_V1.UPDATE_ENTITY_PARTIAL, entityJson, guid);
return extractEntityResult(response);
@@ -513,7 +507,7 @@ public class AtlasClient extends AtlasBaseClient {
* @param traitDefinition trait definition
*/
public void addTrait(String guid, Struct traitDefinition) throws AtlasServiceException {
- String traitJson = InstanceSerialization.toJson(traitDefinition, true);
+ String traitJson = AtlasType.toV1Json(traitDefinition);
LOG.debug("Adding trait to entity with id {} {}", guid, traitJson);
callAPIWithBodyAndParams(API_V1.ADD_TRAITS, traitJson, guid, URI_TRAITS);
}
@@ -540,7 +534,7 @@ public class AtlasClient extends AtlasBaseClient {
final String uniqueAttributeValue,
Referenceable entity) throws AtlasServiceException {
final API api = API_V1.UPDATE_ENTITY_PARTIAL;
- String entityJson = InstanceSerialization.toJson(entity, true);
+ String entityJson = AtlasType.toV1Json(entity);
LOG.debug("Updating entity type: {}, attributeName: {}, attributeValue: {}, entity: {}", entityType,
uniqueAttributeName, uniqueAttributeValue, entityJson);
JSONObject response = callAPIWithRetries(api, entityJson, new ResourceCreator() {
@@ -623,7 +617,7 @@ public class AtlasClient extends AtlasBaseClient {
JSONObject jsonResponse = callAPIWithBodyAndParams(API_V1.GET_ENTITY, null, guid);
try {
String entityInstanceDefinition = jsonResponse.getString(AtlasClient.DEFINITION);
- return InstanceSerialization.fromJsonReferenceable(entityInstanceDefinition, true);
+ return AtlasType.fromV1Json(entityInstanceDefinition, Referenceable.class);
} catch (JSONException e) {
throw new AtlasServiceException(API_V1.GET_ENTITY, e);
}
@@ -660,7 +654,7 @@ public class AtlasClient extends AtlasBaseClient {
});
try {
String entityInstanceDefinition = jsonResponse.getString(AtlasClient.DEFINITION);
- return InstanceSerialization.fromJsonReferenceable(entityInstanceDefinition, true);
+ return AtlasType.fromV1Json(entityInstanceDefinition, Referenceable.class);
} catch (JSONException e) {
throw new AtlasServiceException(api, e);
}
@@ -706,7 +700,7 @@ public class AtlasClient extends AtlasBaseClient {
List<JSONObject> traitDefList = extractResults(jsonResponse, AtlasClient.RESULTS, new ExtractOperation<JSONObject, JSONObject>());
ArrayList<Struct> traitStructList = new ArrayList<>();
for (JSONObject traitDef : traitDefList) {
- Struct traitStruct = InstanceSerialization.fromJsonStruct(traitDef.toString(), true);
+ Struct traitStruct = AtlasType.fromV1Json(traitDef.toString(), Struct.class);
traitStructList.add(traitStruct);
}
return traitStructList;
@@ -723,7 +717,7 @@ public class AtlasClient extends AtlasBaseClient {
JSONObject jsonResponse = callAPIWithBodyAndParams(API_V1.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName);
try {
- return InstanceSerialization.fromJsonStruct(jsonResponse.getString(AtlasClient.RESULTS), false);
+ return AtlasType.fromV1Json(jsonResponse.getString(AtlasClient.RESULTS), Struct.class);
} catch (JSONException e) {
throw new AtlasServiceException(API_V1.GET_TRAIT_DEFINITION, e);
}
@@ -782,7 +776,7 @@ public class AtlasClient extends AtlasBaseClient {
return extractResults(jsonResponse, AtlasClient.EVENTS, new ExtractOperation<EntityAuditEvent, JSONObject>() {
@Override
EntityAuditEvent extractElement(JSONObject element) throws JSONException {
- return SerDe.GSON.fromJson(element.toString(), EntityAuditEvent.class);
+ return AtlasType.fromV1Json(element.toString(), EntityAuditEvent.class);
}
});
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
----------------------------------------------------------------------
diff --git a/client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java b/client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
index 904674d..567205f 100644
--- a/client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
+++ b/client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
@@ -18,8 +18,9 @@
package org.apache.atlas;
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.json.InstanceSerialization;
+
+import org.apache.atlas.v1.model.instance.Referenceable;
+import org.apache.atlas.type.AtlasType;
import java.util.Objects;
@@ -38,13 +39,13 @@ public class EntityAuditEvent {
private EntityAuditAction action;
private String details;
private String eventKey;
- private IReferenceableInstance entityDefinition;
+ private Referenceable entityDefinition;
public EntityAuditEvent() {
}
public EntityAuditEvent(String entityId, Long ts, String user, EntityAuditAction action, String details,
- IReferenceableInstance entityDefinition) throws AtlasException {
+ Referenceable entityDefinition) throws AtlasException {
this.entityId = entityId;
this.timestamp = ts;
this.user = user;
@@ -74,11 +75,11 @@ public class EntityAuditEvent {
@Override
public String toString() {
- return SerDe.GSON.toJson(this);
+ return AtlasType.toV1Json(this);
}
public static EntityAuditEvent fromString(String eventString) {
- return SerDe.GSON.fromJson(eventString, EntityAuditEvent.class);
+ return AtlasType.fromV1Json(eventString, EntityAuditEvent.class);
}
public String getEntityId() {
@@ -129,18 +130,18 @@ public class EntityAuditEvent {
this.eventKey = eventKey;
}
- public IReferenceableInstance getEntityDefinition() {
+ public Referenceable getEntityDefinition() {
return entityDefinition;
}
public String getEntityDefinitionString() {
if (entityDefinition != null) {
- return InstanceSerialization.toJson(entityDefinition, true);
+ return AtlasType.toV1Json(entityDefinition);
}
return null;
}
public void setEntityDefinition(String entityDefinition) {
- this.entityDefinition = InstanceSerialization.fromJsonReferenceable(entityDefinition, true);
+ this.entityDefinition = AtlasType.fromV1Json(entityDefinition, Referenceable.class);
}
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/client-v1/src/main/java/org/apache/atlas/SerDe.java
----------------------------------------------------------------------
diff --git a/client/client-v1/src/main/java/org/apache/atlas/SerDe.java b/client/client-v1/src/main/java/org/apache/atlas/SerDe.java
deleted file mode 100644
index cdc3509..0000000
--- a/client/client-v1/src/main/java/org/apache/atlas/SerDe.java
+++ /dev/null
@@ -1,80 +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
- * <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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.json.InstanceSerialization;
-
-import java.lang.reflect.Type;
-
-@Deprecated
-public class SerDe {
- public static final Gson GSON = new GsonBuilder().
- registerTypeAdapter(IStruct.class, new StructDeserializer()).
- registerTypeAdapter(IReferenceableInstance.class, new ReferenceableSerializerDeserializer()).
- registerTypeAdapter(Referenceable.class, new ReferenceableSerializerDeserializer()).
- create();
-
- /**
- * Serde for Struct used by AbstractNotificationConsumer.GSON.
- */
- public static final class StructDeserializer implements JsonDeserializer<IStruct>, JsonSerializer<IStruct> {
- @Override
- public IStruct deserialize(final JsonElement json, final Type type,
- final JsonDeserializationContext context) {
- return context.deserialize(json, Struct.class);
- }
-
- @Override
- public JsonElement serialize(IStruct src, Type typeOfSrc, JsonSerializationContext context) {
- String instanceJson = InstanceSerialization.toJson(src, true);
- return new JsonParser().parse(instanceJson).getAsJsonObject();
- }
- }
-
- /**
- * Serde for Referenceable used by AbstractNotificationConsumer.GSON.
- */
- public static final class ReferenceableSerializerDeserializer implements JsonDeserializer<IStruct>,
- JsonSerializer<IReferenceableInstance> {
- @Override
- public IReferenceableInstance deserialize(final JsonElement json, final Type type,
- final JsonDeserializationContext context) {
-
- return InstanceSerialization.fromJsonReferenceable(json.toString(), true);
- }
-
- @Override
- public JsonElement serialize(IReferenceableInstance src, Type typeOfSrc, JsonSerializationContext context) {
- String instanceJson = InstanceSerialization.toJson(src, true);
- return new JsonParser().parse(instanceJson).getAsJsonObject();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/client-v1/src/test/java/org/apache/atlas/AtlasClientTest.java
----------------------------------------------------------------------
diff --git a/client/client-v1/src/test/java/org/apache/atlas/AtlasClientTest.java b/client/client-v1/src/test/java/org/apache/atlas/AtlasClientTest.java
index c387be1..5287af4 100644
--- a/client/client-v1/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/client-v1/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -22,8 +22,8 @@ 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.atlas.v1.model.instance.Referenceable;
+import org.apache.atlas.type.AtlasType;
import org.apache.commons.configuration.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.codehaus.jettison.json.JSONObject;
@@ -99,7 +99,7 @@ public class AtlasClientTest {
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);
+ String entityJson = AtlasType.toV1Json(new Referenceable("type"));
when(builder.method(anyString(), Matchers.<Class>any(), anyString())).thenReturn(response);
List<String> ids = atlasClient.createEntity(entityJson);
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index b69c077..728c706 100755
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -39,16 +39,22 @@
<dependencies>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
</dependency>
+
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index c2e5da6..6d7515b 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -76,6 +76,7 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/common/src/main/java/org/apache/atlas/AtlasConfiguration.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/AtlasConfiguration.java b/common/src/main/java/org/apache/atlas/AtlasConfiguration.java
deleted file mode 100644
index bd2bf7f..0000000
--- a/common/src/main/java/org/apache/atlas/AtlasConfiguration.java
+++ /dev/null
@@ -1,83 +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;
-
-import org.apache.commons.configuration.Configuration;
-
-/**
- * Enum that encapsulated each property name and its default value.
- */
-public enum AtlasConfiguration {
- //web server configuration
- WEBSERVER_MIN_THREADS("atlas.webserver.minthreads", 10),
- WEBSERVER_MAX_THREADS("atlas.webserver.maxthreads", 100),
- WEBSERVER_KEEPALIVE_SECONDS("atlas.webserver.keepalivetimesecs", 60),
- WEBSERVER_QUEUE_SIZE("atlas.webserver.queuesize", 100),
- WEBSERVER_REQUEST_BUFFER_SIZE("atlas.jetty.request.buffer.size", 16192),
-
- QUERY_PARAM_MAX_LENGTH("atlas.query.param.max.length", 4*1024),
-
- NOTIFICATION_MESSAGE_MAX_LENGTH_BYTES("atlas.notification.message.max.length.bytes", (1000 * 1000)),
- NOTIFICATION_MESSAGE_COMPRESSION_ENABLED("atlas.notification.message.compression.enabled", true),
- NOTIFICATION_SPLIT_MESSAGE_SEGMENTS_WAIT_TIME_SECONDS("atlas.notification.split.message.segments.wait.time.seconds", 15 * 60),
- NOTIFICATION_SPLIT_MESSAGE_BUFFER_PURGE_INTERVAL_SECONDS("atlas.notification.split.message.buffer.purge.interval.seconds", 5 * 60),
-
- //search configuration
- SEARCH_MAX_LIMIT("atlas.search.maxlimit", 10000),
- SEARCH_DEFAULT_LIMIT("atlas.search.defaultlimit", 100);
-
- private static final Configuration APPLICATION_PROPERTIES;
-
- static {
- try {
- APPLICATION_PROPERTIES = ApplicationProperties.get();
- } catch (AtlasException e) {
- throw new RuntimeException(e);
- }
- }
-
- private final String propertyName;
- private final Object defaultValue;
-
- AtlasConfiguration(String propertyName, Object defaultValue) {
- this.propertyName = propertyName;
- this.defaultValue = defaultValue;
- }
-
- public int getInt() {
- return APPLICATION_PROPERTIES.getInt(propertyName, Integer.valueOf(defaultValue.toString()).intValue());
- }
-
- public long getLong() {
- return APPLICATION_PROPERTIES.getLong(propertyName, Long.valueOf(defaultValue.toString()).longValue());
- }
-
- public boolean getBoolean() {
- return APPLICATION_PROPERTIES.getBoolean(propertyName, Boolean.valueOf(defaultValue.toString()).booleanValue());
- }
-
- public String getString() {
- return APPLICATION_PROPERTIES.getString(propertyName, defaultValue.toString());
- }
-
- public Object get() {
- Object value = APPLICATION_PROPERTIES.getProperty(propertyName);
- return value == null ? defaultValue : value;
- }
-}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/common/src/main/java/org/apache/atlas/repository/Constants.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/repository/Constants.java b/common/src/main/java/org/apache/atlas/repository/Constants.java
index 5475514..8eda22d 100644
--- a/common/src/main/java/org/apache/atlas/repository/Constants.java
+++ b/common/src/main/java/org/apache/atlas/repository/Constants.java
@@ -104,6 +104,13 @@ public final class Constants {
public static final String MAX_FULLTEXT_QUERY_STR_LENGTH = "atlas.graph.fulltext-max-query-str-length";
public static final String MAX_DSL_QUERY_STR_LENGTH = "atlas.graph.dsl-max-query-str-length";
+ public static final String ATTRIBUTE_NAME_GUID = "guid";
+ public static final String ATTRIBUTE_NAME_TYPENAME = "typeName";
+ public static final String ATTRIBUTE_NAME_SUPERTYPENAMES = "superTypeNames";
+ public static final String ATTRIBUTE_NAME_STATE = "state";
+ public static final String ATTRIBUTE_NAME_VERSION = "version";
+ public static final String TEMP_STRUCT_NAME_PREFIX = "__tempQueryResultStruct";
+
private Constants() {
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/api/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/api/pom.xml b/graphdb/api/pom.xml
index c949a98..d0462b4 100644
--- a/graphdb/api/pom.xml
+++ b/graphdb/api/pom.xml
@@ -32,10 +32,14 @@
<packaging>jar</packaging>
<dependencies>
+ <dependency>
+ <groupId>org.apache.atlas</groupId>
+ <artifactId>atlas-common</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
- <artifactId>atlas-typesystem</artifactId>
+ <artifactId>atlas-intg</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
index dded76f..31d2085 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraph.java
@@ -27,7 +27,7 @@ import javax.script.ScriptException;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.groovy.GroovyExpression;
-import org.apache.atlas.typesystem.types.IDataType;
+import org.apache.atlas.type.AtlasType;
/**
* Represents a graph.
@@ -110,7 +110,6 @@ public interface AtlasGraph<V, E> {
* Gets the names of the indexes on edges
* type.
*
- * @param type
* @return
*/
Set<String> getEdgeIndexKeys();
@@ -120,7 +119,6 @@ public interface AtlasGraph<V, E> {
* Gets the names of the indexes on vertices.
* type.
*
- * @param type
* @return
*/
Set<String> getVertexIndexKeys();
@@ -218,11 +216,11 @@ public interface AtlasGraph<V, E> {
* convert property values from the value that is stored in the graph
* to the value/type that the user expects to get back.
*
- * @param expr - gremlin expr that represents the persistent property value
+ * @param valueExpr - gremlin expr that represents the persistent property value
* @param type
* @return
*/
- GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression valueExpr, IDataType<?> type);
+ GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression valueExpr, AtlasType type);
/**
* Indicates whether or not stored values with the specified type need to be converted
@@ -234,7 +232,7 @@ public interface AtlasGraph<V, E> {
* gremlin expression with the converted value. In addition, this cause the gremlin
* 'filter' step to be used to compare the values instead of a 'has' step.
*/
- boolean isPropertyValueConversionNeeded(IDataType<?> type);
+ boolean isPropertyValueConversionNeeded(AtlasType type);
/**
* Gets the version of Gremlin that this graph uses.
@@ -286,7 +284,7 @@ public interface AtlasGraph<V, E> {
/**
* Executes a Gremlin script, returns an object with the result.
*
- * @param gremlinQuery
+ * @param query
* @param isPath whether this is a path query
*
* @return the result from executing the script
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/common/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/common/pom.xml b/graphdb/common/pom.xml
index d290b92..71e3bbc 100644
--- a/graphdb/common/pom.xml
+++ b/graphdb/common/pom.xml
@@ -34,6 +34,12 @@ under the License. -->
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
----------------------------------------------------------------------
diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
index bc63a69..7c96806 100644
--- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
+++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
@@ -21,6 +21,7 @@ import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import org.apache.atlas.type.AtlasType;
import org.janusgraph.core.Cardinality;
import org.janusgraph.core.PropertyKey;
import org.janusgraph.core.SchemaViolationException;
@@ -42,7 +43,6 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.graphdb.GremlinVersion;
import org.apache.atlas.repository.graphdb.janus.query.AtlasJanusGraphQuery;
import org.apache.atlas.repository.graphdb.utils.IteratorToIterableAdapter;
-import org.apache.atlas.typesystem.types.IDataType;
import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
@@ -359,13 +359,13 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
}
@Override
- public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, IDataType<?> type) {
+ public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, AtlasType type) {
//nothing special needed, value is stored in required type
return expr;
}
@Override
- public boolean isPropertyValueConversionNeeded(IDataType<?> type) {
+ public boolean isPropertyValueConversionNeeded(AtlasType type) {
return false;
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
index 2408287..4409009 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
@@ -45,7 +45,7 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.graphdb.GremlinVersion;
import org.apache.atlas.repository.graphdb.titan0.query.Titan0GraphQuery;
import org.apache.atlas.repository.graphdb.utils.IteratorToIterableAdapter;
-import org.apache.atlas.typesystem.types.IDataType;
+import org.apache.atlas.type.AtlasType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -348,14 +348,14 @@ public class Titan0Graph implements AtlasGraph<Titan0Vertex, Titan0Edge> {
}
@Override
- public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, IDataType<?> type) {
+ public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, AtlasType type) {
//nothing special needed, value is stored in required type
return expr;
}
@Override
- public boolean isPropertyValueConversionNeeded(IDataType<?> type) {
+ public boolean isPropertyValueConversionNeeded(AtlasType type) {
return false;
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Graph.java
----------------------------------------------------------------------
diff --git a/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Graph.java b/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Graph.java
index ffb6b37..d94289d 100644
--- a/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Graph.java
+++ b/graphdb/titan1/src/main/java/org/apache/atlas/repository/graphdb/titan1/Titan1Graph.java
@@ -42,7 +42,7 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.graphdb.GremlinVersion;
import org.apache.atlas.repository.graphdb.titan1.query.Titan1GraphQuery;
import org.apache.atlas.repository.graphdb.utils.IteratorToIterableAdapter;
-import org.apache.atlas.typesystem.types.IDataType;
+import org.apache.atlas.type.AtlasType;
import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
@@ -359,13 +359,13 @@ public class Titan1Graph implements AtlasGraph<Titan1Vertex, Titan1Edge> {
}
@Override
- public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, IDataType<?> type) {
+ public GroovyExpression generatePersisentToLogicalConversionExpression(GroovyExpression expr, AtlasType type) {
//nothing special needed, value is stored in required type
return expr;
}
@Override
- public boolean isPropertyValueConversionNeeded(IDataType<?> type) {
+ public boolean isPropertyValueConversionNeeded(AtlasType type) {
return false;
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/pom.xml
----------------------------------------------------------------------
diff --git a/intg/pom.xml b/intg/pom.xml
index 2f801e7..22895df 100644
--- a/intg/pom.xml
+++ b/intg/pom.xml
@@ -36,11 +36,6 @@
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
@@ -58,20 +53,23 @@
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -88,6 +86,14 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
new file mode 100644
index 0000000..bd2bf7f
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
@@ -0,0 +1,83 @@
+/**
+ * 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;
+
+import org.apache.commons.configuration.Configuration;
+
+/**
+ * Enum that encapsulated each property name and its default value.
+ */
+public enum AtlasConfiguration {
+ //web server configuration
+ WEBSERVER_MIN_THREADS("atlas.webserver.minthreads", 10),
+ WEBSERVER_MAX_THREADS("atlas.webserver.maxthreads", 100),
+ WEBSERVER_KEEPALIVE_SECONDS("atlas.webserver.keepalivetimesecs", 60),
+ WEBSERVER_QUEUE_SIZE("atlas.webserver.queuesize", 100),
+ WEBSERVER_REQUEST_BUFFER_SIZE("atlas.jetty.request.buffer.size", 16192),
+
+ QUERY_PARAM_MAX_LENGTH("atlas.query.param.max.length", 4*1024),
+
+ NOTIFICATION_MESSAGE_MAX_LENGTH_BYTES("atlas.notification.message.max.length.bytes", (1000 * 1000)),
+ NOTIFICATION_MESSAGE_COMPRESSION_ENABLED("atlas.notification.message.compression.enabled", true),
+ NOTIFICATION_SPLIT_MESSAGE_SEGMENTS_WAIT_TIME_SECONDS("atlas.notification.split.message.segments.wait.time.seconds", 15 * 60),
+ NOTIFICATION_SPLIT_MESSAGE_BUFFER_PURGE_INTERVAL_SECONDS("atlas.notification.split.message.buffer.purge.interval.seconds", 5 * 60),
+
+ //search configuration
+ SEARCH_MAX_LIMIT("atlas.search.maxlimit", 10000),
+ SEARCH_DEFAULT_LIMIT("atlas.search.defaultlimit", 100);
+
+ private static final Configuration APPLICATION_PROPERTIES;
+
+ static {
+ try {
+ APPLICATION_PROPERTIES = ApplicationProperties.get();
+ } catch (AtlasException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private final String propertyName;
+ private final Object defaultValue;
+
+ AtlasConfiguration(String propertyName, Object defaultValue) {
+ this.propertyName = propertyName;
+ this.defaultValue = defaultValue;
+ }
+
+ public int getInt() {
+ return APPLICATION_PROPERTIES.getInt(propertyName, Integer.valueOf(defaultValue.toString()).intValue());
+ }
+
+ public long getLong() {
+ return APPLICATION_PROPERTIES.getLong(propertyName, Long.valueOf(defaultValue.toString()).longValue());
+ }
+
+ public boolean getBoolean() {
+ return APPLICATION_PROPERTIES.getBoolean(propertyName, Boolean.valueOf(defaultValue.toString()).booleanValue());
+ }
+
+ public String getString() {
+ return APPLICATION_PROPERTIES.getString(propertyName, defaultValue.toString());
+ }
+
+ public Object get() {
+ Object value = APPLICATION_PROPERTIES.getProperty(propertyName);
+ return value == null ? defaultValue : value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationBaseMessage.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationBaseMessage.java b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationBaseMessage.java
new file mode 100644
index 0000000..2411808
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationBaseMessage.java
@@ -0,0 +1,208 @@
+/**
+ * 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.model.notification;
+
+
+import org.apache.atlas.AtlasConfiguration;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.binary.StringUtils;
+import org.apache.commons.compress.utils.IOUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+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)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class AtlasNotificationBaseMessage {
+ private static final Logger LOG = LoggerFactory.getLogger(AtlasNotificationBaseMessage.class);
+
+ public static final int MESSAGE_MAX_LENGTH_BYTES = AtlasConfiguration.NOTIFICATION_MESSAGE_MAX_LENGTH_BYTES.getInt() - 512; // 512 bytes for envelop;
+ public static final boolean MESSAGE_COMPRESSION_ENABLED = AtlasConfiguration.NOTIFICATION_MESSAGE_COMPRESSION_ENABLED.getBoolean();
+
+ public enum CompressionKind { NONE, GZIP };
+
+ private MessageVersion version = null;
+ private String msgId = null;
+ private CompressionKind msgCompressionKind = CompressionKind.NONE;
+ private int msgSplitIdx = 1;
+ private int msgSplitCount = 1;
+
+
+ public AtlasNotificationBaseMessage() {
+ }
+
+ public AtlasNotificationBaseMessage(MessageVersion version) {
+ this(version, null, CompressionKind.NONE);
+ }
+
+ public AtlasNotificationBaseMessage(MessageVersion version, String msgId, CompressionKind msgCompressionKind) {
+ this.version = version;
+ this.msgId = msgId;
+ this.msgCompressionKind = msgCompressionKind;
+ }
+
+ public AtlasNotificationBaseMessage(MessageVersion version, String msgId, CompressionKind msgCompressionKind, int msgSplitIdx, int msgSplitCount) {
+ this.version = version;
+ this.msgId = msgId;
+ this.msgCompressionKind = msgCompressionKind;
+ this.msgSplitIdx = msgSplitIdx;
+ this.msgSplitCount = msgSplitCount;
+ }
+
+ public void setVersion(MessageVersion version) {
+ this.version = version;
+ }
+
+ public MessageVersion getVersion() {
+ return version;
+ }
+
+ public String getMsgId() {
+ return msgId;
+ }
+
+ public void setMsgId(String msgId) {
+ this.msgId = msgId;
+ }
+
+ public CompressionKind getMsgCompressionKind() {
+ return msgCompressionKind;
+ }
+
+ public void setMsgCompressed(CompressionKind msgCompressionKind) {
+ this.msgCompressionKind = msgCompressionKind;
+ }
+
+ public int getMsgSplitIdx() {
+ return msgSplitIdx;
+ }
+
+ public void setMsgSplitIdx(int msgSplitIdx) {
+ this.msgSplitIdx = msgSplitIdx;
+ }
+
+ public int getMsgSplitCount() {
+ return msgSplitCount;
+ }
+
+ public void setMsgSplitCount(int msgSplitCount) {
+ this.msgSplitCount = msgSplitCount;
+ }
+
+ /**
+ * Compare the version of this message with the given version.
+ *
+ * @param compareToVersion the version to compare to
+ *
+ * @return a negative integer, zero, or a positive integer as this message's version is less than, equal to,
+ * or greater than the given version.
+ */
+ public int compareVersion(MessageVersion compareToVersion) {
+ return version.compareTo(compareToVersion);
+ }
+
+
+ public static byte[] getBytesUtf8(String str) {
+ return StringUtils.getBytesUtf8(str);
+ }
+
+ public static String getStringUtf8(byte[] bytes) {
+ return StringUtils.newStringUtf8(bytes);
+ }
+
+ public static byte[] encodeBase64(byte[] bytes) {
+ return Base64.encodeBase64(bytes);
+ }
+
+ public static byte[] decodeBase64(byte[] bytes) {
+ return Base64.decodeBase64(bytes);
+ }
+
+ public static byte[] gzipCompressAndEncodeBase64(byte[] bytes) {
+ return encodeBase64(gzipCompress(bytes));
+ }
+
+ public static byte[] decodeBase64AndGzipUncompress(byte[] bytes) {
+ return gzipUncompress(decodeBase64(bytes));
+ }
+
+ public static String gzipCompress(String str) {
+ byte[] bytes = getBytesUtf8(str);
+ byte[] compressedBytes = gzipCompress(bytes);
+ byte[] encodedBytes = encodeBase64(compressedBytes);
+
+ return getStringUtf8(encodedBytes);
+ }
+
+ public static String gzipUncompress(String str) {
+ byte[] encodedBytes = getBytesUtf8(str);
+ byte[] compressedBytes = decodeBase64(encodedBytes);
+ byte[] bytes = gzipUncompress(compressedBytes);
+
+ return getStringUtf8(bytes);
+ }
+
+ public static byte[] gzipCompress(byte[] content) {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+ try {
+ GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
+
+ gzipOutputStream.write(content);
+ gzipOutputStream.close();
+ } catch (IOException e) {
+ LOG.error("gzipCompress(): error compressing {} bytes", content.length, e);
+
+ throw new RuntimeException(e);
+ }
+
+ return byteArrayOutputStream.toByteArray();
+ }
+
+ public static byte[] gzipUncompress(byte[] content) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ try {
+ IOUtils.copy(new GZIPInputStream(new ByteArrayInputStream(content)), out);
+ } catch (IOException e) {
+ LOG.error("gzipUncompress(): error uncompressing {} bytes", content.length, e);
+ }
+
+ return out.toByteArray();
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationMessage.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationMessage.java b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationMessage.java
new file mode 100644
index 0000000..5a5b63f
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationMessage.java
@@ -0,0 +1,101 @@
+/**
+ * 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.model.notification;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+/**
+ * Represents a notification message that is associated with a version.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class AtlasNotificationMessage<T> extends AtlasNotificationBaseMessage {
+ private String msgSourceIP;
+ private String msgCreatedBy;
+ private long msgCreationTime;
+
+ /**
+ * The actual message.
+ */
+ private T message;
+
+
+ // ----- Constructors ----------------------------------------------------
+ public AtlasNotificationMessage() {
+ }
+
+ public AtlasNotificationMessage(MessageVersion version, T message) {
+ this(version, message, null, null);
+ }
+
+ public AtlasNotificationMessage(MessageVersion version, T message, String msgSourceIP, String createdBy) {
+ super(version);
+
+ this.msgSourceIP = msgSourceIP;
+ this.msgCreatedBy = createdBy;
+ this.msgCreationTime = (new Date()).getTime();
+ this.message = message;
+ }
+
+
+ public String getMsgSourceIP() {
+ return msgSourceIP;
+ }
+
+ public void setMsgSourceIP(String msgSourceIP) {
+ this.msgSourceIP = msgSourceIP;
+ }
+
+ public String getMsgCreatedBy() {
+ return msgCreatedBy;
+ }
+
+ public void setMsgCreatedBy(String msgCreatedBy) {
+ this.msgCreatedBy = msgCreatedBy;
+ }
+
+ public long getMsgCreationTime() {
+ return msgCreationTime;
+ }
+
+ public void setMsgCreationTime(long msgCreationTime) {
+ this.msgCreationTime = msgCreationTime;
+ }
+
+ public T getMessage() {
+ return message;
+ }
+
+ public void setMessage(T message) {
+ this.message = message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationStringMessage.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationStringMessage.java b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationStringMessage.java
new file mode 100644
index 0000000..9064b6c
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/notification/AtlasNotificationStringMessage.java
@@ -0,0 +1,82 @@
+/**
+ * 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.model.notification;
+
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+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)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class AtlasNotificationStringMessage extends AtlasNotificationBaseMessage {
+ private String message = null;
+
+ public AtlasNotificationStringMessage() {
+ super(MessageVersion.CURRENT_VERSION);
+ }
+
+ public AtlasNotificationStringMessage(String message) {
+ super(MessageVersion.CURRENT_VERSION);
+
+ this.message = message;
+ }
+
+ public AtlasNotificationStringMessage(String message, String msgId, CompressionKind compressionKind) {
+ super(MessageVersion.CURRENT_VERSION, msgId, compressionKind);
+
+ this.message = message;
+ }
+
+ public AtlasNotificationStringMessage(String message, String msgId, CompressionKind compressionKind, int msgSplitIdx, int msgSplitCount) {
+ super(MessageVersion.CURRENT_VERSION, msgId, compressionKind, msgSplitIdx, msgSplitCount);
+
+ this.message = message;
+ }
+
+ public AtlasNotificationStringMessage(byte[] encodedBytes, String msgId, CompressionKind compressionKind) {
+ super(MessageVersion.CURRENT_VERSION, msgId, compressionKind);
+
+ this.message = AtlasNotificationBaseMessage.getStringUtf8(encodedBytes);
+ }
+
+ public AtlasNotificationStringMessage(byte[] encodedBytes, int offset, int length, String msgId, CompressionKind compressionKind, int msgSplitIdx, int msgSplitCount) {
+ super(MessageVersion.CURRENT_VERSION, msgId, compressionKind, msgSplitIdx, msgSplitCount);
+
+ this.message = new String(encodedBytes, offset, length);
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java b/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
new file mode 100644
index 0000000..3d03457
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
@@ -0,0 +1,86 @@
+/**
+ * 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.model.notification;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+/**
+ * Base type of hook message.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.ALWAYS)
+@JsonIgnoreProperties(ignoreUnknown=true)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class EntityNotification implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Type of the hook message.
+ */
+ public enum EntityNotificationType {
+ ENTITY_NOTIFICATION_V1
+ }
+
+ protected EntityNotificationType type;
+
+ public EntityNotification() {
+ this.type = EntityNotificationType.ENTITY_NOTIFICATION_V1;
+ }
+
+ public EntityNotification(EntityNotificationType type) {
+ this.type = type;
+ }
+
+ public EntityNotificationType getType() {
+ return type;
+ }
+
+ public void setType(EntityNotificationType type) {
+ this.type = type;
+ }
+
+ public void normalize() { }
+
+ @Override
+ public String toString() {
+ return toString(new StringBuilder()).toString();
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ if (sb == null) {
+ sb = new StringBuilder();
+ }
+
+ sb.append("EntityNotification{");
+ sb.append("type=").append(type);
+ sb.append("}");
+
+ return sb;
+ }
+}