diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2018-03-21 18:26:20 -0400 |
---|---|---|
committer | Kajur, Harish (vk250x) <vk250x@att.com> | 2018-03-27 16:56:41 -0400 |
commit | 8824d311caf6023340e3663f4ff9f61dea8e4241 (patch) | |
tree | 6fbd365996cecf57e85c9f4f0fb371f27dcd3de1 /aai-core/src/main/java | |
parent | acab561d7262dc5177c58d9a046fc293f16f80cb (diff) |
Update from titan to using janusgraph
Issue-ID: AAI-949
Change-Id: I70029806d3c96f7732778d27a8c7ff75dc5059de
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'aai-core/src/main/java')
27 files changed, 185 insertions, 187 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditTitan.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditJanusGraph.java index 03c0f9ae..e8ac6ae0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditTitan.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditJanusGraph.java @@ -25,22 +25,22 @@ import java.util.LinkedHashSet; import org.apache.tinkerpop.gremlin.structure.Vertex; -import com.thinkaurelius.titan.core.EdgeLabel; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.EdgeLabel; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; -public class AuditTitan extends Auditor { +public class AuditJanusGraph extends Auditor { - private final TitanGraph graph; + private final JanusGraph graph; /** - * Instantiates a new audit titan. + * Instantiates a new audit JanusGraph. * * @param g the g */ - public AuditTitan (TitanGraph g) { + public AuditJanusGraph (JanusGraph g) { this.graph = g; buildSchema(); } @@ -58,12 +58,12 @@ public class AuditTitan extends Auditor { * Populate properties. */ private void populateProperties() { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); Iterable<PropertyKey> iterable = mgmt.getRelationTypes(PropertyKey.class); - Iterator<PropertyKey> titanProperties = iterable.iterator(); + Iterator<PropertyKey> JanusGraphProperties = iterable.iterator(); PropertyKey propKey; - while (titanProperties.hasNext()) { - propKey = titanProperties.next(); + while (JanusGraphProperties.hasNext()) { + propKey = JanusGraphProperties.next(); DBProperty prop = new DBProperty(); prop.setName(propKey.name()); @@ -78,23 +78,23 @@ public class AuditTitan extends Auditor { * Populate indexes. */ private void populateIndexes() { - TitanManagement mgmt = graph.openManagement(); - Iterable<TitanGraphIndex> iterable = mgmt.getGraphIndexes(Vertex.class); - Iterator<TitanGraphIndex> titanIndexes = iterable.iterator(); - TitanGraphIndex titanIndex; - while (titanIndexes.hasNext()) { - titanIndex = titanIndexes.next(); - if (titanIndex.isCompositeIndex()) { + JanusGraphManagement mgmt = graph.openManagement(); + Iterable<JanusGraphIndex> iterable = mgmt.getGraphIndexes(Vertex.class); + Iterator<JanusGraphIndex> JanusGraphIndexes = iterable.iterator(); + JanusGraphIndex JanusGraphIndex; + while (JanusGraphIndexes.hasNext()) { + JanusGraphIndex = JanusGraphIndexes.next(); + if (JanusGraphIndex.isCompositeIndex()) { DBIndex index = new DBIndex(); LinkedHashSet<DBProperty> dbProperties = new LinkedHashSet<>(); - index.setName(titanIndex.name()); - index.setUnique(titanIndex.isUnique()); - PropertyKey[] keys = titanIndex.getFieldKeys(); + index.setName(JanusGraphIndex.name()); + index.setUnique(JanusGraphIndex.isUnique()); + PropertyKey[] keys = JanusGraphIndex.getFieldKeys(); for (PropertyKey key : keys) { dbProperties.add(this.properties.get(key.name())); } index.setProperties(dbProperties); - index.setStatus(titanIndex.getIndexStatus(keys[0])); + index.setStatus(JanusGraphIndex.getIndexStatus(keys[0])); this.indexes.put(index.getName(), index); } } @@ -104,12 +104,12 @@ public class AuditTitan extends Auditor { * Populate edge labels. */ private void populateEdgeLabels() { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); Iterable<EdgeLabel> iterable = mgmt.getRelationTypes(EdgeLabel.class); - Iterator<EdgeLabel> titanEdgeLabels = iterable.iterator(); + Iterator<EdgeLabel> JanusGraphEdgeLabels = iterable.iterator(); EdgeLabel edgeLabel; - while (titanEdgeLabels.hasNext()) { - edgeLabel = titanEdgeLabels.next(); + while (JanusGraphEdgeLabels.hasNext()) { + edgeLabel = JanusGraphEdgeLabels.next(); EdgeProperty edgeProperty = new EdgeProperty(); edgeProperty.setName(edgeLabel.name()); diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java index ff7eee25..167b26d0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java @@ -51,9 +51,9 @@ import org.onap.aai.util.AAIConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.collect.Multimap; -import com.thinkaurelius.titan.core.Cardinality; -import com.thinkaurelius.titan.core.Multiplicity; -import com.thinkaurelius.titan.core.schema.SchemaStatus; +import org.janusgraph.core.Cardinality; +import org.janusgraph.core.Multiplicity; +import org.janusgraph.core.schema.SchemaStatus; public class AuditOXM extends Auditor { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java index f47807b2..67bc0398 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java @@ -20,7 +20,7 @@ package org.onap.aai.db.schema; import org.onap.aai.introspection.Version; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class AuditorFactory { @@ -40,7 +40,7 @@ public class AuditorFactory { * @param g the g * @return the graph auditor */ - public static Auditor getGraphAuditor (TitanGraph g) { - return new AuditTitan(g); + public static Auditor getGraphAuditor (JanusGraph g) { + return new AuditJanusGraph(g); } } diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java b/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java index f0e3ee6d..9fd0eda0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java @@ -22,7 +22,7 @@ package org.onap.aai.db.schema; import java.util.LinkedHashSet; import java.util.Set; -import com.thinkaurelius.titan.core.schema.SchemaStatus; +import org.janusgraph.core.schema.SchemaStatus; public class DBIndex implements Named { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java b/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java index 29aef8e8..fd19f72d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java @@ -20,7 +20,7 @@ package org.onap.aai.db.schema; import org.onap.aai.introspection.Introspector; -import com.thinkaurelius.titan.core.Cardinality; +import org.janusgraph.core.Cardinality; public class DBProperty implements Named { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java b/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java index f0de7656..6d10232d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java @@ -19,7 +19,7 @@ */ package org.onap.aai.db.schema; -import com.thinkaurelius.titan.core.Multiplicity; +import org.janusgraph.core.Multiplicity; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonPropertyOrder; diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/ManageTitanSchema.java b/aai-core/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java index c696d88d..bf2d4107 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/ManageTitanSchema.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java @@ -28,19 +28,19 @@ import com.att.eelf.configuration.EELFManager; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.onap.aai.introspection.Version; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.SchemaStatus; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; -import com.thinkaurelius.titan.core.schema.TitanManagement.IndexBuilder; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.SchemaStatus; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder; -public class ManageTitanSchema { +public class ManageJanusGraphSchema { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(AuditOXM.class); + private static final EELFLogger logger = EELFManager.getInstance().getLogger(ManageJanusGraphSchema.class); - private TitanManagement graphMgmt; - private TitanGraph graph; + private JanusGraphManagement graphMgmt; + private JanusGraph graph; private List<DBProperty> aaiProperties; private List<DBIndex> aaiIndexes; private List<EdgeProperty> aaiEdgeProperties; @@ -48,11 +48,11 @@ public class ManageTitanSchema { private Auditor graphInfo = null; /** - * Instantiates a new manage titan schema. + * Instantiates a new manage JanusGraph schema. * * @param graph the graph */ - public ManageTitanSchema(final TitanGraph graph) { + public ManageJanusGraphSchema(final JanusGraph graph) { this.graph = graph; oxmInfo = AuditorFactory.getOXMAuditor(Version.v8); graphInfo = AuditorFactory.getGraphAuditor(graph); @@ -126,8 +126,8 @@ public class ManageTitanSchema { keyList.add(graphMgmt.getPropertyKey(prop.getName())); } if (graphMgmt.containsGraphIndex(index.getName())) { - TitanGraphIndex titanIndex = graphMgmt.getGraphIndex(index.getName()); - PropertyKey[] dbKeys = titanIndex.getFieldKeys(); + JanusGraphIndex JanusGraphIndex = graphMgmt.getGraphIndex(index.getName()); + PropertyKey[] dbKeys = JanusGraphIndex.getFieldKeys(); if (dbKeys.length != keyList.size()) { isChanged = true; } else { @@ -178,7 +178,7 @@ public class ManageTitanSchema { * @param mgmt the mgmt * @param prop the prop */ - private void createProperty(TitanManagement mgmt, DBProperty prop) { + private void createProperty(JanusGraphManagement mgmt, DBProperty prop) { if (mgmt.containsPropertyKey(prop.getName())) { PropertyKey key = mgmt.getPropertyKey(prop.getName()); boolean isChanged = false; @@ -209,11 +209,11 @@ public class ManageTitanSchema { * @param isNew the is new * @param isChanged the is changed */ - private void createIndex(TitanManagement mgmt, String indexName, List<PropertyKey> keys, boolean isUnique, boolean isNew, boolean isChanged) { + private void createIndex(JanusGraphManagement mgmt, String indexName, List<PropertyKey> keys, boolean isUnique, boolean isNew, boolean isChanged) { /*if (isChanged) { System.out.println("Changing index: " + indexName); - TitanGraphIndex oldIndex = mgmt.getGraphIndex(indexName); + JanusGraphIndex oldIndex = mgmt.getGraphIndex(indexName); mgmt.updateIndex(oldIndex, SchemaAction.DISABLE_INDEX); mgmt.commit(); //cannot remove indexes @@ -241,7 +241,7 @@ public class ManageTitanSchema { try { //waitForCompletion(indexName); - //TitanIndexRepair.hbaseRepair(AAIConstants.AAI_CONFIG_FILENAME, indexName, ""); + //JanusGraphIndexRepair.hbaseRepair(AAIConstants.AAI_CONFIG_FILENAME, indexName, ""); } catch (Exception e) { graph.tx().rollback(); graph.close(); @@ -270,8 +270,8 @@ public class ManageTitanSchema { long before = System.currentTimeMillis(); while (!registered) { Thread.sleep(500L); - TitanManagement mgmt = graph.openManagement(); - TitanGraphIndex idx = mgmt.getGraphIndex(name); + JanusGraphManagement mgmt = graph.openManagement(); + JanusGraphIndex idx = mgmt.getGraphIndex(name); registered = true; for (PropertyKey k : idx.getFieldKeys()) { SchemaStatus s = idx.getIndexStatus(k); @@ -301,7 +301,7 @@ public class ManageTitanSchema { */ public void updateIndex(DBIndex index) { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); List<PropertyKey> keys = new ArrayList<>(); boolean isNew = false; boolean isChanged = false; diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java b/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java index 7385ea5f..d6e32d2d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java @@ -34,8 +34,8 @@ import org.onap.aai.logging.LoggingContext.StatusCode; import org.onap.aai.util.AAIConfig; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; public class ScriptDriver { @@ -69,7 +69,7 @@ public class ScriptDriver { } String config = cArgs.config; AAIConfig.init(); - try (TitanGraph graph = TitanFactory.open(new AAIGraphConfig.Builder(config).forService(ScriptDriver.class.getSimpleName()).withGraphType("NA").buildConfiguration())) { + try (JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(config).forService(ScriptDriver.class.getSimpleName()).withGraphType("NA").buildConfiguration())) { if (!("oxm".equals(cArgs.type) || "graph".equals(cArgs.type))) { System.out.println("type: " + cArgs.type + " not recognized."); System.exit(1); diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java b/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java index f201a57e..c5de1d61 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java @@ -66,8 +66,8 @@ import org.onap.aai.logging.LoggingContext.StatusCode; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; public class DataGrooming { @@ -379,8 +379,8 @@ public class DataGrooming { int cleanupCandidateCount = 0; long windowStartTime = 0; // Translation of the window into a starting timestamp BufferedWriter bw = null; - TitanGraph graph = null; - TitanGraph graph2 = null; + JanusGraph graph = null; + JanusGraph graph2 = null; int deleteCount = 0; boolean executeFinalCommit = false; Set<String> deleteCandidateList = new LinkedHashSet<>(); @@ -440,10 +440,10 @@ public class DataGrooming { if( cacheDbOkFlag ){ // Since we're just reading (not deleting/fixing anything), we can use // a cached connection to the DB - graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.CACHED_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("cached").buildConfiguration()); + graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.CACHED_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("cached").buildConfiguration()); } else { - graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime1").buildConfiguration()); + graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime1").buildConfiguration()); } if (graph == null) { String emsg = "null graph object in DataGrooming\n"; @@ -771,7 +771,7 @@ public class DataGrooming { logger.debug(" ---- DEBUG --- about to open a SECOND graph (takes a little while)--------\n"); // Note - graph2 just reads - but we want it to use a fresh connection to // the database, so we are NOT using the CACHED DB CONFIG here. - graph2 = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime2").buildConfiguration()); + graph2 = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime2").buildConfiguration()); if (graph2 == null) { String emsg = "null graph2 object in DataGrooming\n"; throw new AAIException("AAI_6101", emsg); @@ -1425,7 +1425,7 @@ public class DataGrooming { } g.tx().rollback(); } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graphTransaction.rollback()", ex); @@ -1438,7 +1438,7 @@ public class DataGrooming { try { g2.tx().rollback(); } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graphTransaction2.rollback()", ex); @@ -1452,7 +1452,7 @@ public class DataGrooming { graph.close(); } } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed{ LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graph.shutdown()", ex); @@ -1464,7 +1464,7 @@ public class DataGrooming { graph2.close(); } } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed{ LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graph2.shutdown()", ex); @@ -2085,7 +2085,7 @@ public class DataGrooming { String transId, String fromAppId, GraphTraversalSource g, String version, String nType, ArrayList<Vertex> passedVertList, Loader loader) throws AAIException { - // Given a list of Titan Vertices of one nodeType (see AAI-8956), group + // Given a list of JanusGraph Vertices of one nodeType (see AAI-8956), group // them together by the parent node they depend on. // Ie. if given a list of ip address nodes (assumed to all have the // same key info) they might sit under several different parent vertices. diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java b/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java index 174b157e..9a726ec5 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java @@ -22,8 +22,8 @@ package org.onap.aai.dbgen; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.logging.LoggingContext; @@ -46,7 +46,7 @@ public class GenTester { */ public static void main(String[] args) { - TitanGraph graph = null; + JanusGraph graph = null; System.setProperty("aai.service.name", GenTester.class.getSimpleName()); // Set the logging file properties to be used by EELFManager Properties props = System.getProperties(); @@ -81,11 +81,11 @@ public class GenTester { graph = AAIGraph.getInstance().getGraph(); if( graph == null ){ - ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph."); + ErrorLogHelper.logError("AAI_5102", "Error creating JanusGraph graph."); return; } else { - String amsg = "Successfully loaded a Titan graph without doing any schema work. "; + String amsg = "Successfully loaded a JanusGraph graph without doing any schema work. "; System.out.println(amsg); LOGGER.auditEvent(amsg); return; @@ -118,17 +118,17 @@ public class GenTester { graph = AAIGraph.getInstance().getGraph(); if( graph == null ){ - ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph. "); + ErrorLogHelper.logError("AAI_5102", "Error creating JanusGraph graph. "); return; } // Load the propertyKeys, indexes and edge-Labels into the DB - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); - imsg = "-- Loading new schema elements into Titan --"; + imsg = "-- Loading new schema elements into JanusGraph --"; System.out.println(imsg); LOGGER.info(imsg); - SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt, addDefaultCR ); + SchemaGenerator.loadSchemaIntoJanusGraph( graph, graphMgt, addDefaultCR ); } catch(Exception ex) { ErrorLogHelper.logError("AAI_4000", ex.getMessage()); diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java index c8b3df50..6336edd3 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java @@ -41,11 +41,11 @@ import org.onap.aai.util.AAIConfig; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.collect.Multimap; -import com.thinkaurelius.titan.core.Cardinality; -import com.thinkaurelius.titan.core.Multiplicity; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.Cardinality; +import org.janusgraph.core.Multiplicity; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; @@ -56,24 +56,24 @@ public class SchemaGenerator{ /** - * Load schema into titan. + * Load schema into JanusGraph. * * @param graph the graph * @param graphMgmt the graph mgmt * @param addDefaultCloudRegion the add default cloud region */ - public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt, boolean addDefaultCloudRegion) { + public static void loadSchemaIntoJanusGraph(final JanusGraph graph, final JanusGraphManagement graphMgmt, boolean addDefaultCloudRegion) { addDefaultCR = addDefaultCloudRegion; - loadSchemaIntoTitan(graph, graphMgmt); + loadSchemaIntoJanusGraph(graph, graphMgmt); } /** - * Load schema into titan. + * Load schema into JanusGraph. * * @param graph the graph * @param graphMgmt the graph mgmt */ - public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt) { + public static void loadSchemaIntoJanusGraph(final JanusGraph graph, final JanusGraphManagement graphMgmt) { try { AAIConfig.init(); @@ -84,8 +84,8 @@ public class SchemaGenerator{ System.exit(1); } - // NOTE - Titan 0.5.3 doesn't keep a list of legal node Labels. - // They are only used when a vertex is actually being created. Titan 1.1 will keep track (we think). + // NOTE - JanusGraph 0.5.3 doesn't keep a list of legal node Labels. + // They are only used when a vertex is actually being created. JanusGraph 1.1 will keep track (we think). // Use EdgeRules to make sure edgeLabels are defined in the db. NOTE: the multiplicty used here is @@ -186,7 +186,7 @@ public class SchemaGenerator{ LOGGER.info(imsg); graphMgmt.commit(); - }// End of loadSchemaIntoTitan() + }// End of loadSchemaIntoJanusGraph() } 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 46fc2c6e..0a287516 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 @@ -37,15 +37,15 @@ import org.onap.aai.util.AAIConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; /** * Database Mapping class which acts as the middle man between the REST - * interface objects and Titan DB objects. This class provides methods to commit - * the objects received on the REST interface into the Titan graph database as - * vertices and edges. Transactions are also managed here by using a TitanGraph + * interface objects and JanusGraph DB objects. This class provides methods to commit + * the objects received on the REST interface into the JanusGraph graph database as + * vertices and edges. Transactions are also managed here by using a JanusGraph * object to load, commit/rollback and shutdown for each request. The data model * rules such as keys/required properties are handled by calling DBMeth methods * which are driven by a specification file in json. @@ -56,7 +56,7 @@ public class AAIGraph { private static final EELFLogger logger = EELFManager.getInstance().getLogger(AAIGraph.class); protected static final String COMPONENT = "aaidbmap"; - protected Map<String, TitanGraph> graphs = new HashMap<>(); + protected Map<String, JanusGraph> graphs = new HashMap<>(); private static final String REALTIME_DB = "realtime"; private static final String CACHED_DB = "cached"; private static boolean isInit = false; @@ -103,11 +103,11 @@ public class AAIGraph { } private void loadGraph(String name, String configPath, String serviceName) throws Exception { - // Graph being opened by TitanFactory is being placed in hashmap to be used later + // Graph being opened by JanusGraphFactory is being placed in hashmap to be used later // These graphs shouldn't be closed until the application shutdown try { PropertiesConfiguration propertiesConfiguration = new AAIGraphConfig.Builder(configPath).forService(serviceName).withGraphType(name).buildConfiguration(); - TitanGraph graph = TitanFactory.open(propertiesConfiguration); + JanusGraph graph = JanusGraphFactory.open(propertiesConfiguration); Properties graphProps = new Properties(); propertiesConfiguration.getKeys().forEachRemaining(k -> graphProps.setProperty(k, propertiesConfiguration.getString(k))); @@ -130,7 +130,7 @@ public class AAIGraph { } } - private void loadSnapShotToInMemoryGraph(TitanGraph graph, Properties graphProps) { + private void loadSnapShotToInMemoryGraph(JanusGraph graph, Properties graphProps) { if (logger.isDebugEnabled()) { logger.debug("Load Snapshot to InMemory Graph"); } @@ -153,19 +153,19 @@ public class AAIGraph { } } - private void loadSchema(TitanGraph graph) { + private void loadSchema(JanusGraph graph) { // Load the propertyKeys, indexes and edge-Labels into the DB - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); - System.out.println("-- loading schema into Titan"); - SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt ); + System.out.println("-- loading schema into JanusGraph"); + SchemaGenerator.loadSchemaIntoJanusGraph( graph, graphMgt ); } /** * Close all of the graph connections made in the instance. */ public void graphShutdown() { - graphs.values().stream().filter(TitanGraph::isOpen).forEach(TitanGraph::close); + graphs.values().stream().filter(JanusGraph::isOpen).forEach(JanusGraph::close); } /** @@ -173,7 +173,7 @@ public class AAIGraph { * * @return the graph */ - public TitanGraph getGraph() { + public JanusGraph getGraph() { return graphs.get(REALTIME_DB); } @@ -182,7 +182,7 @@ public class AAIGraph { graphs.get(this.getGraphName(connectionType)).close(); } - public TitanGraph getGraph(DBConnectionType connectionType) { + public JanusGraph getGraph(DBConnectionType connectionType) { return graphs.get(this.getGraphName(connectionType)); } diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java index 59a1453d..eff7f0ec 100644 --- a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java +++ b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java @@ -24,8 +24,8 @@ import com.att.eelf.configuration.EELFManager; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.Iterators; -import com.thinkaurelius.titan.diskstorage.configuration.ConfigElement; -import com.thinkaurelius.titan.diskstorage.configuration.backend.CommonsConfiguration; +import org.janusgraph.diskstorage.configuration.ConfigElement; +import org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.lang.StringUtils; @@ -37,10 +37,10 @@ import java.util.Iterator; import java.util.Objects; import java.util.regex.Pattern; -import static com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.*; +import static org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.*; /** - * For building a config that TitanFactory.open can use with an identifiable graph.unique-instance-id + * For building a config that JanusGraphFactory.open can use with an identifiable graph.unique-instance-id */ public class AAIGraphConfig { @@ -50,7 +50,7 @@ public class AAIGraphConfig { public PropertiesConfiguration getCc(String configPath, String graphType, String service) throws ConfigurationException, FileNotFoundException { - PropertiesConfiguration cc = this.loadTitanPropFile(configPath); + PropertiesConfiguration cc = this.loadJanusGraphPropFile(configPath); String uid = ManagementFactory.getRuntimeMXBean().getName() + "_" + service + "_" + graphType + "_" + System.currentTimeMillis(); for (char c : ConfigElement.ILLEGAL_CHARS) { @@ -63,7 +63,7 @@ public class AAIGraphConfig { } - private PropertiesConfiguration loadTitanPropFile(String shortcutOrFile) throws ConfigurationException, FileNotFoundException { + private PropertiesConfiguration loadJanusGraphPropFile(String shortcutOrFile) throws ConfigurationException, FileNotFoundException { File file = new File(shortcutOrFile); if (file.exists()) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java index e5d4c2e0..45d0bbe4 100644 --- a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java +++ b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java @@ -30,10 +30,10 @@ import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.onap.aai.dbgen.SchemaGenerator; import org.onap.aai.logging.LogFormatTools; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanTransaction; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphTransaction; +import org.janusgraph.core.schema.JanusGraphManagement; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -41,7 +41,7 @@ import com.att.eelf.configuration.EELFManager; public class InMemoryGraph { private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(InMemoryGraph.class); - private TitanGraph graph = null; + private JanusGraph graph = null; public InMemoryGraph(Builder builder) throws IOException { @@ -50,16 +50,16 @@ public class InMemoryGraph { */ InputStream is = new FileInputStream(builder.propertyFile); try { - graph = TitanFactory.open(builder.propertyFile); + graph = JanusGraphFactory.open(builder.propertyFile); Properties graphProps = new Properties(); graphProps.load(is); - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); if(builder.isSchemaEnabled){ LOGGER.info("Schema Enabled"); - SchemaGenerator.loadSchemaIntoTitan(graph, graphMgt); + SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt); } - TitanTransaction transaction = graph.newTransaction(); + JanusGraphTransaction transaction = graph.newTransaction(); LOGGER.info("Loading snapshot"); transaction.io(IoCore.graphson()).readGraph(builder.graphsonLocation); transaction.commit(); @@ -97,7 +97,7 @@ public class InMemoryGraph { } } - public TitanGraph getGraph() { + public JanusGraph getGraph() { return graph; } diff --git a/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java b/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java index eff781c3..7b125496 100644 --- a/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java +++ b/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java @@ -67,7 +67,7 @@ public class AAIExtensionMap { // ----------------------------------------------------------------------- // postExtSkipErrorCallback | java.lang.Boolean (RW) // ----------------------------------------------------------------------- - // graph | com.thinkaurelius.titan.core.TitanGraph (RW) + // graph | org.janusgraph.core.JanusGraph (RW) // ----------------------------------------------------------------------- // objectFromResponse | Object // ----------------------------------------------------------------------- diff --git a/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java b/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java index 67b46bfb..28af6a55 100644 --- a/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java +++ b/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java @@ -68,7 +68,7 @@ import org.onap.aai.restcore.HttpMethod; import org.onap.aai.schema.enums.ObjectMetadata; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.engines.query.QueryEngine; @@ -78,7 +78,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.fge.jsonpatch.JsonPatchException; import com.github.fge.jsonpatch.mergepatch.JsonMergePatch; -import com.thinkaurelius.titan.core.TitanException; +import org.janusgraph.core.JanusGraphException; +import org.onap.aai.serialization.queryformats.Format; +import org.onap.aai.serialization.queryformats.FormatFactory; +import org.onap.aai.serialization.queryformats.Formatter; /** * The Class HttpEntry. @@ -113,7 +116,7 @@ public class HttpEntry { this.queryStyle = queryStyle; this.version = version; this.loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - this.dbEngine = new TitanDBEngine( + this.dbEngine = new JanusGraphDBEngine( queryStyle, connectionType, loader); @@ -281,7 +284,7 @@ public class HttpEntry { status = Status.OK; MarshallerProperties properties; if (!request.getMarshallerProperties().isPresent()) { - properties = + properties = new MarshallerProperties.Builder(org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build(); } else { properties = request.getMarshallerProperties().get(); @@ -450,7 +453,7 @@ public class HttpEntry { responses.add(pairedResp); //break out of retry loop break; - } catch (TitanException e) { + } catch (JanusGraphException e) { this.dbEngine.rollback(); LOGGER.info ("Caught exception: " + e.getMessage()); @@ -586,9 +589,9 @@ public class HttpEntry { depth = AAIProperties.MAXIMUM_DEPTH; } } else { - if (depthParam.length() > 0 && !depthParam.equals("all")){ + if (!depthParam.isEmpty() && !"all".equals(depthParam)){ try { - depth = Integer.valueOf(depthParam); + depth = Integer.parseInt(depthParam); } catch (Exception e) { throw new AAIException("AAI_4016"); } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java index 9b57e48e..67a5edb3 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java @@ -23,7 +23,7 @@ package org.onap.aai.serialization.db; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.base.CaseFormat; -import com.thinkaurelius.titan.core.SchemaViolationException; +import org.janusgraph.core.SchemaViolationException; import org.apache.commons.collections.IteratorUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java index c90e1eee..d70a7ee7 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java @@ -19,7 +19,7 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.dbmap.DBConnectionType; @@ -58,11 +58,11 @@ public class GraphSingleton { * * @return the tx graph */ - public TitanGraph getTxGraph() { + public JanusGraph getTxGraph() { return AAIGraph.getInstance().getGraph(); } - public TitanGraph getTxGraph(DBConnectionType connectionType) { + public JanusGraph getTxGraph(DBConnectionType connectionType) { return AAIGraph.getInstance().getGraph(connectionType); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java index 369161ac..0f4c3e7d 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java @@ -21,22 +21,22 @@ package org.onap.aai.serialization.db; import org.onap.aai.dbmap.DBConnectionType; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class InMemoryGraphSingleton extends GraphSingleton { - private static TitanGraph inMemgraph; + private static JanusGraph inMemgraph; private static class Helper { private static final InMemoryGraphSingleton INSTANCE = new InMemoryGraphSingleton(); } /** - * Gets the single instance of TitanGraphSingleton. + * Gets the single instance of JanusGraphSingleton. * - * @return single instance of TitanGraphSingleton + * @return single instance of JanusGraphSingleton */ - public static InMemoryGraphSingleton getInstance(TitanGraph graph) { + public static InMemoryGraphSingleton getInstance(JanusGraph graph) { inMemgraph = graph; return Helper.INSTANCE; } @@ -47,12 +47,12 @@ public class InMemoryGraphSingleton extends GraphSingleton { * @return the tx graph */ @Override - public TitanGraph getTxGraph() { + public JanusGraph getTxGraph() { return inMemgraph; } @Override - public TitanGraph getTxGraph(DBConnectionType connectionType) { + public JanusGraph getTxGraph(DBConnectionType connectionType) { return inMemgraph; } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/TitanGraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/JanusGraphSingleton.java index 4c1f3181..4513d107 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/TitanGraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/JanusGraphSingleton.java @@ -20,18 +20,18 @@ package org.onap.aai.serialization.db; /* This is class is just a wrapper of its parent */ -public class TitanGraphSingleton extends GraphSingleton { +public class JanusGraphSingleton extends GraphSingleton { private static class Helper { - private static final TitanGraphSingleton INSTANCE = new TitanGraphSingleton(); + private static final JanusGraphSingleton INSTANCE = new JanusGraphSingleton(); } /** - * Gets the single instance of TitanGraphSingleton. + * Gets the single instance of JanusGraphSingleton. * - * @return single instance of TitanGraphSingleton + * @return single instance of JanusGraphSingleton */ - public static TitanGraphSingleton getInstance() { + public static JanusGraphSingleton getInstance() { return Helper.INSTANCE; } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java index a7aef9da..ec52a002 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java @@ -22,6 +22,7 @@ package org.onap.aai.serialization.engines; import java.util.ArrayList; import java.util.Iterator; import java.util.List; + import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -39,29 +40,29 @@ import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine; import org.onap.aai.serialization.engines.query.QueryEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class InMemoryDBEngine extends TransactionalGraphEngine { /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style * the style * @param loader * the loader */ - private TitanGraph graph = null; + private JanusGraph graph = null; private static final TransactionalGraphEngine.Admin admin = null; - public InMemoryDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader, TitanGraph graph) { + public InMemoryDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader, JanusGraph graph) { super(style, loader, connectionType, InMemoryGraphSingleton.getInstance(graph)); this.graph = graph; } /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style * the style @@ -70,7 +71,7 @@ public class InMemoryDBEngine extends TransactionalGraphEngine { * @param connect * the connect */ - public InMemoryDBEngine(QueryStyle style, Loader loader, boolean connect, TitanGraph graph) { + public InMemoryDBEngine(QueryStyle style, Loader loader, boolean connect, JanusGraph graph) { super(style, loader); if (connect) { this.singleton = InMemoryGraphSingleton.getInstance(graph); diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/TitanDBEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/JanusGraphDBEngine.java index 4c6cb675..c12aa603 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/TitanDBEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/JanusGraphDBEngine.java @@ -27,31 +27,31 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; -import org.onap.aai.serialization.db.TitanGraphSingleton; +import org.onap.aai.serialization.db.JanusGraphSingleton; -public class TitanDBEngine extends TransactionalGraphEngine { +public class JanusGraphDBEngine extends TransactionalGraphEngine { /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style the style * @param loader the loader */ - public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) { - super(style, loader, connectionType, TitanGraphSingleton.getInstance()); + public JanusGraphDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) { + super(style, loader, connectionType, JanusGraphSingleton.getInstance()); } /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style the style * @param loader the loader * @param connect the connect */ - public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) { + public JanusGraphDBEngine(QueryStyle style, Loader loader, boolean connect) { super(style, loader); if (connect) { - this.singleton = TitanGraphSingleton.getInstance(); + this.singleton = JanusGraphSingleton.getInstance(); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java index f300bd26..8eedf00d 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java @@ -19,9 +19,6 @@ */ package org.onap.aai.serialization.engines; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -36,8 +33,11 @@ import org.onap.aai.serialization.db.GraphSingleton; import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine; import org.onap.aai.serialization.engines.query.QueryEngine; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; + +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; public abstract class TransactionalGraphEngine { @@ -97,7 +97,7 @@ public abstract class TransactionalGraphEngine { * * @return the graph */ - private TitanGraph getGraph() { + private JanusGraph getGraph() { return singleton.getTxGraph(this.connectionType); } @@ -237,7 +237,7 @@ public abstract class TransactionalGraphEngine { return readOnlyTraversal; } - public TitanManagement getManagementSystem() { + public JanusGraphManagement getManagementSystem() { return getGraph().openManagement(); } } 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 3b803b49..4e69c9c2 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 @@ -21,7 +21,7 @@ package org.onap.aai.serialization.queryformats; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; +import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; @@ -33,7 +33,7 @@ import java.io.OutputStream; public class GraphSON implements FormatMapper { - private final GraphSONMapper mapper = GraphSONMapper.build().addRegistry(TitanIoRegistry.INSTANCE).create(); + private final GraphSONMapper mapper = GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create(); private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create(); protected JsonParser parser = new JsonParser(); diff --git a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java index 181b499d..f438d16b 100644 --- a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java +++ b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java @@ -41,8 +41,8 @@ public final class AAIConstants { public static final String AAI_AUTH_CONFIG_FILENAME = AAI_HOME_ETC_AUTH + "aai_policy.json"; public static final String AAI_MECHID_CONFIG_FILENAME = AAI_HOME_ETC_APP_PROPERTIES + "mechIds.json"; public static final String AAI_HOME_ETC_QUERY = AAI_HOME_ETC + "query" + AAI_FILESEP + "stored-queries.properties"; - public static final String REALTIME_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-realtime.properties"; - public static final String CACHED_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-cached.properties"; + public static final String REALTIME_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "janusgraph-realtime.properties"; + public static final String CACHED_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "janusgraph-cached.properties"; public static final String AAI_HOME_ETC_OXM = AAI_HOME_ETC + "oxm" + AAI_FILESEP; public static final String AAI_EVENT_DMAAP_PROPS = AAI_HOME_ETC_APP_PROPERTIES + "aaiEventDMaaPPublisher.properties"; public static final String AAI_HOME_ETC_SCRIPT = AAI_HOME_ETC + AAI_FILESEP + "scriptdata" + AAI_FILESEP; diff --git a/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java b/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java index 512ac755..bfa0f3a1 100644 --- a/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java +++ b/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java @@ -37,8 +37,8 @@ import org.slf4j.MDC; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.onap.aai.dbmap.AAIGraphConfig; public class UniquePropertyCheck { @@ -87,12 +87,12 @@ public class UniquePropertyCheck { try { AAIConfig.init(); System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n"); - TitanGraph tGraph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(UniquePropertyCheck.class.getSimpleName()).withGraphType("realtime").buildConfiguration()); + JanusGraph tGraph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(UniquePropertyCheck.class.getSimpleName()).withGraphType("realtime").buildConfiguration()); if( tGraph == null ) { LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); - logAndPrint(logger, " Error: Could not get TitanGraph "); + logAndPrint(logger, " Error: Could not get JanusGraph "); System.exit(1); } diff --git a/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java b/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java index ff7d44b6..ce5406a6 100644 --- a/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java +++ b/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java @@ -287,12 +287,6 @@ public class YAMLfromOXM extends OxmFileProcessor { for ( int k = 0; addTypeV != null && k < addTypeV.size(); ++k ) { String addType = addTypeV.elementAt(k); logger.debug("addType: "+ addType); - if(addType == "overloaded-model" || addType.equals("OverloadedModel") || addType == "owning-entity") { - logger.debug("Description check: "+ addType+"opId="+opId+" itemName=none"); -// Log.info("Element name="+xmlElementElement.getAttribute("name")); - } - - if ( opId == null || !opId.contains(addType)) { processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, null, |