Merge "Fix sonar issues in SchemaGenerator"
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / dbmap / InMemoryGraph.java
index 61b4e36..3f002ff 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
 package org.onap.aai.dbmap;
 
@@ -27,15 +25,14 @@ import java.io.InputStream;
 
 import java.util.Properties;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
 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;
@@ -43,7 +40,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  {
@@ -52,16 +49,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(graphMgt);
             }
-                       TitanTransaction transaction = graph.newTransaction();
+                       JanusGraphTransaction transaction = graph.newTransaction();
                        LOGGER.info("Loading snapshot");
                        transaction.io(IoCore.graphson()).readGraph(builder.graphsonLocation);
                        transaction.commit();
@@ -99,7 +96,7 @@ public class InMemoryGraph {
                }
        }
 
-       public TitanGraph getGraph() {
+       public JanusGraph getGraph() {
                return graph;
        }