Skip to content

Commit

Permalink
ATLAS-695: Add Titan 1 project to Atlas
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Hagelberg <jnhagelberg@us.ibm.com>
  • Loading branch information
guptaneeru authored and jnhagelberg committed Mar 1, 2017
1 parent 46b1b36 commit 6fd04d9
Show file tree
Hide file tree
Showing 46 changed files with 4,711 additions and 141 deletions.
79 changes: 52 additions & 27 deletions catalog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,34 @@
<parent>
<groupId>org.apache.atlas</groupId>
<artifactId>apache-atlas</artifactId>
<version>0.8-incubating-SNAPSHOT</version>
<version>0.8-incubating-SNAPSHOT</version>
</parent>
<artifactId>atlas-catalog</artifactId>
<description>Apache Atlas Business Catalog Module</description>
<name>Apache Atlas Business Catalog</name>
<packaging>jar</packaging>

<properties>
<tinkerpop.version>2.6.0</tinkerpop.version>
<titan.version>0.5.4</titan.version>
<lucene.version>4.8.1</lucene.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-repository</artifactId>
</dependency>

<profiles>
<profile>
<id>titan1</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<lucene.version>4.10.4</lucene.version>
</properties>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-repository</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -64,11 +69,43 @@
<artifactId>atlas-graphdb-api</artifactId>
</dependency>

<!-- for now, catalog can only be used with Titan 0.5.4 -->
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-graphdb-titan0</artifactId>
<version>${project.version}</version>
<!-- for now, keep the titan 0.5.4 / TP 2 dependencies. This will need to be changed to use a
more generic query framework that supports both TP2/TP3. Maybe the DSL translation could be changed to use
that as well...
-->
<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
<artifactId>blueprints-core</artifactId>
<version>${tinkerpop.version}</version>
</dependency>
<dependency>
<groupId>com.tinkerpop.gremlin</groupId>
<artifactId>gremlin-java</artifactId>
<version>${tinkerpop.version}</version>
</dependency>

<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-core</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
</dependency>

<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
</dependency>

<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -96,18 +133,6 @@
<artifactId>json-simple</artifactId>
</dependency>

<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
<artifactId>blueprints-core</artifactId>
<version>${tinkerpop.version}</version>
</dependency>

<dependency>
<groupId>com.tinkerpop.gremlin</groupId>
<artifactId>gremlin-java</artifactId>
<version>${tinkerpop.version}</version>
</dependency>

<!-- testing -->
<dependency>
<groupId>org.easymock</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import org.apache.atlas.catalog.projection.Projection;
import org.apache.atlas.catalog.projection.ProjectionResult;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.titan0.Titan0GraphDatabase;
import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.typesystem.persistence.Id;

import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.blueprints.Compare;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.gremlin.java.GremlinPipeline;
Expand Down Expand Up @@ -165,10 +165,9 @@ protected Request getRequest() {
return request;
}

//todo: abstract
// Underlying method is synchronized and caches the graph in a static field
protected TitanGraph getGraph() {
return Titan0GraphDatabase.getGraphInstance();
protected AtlasGraph getGraph() {
return AtlasGraphProvider.getGraphInstance();
}

protected VertexWrapper wrapVertex(Vertex v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.gremlin.java.GremlinPipeline;
import com.tinkerpop.pipes.Pipe;

import org.apache.atlas.catalog.Request;
import org.apache.atlas.catalog.VertexWrapper;
import org.apache.atlas.catalog.definition.ResourceDefinition;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.easymock.Capture;
import org.testng.annotations.Test;

Expand All @@ -44,7 +46,7 @@ public class AtlasEntityQueryTest {
//todo: add tests for instance query and getInitialPipeline()
@Test
public void testExecute_Collection() throws Exception {
TitanGraph graph = createStrictMock(TitanGraph.class);
AtlasGraph graph = createStrictMock(AtlasGraph.class);
QueryExpression expression = createStrictMock(QueryExpression.class);
ResourceDefinition resourceDefinition = createStrictMock(ResourceDefinition.class);
Request request = createStrictMock(Request.class);
Expand Down Expand Up @@ -107,7 +109,7 @@ public void testExecute_Collection() throws Exception {

@Test
public void testExecute_Collection_rollbackOnException() throws Exception {
TitanGraph graph = createStrictMock(TitanGraph.class);
AtlasGraph graph = createStrictMock(AtlasGraph.class);
QueryExpression expression = createStrictMock(QueryExpression.class);
ResourceDefinition resourceDefinition = createStrictMock(ResourceDefinition.class);
Request request = createStrictMock(Request.class);
Expand Down Expand Up @@ -151,7 +153,7 @@ public void testExecute_Collection_rollbackOnException() throws Exception {

@Test
public void testExecute_Collection_update() throws Exception {
TitanGraph graph = createStrictMock(TitanGraph.class);
AtlasGraph graph = createStrictMock(AtlasGraph.class);
QueryExpression expression = createStrictMock(QueryExpression.class);
ResourceDefinition resourceDefinition = createStrictMock(ResourceDefinition.class);
Request request = createStrictMock(Request.class);
Expand Down Expand Up @@ -227,7 +229,7 @@ private class TestAtlasEntityQuery extends AtlasEntityQuery {
private final GremlinPipeline initialPipeline;
private final Pipe queryPipe;
private final Pipe notDeletedPipe;
private final TitanGraph graph;
private final AtlasGraph graph;
private final VertexWrapper vWrapper;

public TestAtlasEntityQuery(QueryExpression queryExpression,
Expand All @@ -236,7 +238,7 @@ public TestAtlasEntityQuery(QueryExpression queryExpression,
GremlinPipeline initialPipeline,
Pipe queryPipe,
Pipe notDeletedPipe,
TitanGraph graph,
AtlasGraph graph,
VertexWrapper vWrapper) {

super(queryExpression, resourceDefinition, request);
Expand All @@ -263,7 +265,7 @@ protected Pipe getNotDeletedPipe() {
}

@Override
protected TitanGraph getGraph() {
protected AtlasGraph getGraph() {
return graph;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.atlas.utils;
package org.apache.atlas.repository.graphdb.utils;

import java.util.Iterator;

Expand Down
17 changes: 6 additions & 11 deletions graphdb/graphdb-impls/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,20 @@
should be configured to exclude all but the
proper dependency
-->

<description>Apache Atlas Graph Database Implementation Dependencies</description>
<name>Apache Atlas Graph Database Implementation Dependencies</name>
<packaging>pom</packaging>

<dependencies>

<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-graphdb-titan1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.atlas</groupId>
<artifactId>atlas-graphdb-titan0</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Additional dependencies should be added here
as more implementations are introduced. In the
profile corresponding to the implementation in
the root pom.xml, all dependencies except for
that one should be excluded. -->

</dependencies>

</project>
4 changes: 3 additions & 1 deletion graphdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>apache-atlas</artifactId>
<groupId>org.apache.atlas</groupId>
Expand All @@ -32,8 +33,9 @@

<modules>
<module>api</module>
<module>titan0</module>
<module>common</module>
<module>graphdb-impls</module>
<module>titan0</module>
<module>titan1</module>
</modules>
</project>
27 changes: 24 additions & 3 deletions graphdb/titan0/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,31 @@
<properties>
<tinkerpop.version>2.6.0</tinkerpop.version>
<titan.version>0.5.4</titan.version>
<guava.version>14.0</guava.version>
<checkstyle.failOnViolation>false</checkstyle.failOnViolation>
<guava.version>14.0</guava.version>
</properties>

<profiles>
<profile>
<id>titan0</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>

<!-- for graphdb interface definitions -->
Expand Down Expand Up @@ -150,7 +172,7 @@
<plugins>
<!--
Create 'uber' jar that contains all of the dependencies (except those whose scope is provided)
Only Titan 0l5l4 and its dependencies are included. The other dependencies are bundled in the war file.
Only Titan 0.5.4 and its dependencies are included. The other dependencies are bundled in the war file.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -188,7 +210,6 @@
<shadedPattern>atlas.shaded.titan.guava</shadedPattern>
</relocation>
</relocations>
<createSourcesJar>true</createSourcesJar>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
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.utils.IteratorToIterableAdapter;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
Expand Down

0 comments on commit 6fd04d9

Please sign in to comment.