summaryrefslogtreecommitdiffstats
path: root/aai-core/src/main/java
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-03-06 07:56:05 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-06-04 16:43:22 +0200
commit9034ac68d20e1cb9f9aeda9ed8445023fca92527 (patch)
treed8520cd4ddd128b5bda15284680a2af84d14eebc /aai-core/src/main/java
parent17cf0fc2bd8ead53beadafe0fda7605fbb27f618 (diff)
Update janusgraph to 0.3.3
- update tinkerpop version from 3.2.11 to 3.3.0 - update janusgraph from 0.2.3 to 0.3.3 - the default GraphSON version would change with this update but was held back [1] - add jackson-dataformat-xml dependency to aai-core as the XmlMapper is used in the ErrorLogHelper [1] a separate story AAI-3796 - Use GraphSON v2 or v3 in AAI has been created for this Issue-ID: AAI-3795 Change-Id: I4539e83aa74c260d5238ebe869e9884d4396e9f4 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-core/src/main/java')
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialIO.java10
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java1
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java11
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java9
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java3
-rw-r--r--aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java8
7 files changed, 31 insertions, 13 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialIO.java b/aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialIO.java
index 6c2eee15..c097a5bf 100644
--- a/aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialIO.java
+++ b/aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialIO.java
@@ -129,16 +129,6 @@ public final class GraphSONPartialIO
this.version = version;
}
- /**
- * @deprecated As of release 3.2.2, replaced by {@link #onMapper(Consumer)}.
- */
- @Deprecated
- @Override
- public Io.Builder<GraphSONPartialIO> registry(final IoRegistry registry) {
- this.registry = registry;
- return this;
- }
-
@Override
public Io.Builder<? extends Io> onMapper(final Consumer<Mapper.Builder> onMapper) {
this.onMapper = onMapper;
diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
index d9994f52..15f57c13 100644
--- a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
+++ b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
@@ -70,6 +70,7 @@ public class AAIGraph {
}
this.loadGraph(rtConfig, serviceName);
} catch (Exception e) {
+ logger.error("Failed to instantiate graph", e);
throw new RuntimeException("Failed to instantiate graphs", e);
}
}
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
index c5c4512e..24e5ec8b 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
@@ -34,7 +34,7 @@ import java.util.Set;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
@@ -689,6 +689,15 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
}
@Override
+ public QueryBuilder<E> select(Pop pop, String name) {
+ this.traversal.select(pop, name);
+
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
public QueryBuilder<E> select(String... names) {
if (names.length == 1) {
this.traversal.select(names[0]);
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
index 4500a47e..db1c78ae 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
@@ -29,6 +29,7 @@ import com.google.common.collect.Multimap;
import java.util.*;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
@@ -828,6 +829,14 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
}
@Override
+ public QueryBuilder<E> select(Pop pop, String name) {
+ this.list.add(".select(Pop." + pop.toString() + ",'" + name + "')");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
public QueryBuilder<E> select(String... names) {
String stepString = ".select('";
for (int i = 0; i < names.length; i++) {
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
index 66532529..309ffa16 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
@@ -31,6 +31,7 @@ import java.util.Map;
import javax.ws.rs.core.MultivaluedMap;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -704,6 +705,8 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
public abstract QueryBuilder<E> select(String name);
+ public abstract QueryBuilder<E> select(Pop pop, String name);
+
public abstract QueryBuilder<E> select(String... names);
public abstract QueryBuilder<E> until(QueryBuilder<E> builder);
diff --git a/aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java b/aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java
index 4a8760ec..f63df4b2 100644
--- a/aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java
+++ b/aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java
@@ -59,7 +59,7 @@ public abstract class AAIAbstractGroovyShell {
"org.apache.tinkerpop.gremlin.process.traversal.Order");
imports.addImports("org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__",
"org.apache.tinkerpop.gremlin.structure.T", "org.apache.tinkerpop.gremlin.process.traversal.P",
- "org.onap.aai.edges.enums.EdgeType", "java.util.Map.Entry");
+ "org.onap.aai.edges.enums.EdgeType", "java.util.Map.Entry","org.apache.tinkerpop.gremlin.process.traversal.Pop");
imports.addStarImports("java.util");
CompilerConfiguration config = new CompilerConfiguration();
config.addCompilationCustomizers(custom, imports);
diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java
index c0ba860f..89970e24 100644
--- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java
+++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java
@@ -36,6 +36,7 @@ import java.util.Optional;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry;
import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported;
@@ -47,8 +48,13 @@ public class GraphSON implements FormatMapper {
private static final Logger logger = LoggerFactory.getLogger(GraphSON.class);
+ // TODO: Use v2 or v3 here
+ // v2 is the default starting from Janusgraph 0.3.0
+ // Further reference: https://tinkerpop.apache.org/docs/3.3.0/dev/io/#graphson
+ private static final GraphSONVersion version = GraphSONVersion.V1_0;
+
private final GraphSONMapper mapper =
- GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create();
+ GraphSONMapper.build().version(version).addRegistry(JanusGraphIoRegistry.getInstance()).create();
private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create();
@Override