summaryrefslogtreecommitdiffstats
path: root/asdctool/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src/main/java')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java10
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java10
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java30
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java63
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java4
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java80
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java (renamed from asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java)36
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java22
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy66
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java22
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java33
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java44
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java83
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java29
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java13
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java9
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java6
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java6
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java16
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java8
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java2
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java2
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java79
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java59
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java66
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java23
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java34
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java34
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java42
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java (renamed from asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java)36
30 files changed, 529 insertions, 438 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
index 5c7d78e3f2..44bfc536b6 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/Utils.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.asdctool;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
@@ -60,12 +60,12 @@ public class Utils {
return responseBuilder.build();
}
- public static TitanGraph openGraph(Configuration conf) {
+ public static JanusGraph openGraph(Configuration conf) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- graph = TitanFactory.open(conf);
+ graph = JanusGraphFactory.open(conf);
} catch (Exception e) {
log.error("Failed to start open graph", e);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
index e411b53c08..53d299e163 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/GetConsumersConfiguration.java
@@ -1,20 +1,20 @@
package org.openecomp.sdc.asdctool.configuration;
-import org.openecomp.sdc.be.dao.config.TitanSpringConfig;
-import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
-@Import({TitanSpringConfig.class})
+@Import({JanusGraphSpringConfig.class})
public class GetConsumersConfiguration {
@Bean("consumer-operation")
- public ConsumerOperation consumerOperation(TitanGenericDao titanGenericDao) {
- return new ConsumerOperation(titanGenericDao);
+ public ConsumerOperation consumerOperation(JanusGraphGenericDao janusGraphGenericDao) {
+ return new ConsumerOperation(janusGraphGenericDao);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
index 0dd078d863..5a82c697c7 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java
@@ -1,10 +1,10 @@
package org.openecomp.sdc.asdctool.configuration;
import org.openecomp.sdc.asdctool.impl.VrfObjectFixHandler;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,24 +13,26 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class VrfObjectFixConfiguration {
- @Bean(name = "titan-dao")
- public TitanDao titanDao(@Qualifier("titan-client") TitanGraphClient titanClient){
- return new TitanDao(titanClient);
+ @Bean(name = "janusgraph-dao")
+ public JanusGraphDao janusGraphDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient){
+ return new JanusGraphDao(janusGraphClient);
}
- @Bean(name = "titan-client")
+ @Bean(name = "janusgraph-client")
@Primary
- public TitanGraphClient titanClient(@Qualifier("dao-client-strategy") TitanClientStrategy titanClientStrategy) {
- return new TitanGraphClient(titanClientStrategy);
+ public JanusGraphClient janusGraphClient(@Qualifier("dao-client-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
}
@Bean(name ="dao-client-strategy")
- public TitanClientStrategy titanClientStrategy() {
- return new DAOTitanStrategy();
+ public JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
}
@Bean
- public VrfObjectFixHandler vrfObjectFixHandler(@Qualifier("titan-dao") TitanDao titanDao){
- return new VrfObjectFixHandler(titanDao);
+ public VrfObjectFixHandler vrfObjectFixHandler(@Qualifier("janusgraph-dao")
+ JanusGraphDao janusGraphDao){
+ return new VrfObjectFixHandler(janusGraphDao);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 03f3e41bd9..cd19c1cbf0 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -8,12 +8,12 @@ import org.openecomp.sdc.asdctool.impl.validator.utils.VfModuleArtifactPayloadEx
import org.openecomp.sdc.be.components.distribution.engine.VfModuleArtifactPayload;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
@@ -25,10 +25,10 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -71,7 +71,7 @@ public class ArtifactUuidFix {
private static final String UTF8 = "utf-8";
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -140,7 +140,7 @@ public class ArtifactUuidFix {
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
log.info("Try to fetch resources with properties {} and not {}", hasProps, hasNotProps);
- Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao
+ Either<List<GraphVertex>, JanusGraphOperationStatus> servicesByCriteria = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll);
if (servicesByCriteria.isRight()) {
log.info("Failed to fetch resources {}", servicesByCriteria.right().value());
@@ -182,14 +182,14 @@ public class ArtifactUuidFix {
writeModuleResultToFile(writer, resource, null);
writer.flush();
}
- titanDao.commit();
+ janusGraphDao.commit();
}
} catch (Exception e) {
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -228,7 +228,7 @@ public class ArtifactUuidFix {
writer.flush();
}
- titanDao.commit();
+ janusGraphDao.commit();
}
}
}
@@ -237,7 +237,7 @@ public class ArtifactUuidFix {
log.info("Failed to fetch services ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -259,7 +259,7 @@ public class ArtifactUuidFix {
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
log.info("Try to fetch services with properties {} and not {}", hasProps, hasNotProps);
- Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao
+ Either<List<GraphVertex>, JanusGraphOperationStatus> servicesByCriteria = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll);
if (servicesByCriteria.isRight()) {
log.info("Failed to fetch services {}", servicesByCriteria.right().value());
@@ -290,14 +290,14 @@ public class ArtifactUuidFix {
}
- titanDao.commit();
+ janusGraphDao.commit();
}
log.info("output file with list of services : {}", fileName);
} catch (Exception e) {
log.info("Failed to fetch services ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return true;
}
@@ -608,7 +608,7 @@ public class ArtifactUuidFix {
res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS,
EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts);
}
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(component);
}
@@ -639,7 +639,7 @@ public class ArtifactUuidFix {
res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS,
EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts);
}
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(component);
}
@@ -660,7 +660,7 @@ public class ArtifactUuidFix {
} catch (IOException e) {
log.error(e.getMessage());
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
log.info(" Fix finished with res {} ***** ", res);
return res;
@@ -688,7 +688,7 @@ public class ArtifactUuidFix {
Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts();
res = fixDataOnGraph(c.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, EdgeLabelEnum.TOSCA_ARTIFACTS,
arifacts);
- titanDao.commit();
+ janusGraphDao.commit();
} else {
failedList.add(c);
}
@@ -737,9 +737,9 @@ public class ArtifactUuidFix {
}
} finally {
if (res)
- titanDao.commit();
+ janusGraphDao.commit();
else
- titanDao.rollback();
+ janusGraphDao.rollback();
}
log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent finished component name {} id {} res {}",
c.getName(), c.getUniqueId(), res);
@@ -751,7 +751,7 @@ public class ArtifactUuidFix {
log.debug("amount groups to update: VertexTypeEnum {} EdgeLabelEnum {} data size {}", vertexTypeEnum.getName(),
edgeLabelEnum, groups.size());
boolean res = true;
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentId,
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao.getVertexById(componentId,
JsonParseFlagEnum.NoParse);
if (getResponse.isRight()) {
log.debug("Couldn't fetch component unique id {}, error: {}", componentId, getResponse.right().value());
@@ -762,9 +762,9 @@ public class ArtifactUuidFix {
GraphVertex componentVertex = getResponse.left().value();
GraphVertex toscaDataVertex = null;
- Either<GraphVertex, TitanOperationStatus> groupVertexEither = titanDao.getChildVertex(componentVertex,
+ Either<GraphVertex, JanusGraphOperationStatus> groupVertexEither = janusGraphDao.getChildVertex(componentVertex,
edgeLabelEnum, JsonParseFlagEnum.ParseJson);
- if (groupVertexEither.isRight() && groupVertexEither.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (groupVertexEither.isRight() && groupVertexEither.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
log.debug("no child {} vertex for component unique id {}, error: {}", edgeLabelEnum, componentId,
groupVertexEither.right().value());
return true;
@@ -777,11 +777,11 @@ public class ArtifactUuidFix {
if (res) {
toscaDataVertex = groupVertexEither.left().value();
toscaDataVertex.setJson(groups);
- Either<GraphVertex, TitanOperationStatus> updatevertexEither = titanDao.updateVertex(toscaDataVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updatevertexEither = janusGraphDao.updateVertex(toscaDataVertex);
if (updatevertexEither.isRight()) {
log.debug("failed to update vertex for component unique id {}, error: {}", componentId,
updatevertexEither.right().value());
- titanDao.rollback();
+ janusGraphDao.rollback();
return false;
}
}
@@ -1081,7 +1081,8 @@ public class ArtifactUuidFix {
Map<String, List<Component>> result = new HashMap<>();
try {
- Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resultsEither = janusGraphDao
+ .getByCriteria(type, hasProps);
if (resultsEither.isRight()) {
log.error("getVerticesToValidate failed {} ",resultsEither.right().value());
return result;
@@ -1107,7 +1108,7 @@ public class ArtifactUuidFix {
} else {
compList.add(toscaElement.left().value());
}
- titanDao.commit();
+ janusGraphDao.commit();
});
@@ -1115,7 +1116,7 @@ public class ArtifactUuidFix {
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
@@ -1161,7 +1162,7 @@ public class ArtifactUuidFix {
} else {
compListfull.add(toscaElement.left().value());
}
- this.titanDao.commit();
+ this.janusGraphDao.commit();
}
compToFix.put(entry.getKey(), compListfull);
@@ -1174,7 +1175,7 @@ public class ArtifactUuidFix {
log.info(FAILED_TO_FETCH_VF_RESOURCES, e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
index b404404bc6..57a7c251aa 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidator.java
@@ -33,13 +33,13 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * simple util class to verify that the titan export json graph is not corrupted
+ * simple util class to verify that the janusgraph export json graph is not corrupted
*/
public class GraphJsonValidator {
private static Logger log = Logger.getLogger(GraphJsonValidator.class.getName());
- public boolean verifyTitanJson(String filePath) throws IOException {
+ public boolean verifyJanusGraphJson(String filePath) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
List<Integer> invalidRows = new ArrayList<>();
AtomicInteger atomicInteger = new AtomicInteger(1);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
index d43b3b8fcd..ee33c82da4 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLConverter.java
@@ -21,11 +21,11 @@
package org.openecomp.sdc.asdctool.impl;
import com.google.gson.Gson;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphQuery;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.*;
@@ -79,11 +79,11 @@ public class GraphMLConverter {
public boolean importGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String inputFile = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
List<ImmutablePair<String, String>> propertiesCriteriaToDelete = new ArrayList<>();
ImmutablePair<String, String> immutablePair1 = new ImmutablePair<>("healthcheckis", "GOOD");
@@ -113,11 +113,11 @@ public class GraphMLConverter {
public boolean exportGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = exportJsonGraph(graph, outputDirectory);
@@ -140,12 +140,12 @@ public class GraphMLConverter {
public String exportGraphMl(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
String result = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
result = exportGraphMl(graph, outputDirectory);
@@ -164,11 +164,11 @@ public class GraphMLConverter {
public boolean findErrorInJsonGraph(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = findErrorInJsonGraph(graph, outputDirectory);
@@ -189,13 +189,13 @@ public class GraphMLConverter {
return true;
}
- public TitanGraph openGraph(String titanFileLocation) {
+ public JanusGraph openGraph(String janusGraphFileLocation) {
- return TitanFactory.open(titanFileLocation);
+ return JanusGraphFactory.open(janusGraphFileLocation);
}
- public String exportJsonGraph(TitanGraph graph, String outputDirectory) {
+ public String exportJsonGraph(JanusGraph graph, String outputDirectory) {
String result = null;
@@ -231,7 +231,7 @@ public class GraphMLConverter {
}
- public String exportGraphMl(TitanGraph graph, String outputDirectory) {
+ public String exportGraphMl(JanusGraph graph, String outputDirectory) {
String result = null;
String outputFile = outputDirectory + File.separator + EXPORT_GRAPH + System.currentTimeMillis() + ".graphml";
try {
@@ -253,7 +253,7 @@ public class GraphMLConverter {
return builder.create();
}
- public boolean importJsonGraph(TitanGraph graph, String graphJsonFile,
+ public boolean importJsonGraph(JanusGraph graph, String graphJsonFile,
List<ImmutablePair<String, String>> propertiesCriteriaToDelete) {
boolean result = false;
@@ -312,7 +312,7 @@ public class GraphMLConverter {
}
- public String findErrorInJsonGraph(TitanGraph graph, String outputDirectory) {
+ public String findErrorInJsonGraph(JanusGraph graph, String outputDirectory) {
boolean runVertexScan = false;
boolean runEdgeScan = false;
@@ -331,8 +331,8 @@ public class GraphMLConverter {
Vertex vertexTo = null;
Edge edge = null;
- Iterable<TitanEdge> edges = graph.query().edges();
- Iterator<TitanEdge> iterator = edges.iterator();
+ Iterable<JanusGraphEdge> edges = graph.query().edges();
+ Iterator<JanusGraphEdge> iterator = edges.iterator();
while (iterator.hasNext()) {
try {
@@ -344,12 +344,12 @@ public class GraphMLConverter {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty(STORAGE_BACKEND, INMEMORY);
- TitanGraph openGraph = Utils.openGraph(conf);
+ JanusGraph openGraph = Utils.openGraph(conf);
- TitanVertex addVertexFrom = openGraph.addVertex();
+ JanusGraphVertex addVertexFrom = openGraph.addVertex();
Utils.setProperties(addVertexFrom, Utils.getProperties(vertexFrom));
- TitanVertex addVertexTo = openGraph.addVertex();
+ JanusGraphVertex addVertexTo = openGraph.addVertex();
Utils.setProperties(addVertexTo, Utils.getProperties(vertexTo));
Edge addEdge = addVertexFrom.addEdge(edge.label(), addVertexTo);
@@ -394,9 +394,9 @@ public class GraphMLConverter {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty(STORAGE_BACKEND, INMEMORY);
- TitanGraph openGraph = Utils.openGraph(conf);
+ JanusGraph openGraph = Utils.openGraph(conf);
- TitanVertex addVertexFrom = openGraph.addVertex();
+ JanusGraphVertex addVertexFrom = openGraph.addVertex();
Utils.setProperties(addVertexFrom, Utils.getProperties(vertex));
log.info(FROM_VERTEX, Utils.getProperties(addVertexFrom));
@@ -426,7 +426,7 @@ public class GraphMLConverter {
}
- Iterable<TitanVertex> vertices2 = graph.query()
+ Iterable<JanusGraphVertex> vertices2 = graph.query()
.has(GraphPropertiesDictionary.HEALTH_CHECK.getProperty(), "GOOD").vertices();
;
@@ -458,17 +458,17 @@ public class GraphMLConverter {
}
- private void removeNodesByLabel(TitanGraph graph, String label) {
- Iterable<TitanVertex> vertices = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), label)
+ private void removeNodesByLabel(JanusGraph graph, String label) {
+ Iterable<JanusGraphVertex> vertices = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), label)
.vertices();
- Iterator<TitanVertex> iterator = vertices.iterator();
+ Iterator<JanusGraphVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex next2 = iterator.next();
next2.remove();
}
}
- public String exportUsers(TitanGraph graph, String outputDirectory) {
+ public String exportUsers(JanusGraph graph, String outputDirectory) {
List<Map<String, Object>> users = new ArrayList<>();
String result = null;
@@ -478,11 +478,11 @@ public class GraphMLConverter {
FileWriter fileWriter = null;
try {
- TitanGraphQuery graphQuery = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(),
+ JanusGraphQuery graphQuery = graph.query().has(GraphPropertiesDictionary.LABEL.getProperty(),
NodeTypeEnum.User.getName());
@SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertices = graphQuery.vertices();
+ Iterable<JanusGraphVertex> vertices = graphQuery.vertices();
if (vertices != null) {
for (Vertex v : vertices) {
@@ -538,11 +538,11 @@ public class GraphMLConverter {
public boolean exportUsers(String[] args) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
try {
- String titanFileLocation = args[1];
+ String janusGraphFileLocation = args[1];
String outputDirectory = args[2];
- graph = openGraph(titanFileLocation);
+ graph = openGraph(janusGraphFileLocation);
String result = exportUsers(graph, outputDirectory);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java
index 8b89cc2706..fbebe2cd27 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanGraphInitializer.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/JanusGraphInitializer.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.*;
-import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
-import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
+import org.janusgraph.core.*;
+import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
@@ -43,34 +43,34 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-public class TitanGraphInitializer {
+public class JanusGraphInitializer {
- private static Logger logger = LoggerFactory.getLogger(TitanGraphInitializer.class.getName());
- private static TitanGraph graph;
+ private static Logger logger = LoggerFactory.getLogger(JanusGraphInitializer.class.getName());
+ private static JanusGraph graph;
- public static boolean createGraph(String titanCfgFile) {
- logger.info("** createGraph with {}", titanCfgFile);
+ public static boolean createGraph(String janusGraphCfgFile) {
+ logger.info("** createGraph with {}", janusGraphCfgFile);
try {
- logger.info("createGraph : try to load file {}", titanCfgFile);
- graph = TitanFactory.open(titanCfgFile);
+ logger.info("createGraph : try to load file {}", janusGraphCfgFile);
+ graph = JanusGraphFactory.open(janusGraphCfgFile);
if (graph.isClosed()) {
return false;
}
- } catch (TitanException e) {
- logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile, e);
+ } catch (JanusGraphException e) {
+ logger.info("createGraph : failed to open JanusGraph graph with configuration file: {}", janusGraphCfgFile, e);
return false;
}
createIndexesAndDefaults();
- logger.info("** Titan graph created ");
+ logger.info("** JanusGraph graph created ");
return true;
}
private static boolean isVertexExist(Map<String, Object> properties) {
- TitanGraphQuery query = graph.query();
+ JanusGraphQuery query = graph.query();
if (properties != null && !properties.isEmpty()) {
for (Map.Entry<String, Object> entry : properties.entrySet()) {
@@ -127,8 +127,8 @@ public class TitanGraphInitializer {
private static void createVertexIndixes() {
logger.info("** createVertexIndixes started");
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
+ JanusGraphManagement graphMgt = graph.openManagement();
+ JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
@@ -170,7 +170,7 @@ public class TitanGraphInitializer {
private static void createEdgeIndixes() {
logger.info("** createEdgeIndixes started");
- TitanManagement graphMgt = graph.openManagement();
+ JanusGraphManagement graphMgt = graph.openManagement();
for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
index d8b8936dca..883f5e50f4 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ProductLogic.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -39,10 +39,10 @@ public class ProductLogic {
private static Logger log = Logger.getLogger(ProductLogic.class.getName());
- public boolean deleteAllProducts(String titanFile, String beHost, String bePort, String adminUser) {
+ public boolean deleteAllProducts(String janusGraphFile, String beHost, String bePort, String adminUser) {
log.debug("retrieving all products from graph");
RestUtils restUtils = null;
- List<String> productList = getAllProducts(titanFile);
+ List<String> productList = getAllProducts(janusGraphFile);
restUtils = new RestUtils();
if (productList != null) {
for (String productUid : productList) {
@@ -56,15 +56,15 @@ public class ProductLogic {
}
}
- private List<String> getAllProducts(String titanFile) {
- TitanGraph graph = null;
+ private List<String> getAllProducts(String janusGraphFile) {
+ JanusGraph graph = null;
try {
- graph = openGraph(titanFile);
+ graph = openGraph(janusGraphFile);
List<String> productsToDelete = new ArrayList<String>();
Iterable vertices = graph.query()
.has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName()).vertices();
if (vertices != null) {
- Iterator<TitanVertex> iter = vertices.iterator();
+ Iterator<JanusGraphVertex> iter = vertices.iterator();
while (iter.hasNext()) {
Vertex vertex = iter.next();
String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
@@ -88,9 +88,9 @@ public class ProductLogic {
}
}
- private TitanGraph openGraph(String titanFileLocation) {
+ private JanusGraph openGraph(String janusGraphFileLocation) {
- return TitanFactory.open(titanFileLocation);
+ return JanusGraphFactory.open(janusGraphFileLocation);
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy
new file mode 100644
index 0000000000..9c69a781c1
--- /dev/null
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/TitanToJanusGraphMigration.groovy
@@ -0,0 +1,66 @@
+/*
+ * Before starting the migration, please make sure to create a backup of sdctitan keyspace in cassandra
+ *
+ * Usage Instructions :
+ * 1. Download JanusGraph gremlin in-built package from below URL;
+ * https://github.com/JanusGraph/janusgraph/releases/download/v0.3.1/janusgraph-0.3.1-hadoop2.zip
+ * 2. Unzip it and navigate to bin folder.
+ * 3. Run below command.
+ * Command : ./gremlin.sh -l <LOG_LEVEL> -e <Path_To_This_Script_File> <Path_To_Properties_File>
+ * Example : ./gremlin.sh -l ERROR -e /data/scripts/TitanToJanusGraphMigration.groovy /data/scripts/titan.properties
+ *
+ * Note: Please make sure that the above provided property file have the below field present;
+ * graph.allow-upgrade=true
+*/
+
+// Check for open database connections; should be only one
+def Object checkAndCloseMultipleInstances(Object mgmt, Object graph, long sleepTime){
+ if(mgmt.getOpenInstances().size() > 1) {
+ for (String instanceId in mgmt.getOpenInstances())
+ if(!instanceId.contains("current"))
+ mgmt.forceCloseInstance(instanceId);
+ mgmt.commit();
+ sleep(sleepTime);
+ mgmt = graph.openManagement();
+ }
+ return mgmt;
+}
+
+// Update the ID Store
+def updateGraphIDStore(Object mgmt, long sleepTime){
+ mgmt.set('ids.store-name', 'titan_ids');
+ mgmt.commit();
+ sleep(sleepTime);
+}
+
+// Verify the ID Store
+def verifyUpdatedGraphIDStore(String propertyPath){
+ graph = JanusGraphFactory.open(propertyPath);
+ mgmt = graph.openManagement();
+ if(!mgmt.get('ids.store-name').equals("titan_ids"))
+ throw new GroovyRuntimeException("FAILURE -> Error in setting up the ID Store to titan_ids; please contact system administrator... ");
+ else
+ println("SUCCESS -> Titan ID Store has also been set correctly... ");
+}
+
+try {
+ graph = JanusGraphFactory.open(args[0]);
+ mgmt = graph.openManagement();
+
+ // Check if titan graph is upgraded to Janus Graph compatibility
+ if(mgmt.get('graph.titan-version').equals("1.0.0"))
+ throw new GroovyRuntimeException("FAILURE -> Titan graph is not upgraded to Janus. please make sure graph.allow-upgrade property is set to true in properties file and re-run the script.");
+ println("SUCCESS -> Titan Graph data is upgraded to Janus compatible Graph... ");
+
+ // Update the ID Store if required
+ if(mgmt.get('ids.store-name').equals("janusgraph_ids")){
+ mgmt = checkAndCloseMultipleInstances(mgmt, graph,2000l);
+ updateGraphIDStore(mgmt, 2000l);
+ verifyUpdatedGraphIDStore(args[0]);
+ }
+ println("SUCCESS -> Titan to Janus Graph upgrade process is now complete... ");
+
+} catch(Exception ex){
+ println("FAILURE -> Titan to Janus Graph migration process has failed; please check the exception trace for more details.");
+ throw ex;
+}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
index 774af480ee..9911fb73f3 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/UpdatePropertyOnVertex.java
@@ -20,9 +20,9 @@
package org.openecomp.sdc.asdctool.impl;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphQuery;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.Utils;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
@@ -38,21 +38,21 @@ public class UpdatePropertyOnVertex {
private static Logger log = Logger.getLogger(UpdatePropertyOnVertex.class.getName());
- public Integer updatePropertyOnServiceAtLeastCertified(String titanFile, Map<String, Object> keyValueToSet,
+ public Integer updatePropertyOnServiceAtLeastCertified(String janusGraphFile, Map<String, Object> keyValueToSet,
List<Map<String, Object>> orCriteria) {
- TitanGraph graph = null;
+ JanusGraph graph = null;
Integer numberOfUpdatedVertexes = 0;
try {
- graph = openGraph(titanFile);
+ graph = openGraph(janusGraphFile);
if (orCriteria != null && false == orCriteria.isEmpty()) {
for (Map<String, Object> criteria : orCriteria) {
- TitanGraphQuery<? extends TitanGraphQuery> query = graph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> query = graph.query();
if (criteria != null && !criteria.isEmpty()) {
for (Map.Entry<String, Object> entry : criteria.entrySet()) {
@@ -112,10 +112,10 @@ public class UpdatePropertyOnVertex {
}
- private Integer updateVertexes(Map<String, Object> keyValueToSet, TitanGraph graph, Map<String, Object> criteria) {
+ private Integer updateVertexes(Map<String, Object> keyValueToSet, JanusGraph graph, Map<String, Object> criteria) {
Integer numberOfUpdatedVertexesPerService = 0;
- TitanGraphQuery<? extends TitanGraphQuery> updateQuery = graph.query();
+ JanusGraphQuery<? extends JanusGraphQuery> updateQuery = graph.query();
if (criteria != null && !criteria.isEmpty()) {
for (Map.Entry<String, Object> entry : criteria.entrySet()) {
@@ -159,9 +159,9 @@ public class UpdatePropertyOnVertex {
return numberOfUpdatedVertexesPerService;
}
- public TitanGraph openGraph(String titanFileLocation) {
+ public JanusGraph openGraph(String janusGraphFileLocation) {
- TitanGraph graph = TitanFactory.open(titanFileLocation);
+ JanusGraph graph = JanusGraphFactory.open(janusGraphFileLocation);
return graph;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
index 8eec51071f..1c7afef1c3 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java
@@ -6,18 +6,18 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.migration.tasks.handlers.XlsOutputHandler;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -42,10 +42,10 @@ public class VrfObjectFixHandler {
private XlsOutputHandler outputHandler;
private final String sheetName = this.getClass().getSimpleName() + "Report";
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public VrfObjectFixHandler(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public VrfObjectFixHandler(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
public boolean handle(String mode, String outputPath) {
@@ -65,10 +65,10 @@ public class VrfObjectFixHandler {
try{
Map<GraphVertex,Map<Vertex, List<ComponentInstanceDataDefinition>>> corruptedData = fetchCorruptedData();
corruptedData.forEach(this::fixCorruptedVfrObjectAndRelatedInstances);
- titanDao.commit();
+ janusGraphDao.commit();
writeOutput(corruptedData);
} catch (Exception e){
- titanDao.rollback();
+ janusGraphDao.rollback();
log.debug("#fixCorruptedData - Failed to detect corrupted data. The exception occurred: ", e);
return false;
}
@@ -93,7 +93,7 @@ public class VrfObjectFixHandler {
private void fixCorruptedVfrObject(GraphVertex vfrObjectV) {
vfrObjectV.getMetadataProperties().put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, VALID_TOSCA_NAME);
- titanDao.updateVertex(vfrObjectV).left().on(this::rightOnUpdate);
+ janusGraphDao.updateVertex(vfrObjectV).left().on(this::rightOnUpdate);
}
private Map<GraphVertex,Map<Vertex,List<ComponentInstanceDataDefinition>>> fetchCorruptedData(){
@@ -106,7 +106,7 @@ public class VrfObjectFixHandler {
private List<GraphVertex> getCorruptedVrfObjects() {
Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class);
props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, "org.openecomp.resource.configuration.VRFObject");
- return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, props).left().on(this::rightOnGet);
+ return janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, props).left().on(this::rightOnGet);
}
private void fillCorruptedData(GraphVertex vrfObjectV, Map<GraphVertex, Map<Vertex, List<ComponentInstanceDataDefinition>>> findToUpdate) {
@@ -115,7 +115,8 @@ public class VrfObjectFixHandler {
Iterator<Edge> instanceEdges = vrfObjectV.getVertex().edges(Direction.IN, EdgeLabelEnum.INSTANCE_OF.name());
while(instanceEdges.hasNext()){
Edge edge = instanceEdges.next();
- putCorruptedInstances(corruptedInstances, edge, (List<String>) titanDao.getProperty(edge, EdgePropertyEnum.INSTANCES));
+ putCorruptedInstances(corruptedInstances, edge, (List<String>) janusGraphDao
+ .getProperty(edge, EdgePropertyEnum.INSTANCES));
}
}
@@ -139,7 +140,7 @@ public class VrfObjectFixHandler {
String jsonMetadataStr = JsonParserUtils.toJson(jsonObj);
container.property(GraphPropertyEnum.JSON.getProperty(), jsonMetadataStr);
} catch (IOException e) {
- throw new StorageException("Failed to fix the corrupted instances of the container", e, TitanOperationStatus.GENERAL_ERROR);
+ throw new StorageException("Failed to fix the corrupted instances of the container", e, JanusGraphOperationStatus.GENERAL_ERROR);
}
}
@@ -159,7 +160,7 @@ public class VrfObjectFixHandler {
private Map getJsonMap(Vertex container) {
String json = (String)container.property(GraphPropertyEnum.JSON.getProperty()).value();
- Map<GraphPropertyEnum, Object> properties = titanDao.getVertexProperties(container);
+ Map<GraphPropertyEnum, Object> properties = janusGraphDao.getVertexProperties(container);
VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL)));
return JsonParserUtils.toMap(json, label != null ? label.getClassOfJson() : null);
}
@@ -175,13 +176,13 @@ public class VrfObjectFixHandler {
}
}
- private List<GraphVertex> rightOnGet(TitanOperationStatus status) {
- if(status == TitanOperationStatus.NOT_FOUND){
+ private List<GraphVertex> rightOnGet(JanusGraphOperationStatus status) {
+ if(status == JanusGraphOperationStatus.NOT_FOUND){
return emptyList();
}
throw new StorageException(status);
}
- private GraphVertex rightOnUpdate(TitanOperationStatus status) {
+ private GraphVertex rightOnUpdate(JanusGraphOperationStatus status) {
throw new StorageException(status);
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
index 7007c6dd5e..40680af56f 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
@@ -42,33 +42,27 @@ import java.util.stream.Collectors;
import org.openecomp.sdc.asdctool.utils.ConsoleWriter;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
import org.openecomp.sdc.be.tosca.CsarUtils;
-import org.openecomp.sdc.be.tosca.ToscaError;
import org.openecomp.sdc.be.tosca.ToscaExportHandler;
-import org.openecomp.sdc.be.tosca.ToscaRepresentation;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.GeneralUtility;
-import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
-import fj.data.Either;
-
@org.springframework.stereotype.Component("csarGenerator")
public class CsarGenerator extends CommonInternalTool {
public CsarGenerator() {
@@ -76,7 +70,7 @@ public class CsarGenerator extends CommonInternalTool {
}
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private CsarUtils csarUtils;
@Autowired
@@ -90,14 +84,15 @@ public class CsarGenerator extends CommonInternalTool {
private static Logger log = Logger.getLogger(CsarGenerator.class.getName());
public void generateCsar(String uuid, Scanner scanner) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class);
props.put(GraphPropertyEnum.UUID, uuid);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
- List<GraphVertex> byCriterria = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props).either(l -> l, r -> null);
+ List<GraphVertex> byCriterria = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props).either(l -> l, r -> null);
if (byCriterria != null && !byCriterria.isEmpty()) {
if (byCriterria.size() > 1) {
ConsoleWriter.dataLine("Warning ! More that 1 certified service with uuid", uuid);
@@ -116,15 +111,15 @@ public class CsarGenerator extends CommonInternalTool {
} else {
ConsoleWriter.dataLine("No certified service with UUID", uuid);
}
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus handleService(GraphVertex metadataV, String uuid) {
- TitanOperationStatus status = TitanOperationStatus.OK;
+ private JanusGraphOperationStatus handleService(GraphVertex metadataV, String uuid) {
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
org.openecomp.sdc.be.model.Component component = toscaOperationFacade.getToscaFullElement(metadataV.getUniqueId()).either(l -> l, r -> null);
if (component != null) {
@@ -134,11 +129,12 @@ public class CsarGenerator extends CommonInternalTool {
supplier = () -> generateCsarPayload(component);
generateArtifact(component, ArtifactTypeEnum.TOSCA_CSAR, supplier);
- GraphVertex toscaArtifactV = titanDao.getChildVertex(metadataV, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson).either(l->l, r->null);
+ GraphVertex toscaArtifactV = janusGraphDao
+ .getChildVertex(metadataV, EdgeLabelEnum.TOSCA_ARTIFACTS, JsonParseFlagEnum.ParseJson).either(l->l, r->null);
if ( toscaArtifactV != null ){
Map<String, ArtifactDataDefinition> copy = component.getToscaArtifacts().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
toscaArtifactV.setJson(copy);
- titanDao.updateVertex(toscaArtifactV);
+ janusGraphDao.updateVertex(toscaArtifactV);
}
} else {
@@ -147,8 +143,8 @@ public class CsarGenerator extends CommonInternalTool {
return status;
}
- private TitanOperationStatus generateArtifact(Component component, ArtifactTypeEnum artifactType, Supplier<byte[]> supplier){
- TitanOperationStatus status = TitanOperationStatus.GENERAL_ERROR;
+ private JanusGraphOperationStatus generateArtifact(Component component, ArtifactTypeEnum artifactType, Supplier<byte[]> supplier){
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.GENERAL_ERROR;
ArtifactDefinition csarArtifact = null;
Optional<ArtifactDefinition> op = component.getToscaArtifacts().values().stream().filter(p -> p.getArtifactType().equals(artifactType.getType())).findAny();
if (op.isPresent()) {
@@ -166,12 +162,12 @@ public class CsarGenerator extends CommonInternalTool {
return toscaExportHandler.exportComponent(component).either(l -> l.getMainYaml().getBytes(), r -> null);
}
- private TitanOperationStatus savePayload(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact, Supplier<byte[]> supplier) {
+ private JanusGraphOperationStatus savePayload(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact, Supplier<byte[]> supplier) {
byte[] payload = supplier.get();
if ( payload == null ) {
ConsoleWriter.dataLine("create artifact failed ", csarArtifact.getArtifactLabel());
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
ConsoleWriter.dataLine("createartifact success ", csarArtifact.getArtifactLabel());
csarArtifact.setPayload(payload);
@@ -190,7 +186,7 @@ public class CsarGenerator extends CommonInternalTool {
ConsoleWriter.dataLine("Artifact generated and saved into Cassandra ", csarArtifact.getArtifactLabel());
report(component, csarArtifact);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private void report(org.openecomp.sdc.be.model.Component component, ArtifactDefinition csarArtifact) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
index e7f42c9614..76fcec8186 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
@@ -29,21 +29,21 @@
*/
package org.openecomp.sdc.asdctool.impl.internal.tool;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.asdctool.utils.ConsoleWriter;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -56,7 +56,7 @@ import java.util.Scanner;
@Component("deleteComponentHandler")
public class DeleteComponentHandler extends CommonInternalTool{
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private NodeTypeOperation nodeTypeOperation;
@Autowired
@@ -70,23 +70,23 @@ public class DeleteComponentHandler extends CommonInternalTool{
super("delete");
}
public void deleteComponent(String id, Scanner scanner) {
- TitanOperationStatus status = TitanOperationStatus.OK;
- GraphVertex metadataVertex = titanDao.getVertexById(id).either(l -> l, r -> null);
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
+ GraphVertex metadataVertex = janusGraphDao.getVertexById(id).either(l -> l, r -> null);
if (metadataVertex != null) {
status = handleComponent(scanner, metadataVertex);
} else {
ConsoleWriter.dataLine("No vertex for id", id);
}
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus handleComponent(Scanner scanner, GraphVertex metadataVertex) {
+ private JanusGraphOperationStatus handleComponent(Scanner scanner, GraphVertex metadataVertex) {
Map<GraphPropertyEnum, Object> metadataProperties = metadataVertex.getMetadataProperties();
- TitanOperationStatus status = TitanOperationStatus.OK;
+ JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
printComponentInfo(metadataProperties);
Iterator<Edge> edges = metadataVertex.getVertex().edges(Direction.OUT, EdgeLabelEnum.VERSION.name());
@@ -107,12 +107,12 @@ public class DeleteComponentHandler extends CommonInternalTool{
return status;
}
- private TitanOperationStatus handleComponent(GraphVertex metadataVertex) {
+ private JanusGraphOperationStatus handleComponent(GraphVertex metadataVertex) {
ToscaElementOperation toscaElementOperation = getOperationByLabel(metadataVertex);
Iterator<Edge> edges = metadataVertex.getVertex().edges(Direction.IN, EdgeLabelEnum.VERSION.name());
if (edges != null && edges.hasNext()) {
- TitanOperationStatus status = updatePreviousVersion(metadataVertex, edges);
- if ( status != TitanOperationStatus.OK ){
+ JanusGraphOperationStatus status = updatePreviousVersion(metadataVertex, edges);
+ if ( status != JanusGraphOperationStatus.OK ){
return status;
}
}
@@ -121,28 +121,28 @@ public class DeleteComponentHandler extends CommonInternalTool{
.map(l -> {
ConsoleWriter.dataLine("\nDeleted");
report(metadataVertex);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
})
.right()
.map(r-> {
ConsoleWriter.dataLine("\nFailed to delete. see log file");
return r;
});
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus updatePreviousVersion(GraphVertex metadataVertex, Iterator<Edge> edges) {
+ private JanusGraphOperationStatus updatePreviousVersion(GraphVertex metadataVertex, Iterator<Edge> edges) {
Edge edge = edges.next();
- TitanVertex prevVersionVertex = (TitanVertex) edge.outVertex();
+ JanusGraphVertex prevVersionVertex = (JanusGraphVertex) edge.outVertex();
// check if previous version is deleted
- Boolean isDeleted = (Boolean) titanDao.getProperty(prevVersionVertex, GraphPropertyEnum.IS_DELETED.getProperty());
+ Boolean isDeleted = (Boolean) janusGraphDao.getProperty(prevVersionVertex, GraphPropertyEnum.IS_DELETED.getProperty());
if (isDeleted != null && isDeleted) {
ConsoleWriter.dataLine("\nPrevoius version is marked as deleted. Component cannot be deleted");
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
// update highest property for previous version
- TitanOperationStatus status = updateStateOfPreviuosVersion(prevVersionVertex);
- if ( TitanOperationStatus.OK != status ){
+ JanusGraphOperationStatus status = updateStateOfPreviuosVersion(prevVersionVertex);
+ if ( JanusGraphOperationStatus.OK != status ){
return status;
}
@@ -150,51 +150,54 @@ public class DeleteComponentHandler extends CommonInternalTool{
return connectToCatalogAndArchive(metadataVertex, prevVersionVertex);
}
- private TitanOperationStatus updateStateOfPreviuosVersion(TitanVertex prevVersionVertex) {
- String prevId = (String) titanDao.getProperty(prevVersionVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
- Either<GraphVertex, TitanOperationStatus> prevGraphVertex = titanDao.getVertexById(prevId);
+ private JanusGraphOperationStatus updateStateOfPreviuosVersion(JanusGraphVertex prevVersionVertex) {
+ String prevId = (String) janusGraphDao.getProperty(prevVersionVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ Either<GraphVertex, JanusGraphOperationStatus> prevGraphVertex = janusGraphDao.getVertexById(prevId);
GraphVertex prevVertex = prevGraphVertex.left().value();
prevVertex.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- titanDao.updateVertex(prevVertex);
+ janusGraphDao.updateVertex(prevVertex);
Iterator<Edge> edgesIter = prevVersionVertex.edges(Direction.IN, EdgeLabelEnum.LAST_STATE.name());
if ( edgesIter.hasNext() ) {
Edge lastStateEdge = edgesIter.next();
Vertex lastModifier = lastStateEdge.outVertex();
- TitanOperationStatus replaceRes = titanDao.replaceEdgeLabel(lastModifier, prevVersionVertex, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
- if (replaceRes != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ replaceRes = janusGraphDao
+ .replaceEdgeLabel(lastModifier, prevVersionVertex, lastStateEdge, EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE);
+ if (replaceRes != JanusGraphOperationStatus.OK) {
log.info("Failed to replace label from {} to {}. status = {}", EdgeLabelEnum.LAST_STATE, EdgeLabelEnum.STATE, replaceRes);
ConsoleWriter.dataLine("\nFailed to replace LAST_STATE edge . Failed to delete");
- return TitanOperationStatus.GENERAL_ERROR;
+ return JanusGraphOperationStatus.GENERAL_ERROR;
}
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
- private TitanOperationStatus connectToCatalogAndArchive(GraphVertex metadataVertex, TitanVertex prevVersionVertex) {
+ private JanusGraphOperationStatus connectToCatalogAndArchive(GraphVertex metadataVertex, JanusGraphVertex prevVersionVertex) {
- TitanOperationStatus status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.CATALOG_ELEMENT, VertexTypeEnum.CATALOG_ROOT);
- if ( status == TitanOperationStatus.OK ){
+ JanusGraphOperationStatus
+ status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.CATALOG_ELEMENT, VertexTypeEnum.CATALOG_ROOT);
+ if ( status == JanusGraphOperationStatus.OK ){
status = connectByLabel(metadataVertex, prevVersionVertex, EdgeLabelEnum.ARCHIVE_ELEMENT, VertexTypeEnum.ARCHIVE_ROOT);
}
return status;
}
- private TitanOperationStatus connectByLabel(GraphVertex metadataVertex, TitanVertex prevVersionVertex, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexlabel) {
+ private JanusGraphOperationStatus connectByLabel(GraphVertex metadataVertex, JanusGraphVertex prevVersionVertex, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexlabel) {
Iterator<Edge> edgesToCatalog = metadataVertex.getVertex().edges(Direction.IN, edgeLabel.name());
if ( edgesToCatalog != null && edgesToCatalog.hasNext() ){
//exist edge move to prev version
- Either<GraphVertex, TitanOperationStatus> catalog = titanDao.getVertexByLabel(vertexlabel);
+ Either<GraphVertex, JanusGraphOperationStatus> catalog = janusGraphDao.getVertexByLabel(vertexlabel);
if (catalog.isRight()) {
log.debug("Failed to fetch {} vertex, error {}", vertexlabel, catalog.right().value());
return catalog.right().value();
}
GraphVertex catalogV = catalog.left().value();
Edge edge = edgesToCatalog.next();
- return titanDao.createEdge(catalogV.getVertex(), prevVersionVertex, edgeLabel, edge );
+ return janusGraphDao.createEdge(catalogV.getVertex(), prevVersionVertex, edgeLabel, edge );
}
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private boolean isReferenceExist(GraphVertex metadataVertex) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
index eb2574405f..02b37b7d21 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
@@ -8,14 +8,14 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifact
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask;
import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
-import org.openecomp.sdc.be.dao.DAOTitanStrategy;
-import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraClient;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
-import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
-import org.openecomp.sdc.be.model.jsontitan.operations.*;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -81,14 +81,15 @@ public class ValidationToolConfiguration {
return new CassandraClient();
}
- @Bean(name = "dao-titan-strategy")
- public TitanClientStrategy daoStrategy() {
- return new DAOTitanStrategy();
+ @Bean(name = "dao-janusgraph-strategy")
+ public JanusGraphClientStrategy daoStrategy() {
+ return new DAOJanusGraphStrategy();
}
- @Bean(name = "migration-titan-client", initMethod = "createGraph")
- public TitanGraphClient titanMigrationClient(@Qualifier("dao-titan-strategy") TitanClientStrategy titanClientStrategy) {
- return new TitanGraphClient(titanClientStrategy);
+ @Bean(name = "migration-janusgraph-client", initMethod = "createGraph")
+ public JanusGraphClient janusGraphMigrationClient(@Qualifier("dao-janusgraph-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
}
@Bean(name = "tosca-operation-facade")
@@ -116,9 +117,9 @@ public class ValidationToolConfiguration {
return new ByToscaNameDerivedNodeTypeResolver();
}
- @Bean(name = "titan-dao")
- public TitanDao titanDao(@Qualifier("migration-titan-client") TitanGraphClient titanGraphClient) {
- return new TitanDao(titanGraphClient);
+ @Bean(name = "janusgraph-dao")
+ public JanusGraphDao janusGraphDao(@Qualifier("migration-janusgraph-client") JanusGraphClient janusGraphClient) {
+ return new JanusGraphDao(janusGraphClient);
}
@Bean(name = "category-operation")
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
index 34696b33eb..57053eb032 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
@@ -2,15 +2,15 @@ package org.openecomp.sdc.asdctool.impl.validator.executers;
import fj.data.Either;
import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
public class ArtifactValidatorExecuter{
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -42,7 +42,8 @@ public class ArtifactValidatorExecuter{
public Map<String, List<Component>> getVerticesToValidate(VertexTypeEnum type, Map<GraphPropertyEnum, Object> hasProps){
Map<String, List<Component>> result = new HashMap<>();
- Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resultsEither = janusGraphDao
+ .getByCriteria(type, hasProps);
if (resultsEither.isRight()) {
log.error("getVerticesToValidate failed "+ resultsEither.right().value());
return result;
@@ -101,7 +102,7 @@ public class ArtifactValidatorExecuter{
log.error("Failed to fetch vf resources ", e);
return false;
} finally {
- titanDao.commit();
+ janusGraphDao.commit();
}
return result;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
index a10d3193b2..79bf510b55 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
@@ -5,9 +5,9 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.TopologyTemplateValidatio
import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -24,7 +24,7 @@ public class TopologyTemplateValidatorExecuter {
private static Logger log = Logger.getLogger(VfValidatorExecuter.class.getName());
@Autowired
- protected TitanDao titanDao;
+ protected JanusGraphDao janusGraphDao;
protected String name;
@@ -43,7 +43,8 @@ public class TopologyTemplateValidatorExecuter {
props.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF);
}
- Either<List<GraphVertex>, TitanOperationStatus> results = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> results = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props);
if (results.isRight()) {
log.error("getVerticesToValidate failed "+ results.right().value());
return new ArrayList<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
index faccd647c2..433ea9ef0a 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
@@ -8,9 +8,9 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
import org.openecomp.sdc.be.model.ComponentParametersView;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
index 272b546a5d..dd1f54f337 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
@@ -11,9 +11,9 @@ import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
index fe117d1a1a..d2d5e77f2b 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/DataSchemaMenu.java
@@ -22,7 +22,7 @@
package org.openecomp.sdc.asdctool.main;
-import org.openecomp.sdc.asdctool.impl.TitanGraphInitializer;
+import org.openecomp.sdc.asdctool.impl.JanusGraphInitializer;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaBuilder;
import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils;
@@ -62,14 +62,14 @@ public class DataSchemaMenu {
System.exit(2);
}
break;
- case "create-titan-structures":
- log.debug("Start create titan keyspace");
- String titanCfg = 2 == args.length ? configurationManager.getConfiguration().getTitanCfgFile() : args[2];
- if (TitanGraphInitializer.createGraph(titanCfg)) {
- log.debug("create titan keyspace successfull");
+ case "create-janusgraph-structures":
+ log.debug("Start create janusgraph keyspace");
+ String janusGraphCfg = 2 == args.length ? configurationManager.getConfiguration().getJanusGraphCfgFile() : args[2];
+ if (JanusGraphInitializer.createGraph(janusGraphCfg)) {
+ log.debug("create janusgraph keyspace successfull");
System.exit(0);
} else {
- log.debug("create titan keyspace failed");
+ log.debug("create janusgraph keyspace failed");
System.exit(2);
}
break;
@@ -96,6 +96,6 @@ public class DataSchemaMenu {
private static void DataSchemeUsage() {
System.out.println("Usage: create-cassandra-structures <configuration dir> ");
- System.out.println("Usage: create-titan-structures <configuration dir> ");
+ System.out.println("Usage: create-janusgraph-structures <configuration dir> ");
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
index 36d2f66d58..844ae1ec6e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ExportImportMenu.java
@@ -36,7 +36,7 @@ public class ExportImportMenu {
}
private static void importUsage() {
- System.out.println("Usage: import <titan.properties> <graph file location>");
+ System.out.println("Usage: import <janusgraph.properties> <graph file location>");
}
private static void validateJsonUsage() {
@@ -44,7 +44,7 @@ public class ExportImportMenu {
}
private static void exportUsage() {
- System.out.println("Usage: export <titan.properties> <output directory>");
+ System.out.println("Usage: export <janusgraph.properties> <output directory>");
}
private static void dataReportUsage() {
@@ -52,7 +52,7 @@ public class ExportImportMenu {
}
private static void exportUsersUsage() {
- System.out.println("Usage: exportusers <titan.properties> <output directory>");
+ System.out.println("Usage: exportusers <janusgraph.properties> <output directory>");
}
public static void main(String[] args) throws Exception {
@@ -116,7 +116,7 @@ public class ExportImportMenu {
case "validate-json":
String jsonFilePath = validateAndGetJsonFilePath(args);
GraphJsonValidator graphJsonValidator = new GraphJsonValidator();
- if (graphJsonValidator.verifyTitanJson(jsonFilePath)) {
+ if (graphJsonValidator.verifyJanusGraphJson(jsonFilePath)) {
System.exit(2);
}
break;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
index 4bc21b38ca..236f819063 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
@@ -52,7 +52,7 @@ public class RemoveUtils {
}
private static void removeUsage() {
- System.out.println("Usage: remove-products <titan.properties> <BE host> <BE port> <admin user>");
+ System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
}
private static boolean verifyParamsLength(String[] args, int i) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
index ff548ff71a..fc65a2d2d8 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/UpdateIsVnfMenu.java
@@ -41,7 +41,7 @@ public class UpdateIsVnfMenu {
private static void updateIsVnfTrueUsage() {
System.out.println(
- "Usage: updateIsVnfTrue <titan.properties> <systemServiceName1,systemServiceName2,...,systemServiceNameN>");
+ "Usage: updateIsVnfTrue <janusgraph.properties> <systemServiceName1,systemServiceName2,...,systemServiceNameN>");
}
public static void main(String[] args) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
index bff30683ca..c4be03d899 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1710/UpgradeMigration1710.java
@@ -21,17 +21,17 @@ import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLog
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.*;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.*;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
@@ -74,7 +74,7 @@ public class UpgradeMigration1710 implements PostMigration {
private boolean isNodeTypesSupportOnly = true;
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
@@ -263,10 +263,10 @@ public class UpgradeMigration1710 implements PostMigration {
private void cleanup(MigrationResult.MigrationStatus status) {
if (status == MigrationResult.MigrationStatus.COMPLETED ) {
log.info("Upgrade migration 1710 has been successfully finished. ");
- titanDao.commit();
+ janusGraphDao.commit();
} else {
log.info("Upgrade migration 1710 was failed. ");
- titanDao.rollback();
+ janusGraphDao.rollback();
}
outputHandler.writeOutputAndCloseFile();
if (!isNodeTypesSupportOnly && isLockSucceeded) {
@@ -299,11 +299,11 @@ public class UpgradeMigration1710 implements PostMigration {
finally {
if (result) {
log.info("Service upgrade finished successfully: uniqueId {} ", currUid);
- titanDao.commit();
+ janusGraphDao.commit();
}
else {
log.error("Failed to upgrade service with uniqueId {} ", currUid);
- titanDao.rollback();
+ janusGraphDao.rollback();
}
markCheckedOutServiceAsDeletedIfUpgradeFailed(currUid, result);
}
@@ -314,7 +314,7 @@ public class UpgradeMigration1710 implements PostMigration {
}
private void upgradeServices() {
- Either<List<String>, TitanOperationStatus> getServicesRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.SERVICE);
+ Either<List<String>, JanusGraphOperationStatus> getServicesRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.SERVICE);
if (getServicesRes.isRight()) {
log.error("Failed to retrieve the latest certified service versions");
return;
@@ -341,7 +341,7 @@ public class UpgradeMigration1710 implements PostMigration {
return upgradeService(getServiceRes.left().value());
}
if(!latestGenericTypes.containsKey(derivedFromGenericType)){
- Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
if(getDerivedRes.isRight()){
log.error(FAILED_TO_UPGRADE_COMPONENT, getServiceRes.left().value().getComponentType().getValue(), getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getVersion(), "findDerivedResources", getDerivedRes.right().value());
outputHandler.addRecord( getServiceRes.left().value().getComponentType().name(),getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value());
@@ -531,7 +531,7 @@ public class UpgradeMigration1710 implements PostMigration {
Optional<ComponentInstanceProperty> propertyInvariantUuid = instanceProperties.stream().filter(p->p.getName().equals(SERVICE_INVARIANT_UUID_RPOPERTY)).findFirst();
if(propertyUuid.isPresent() && propertyInvariantUuid.isPresent()){
String serviceInvariantUUID = propertyInvariantUuid.get().getValue();
- Either<List<GraphVertex>, TitanOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(serviceInvariantUUID);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(serviceInvariantUUID);
if (getLatestOriginServiceRes.isRight()) {
return instance;
}
@@ -565,9 +565,9 @@ public class UpgradeMigration1710 implements PostMigration {
}
private Either<ComponentInstance, ResponseFormat> upgradeServiceProxyInstance(org.openecomp.sdc.be.model.Component component, ComponentInstance instance, ComponentInstance newComponentInstance) {
- Either<List<GraphVertex>, TitanOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(instance.getSourceModelInvariant());
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(instance.getSourceModelInvariant());
if (getLatestOriginServiceRes.isRight()) {
- return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(getLatestOriginServiceRes.right().value()), instance.getOriginType().getComponentType())));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getLatestOriginServiceRes.right().value()), instance.getOriginType().getComponentType())));
}
ModelConverter.getVertexType(instance.getOriginType().name());
Either<Resource, StorageOperationStatus> getOriginRes = toscaOperationFacade.getLatestByName(instance.getComponentName());
@@ -580,7 +580,7 @@ public class UpgradeMigration1710 implements PostMigration {
return changeAssetVersion(component, instance, newComponentInstance);
}
- private Either<List<GraphVertex>, TitanOperationStatus> getLatestCertifiedService(String invariantUUID) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestCertifiedService(String invariantUUID) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
@@ -589,7 +589,8 @@ public class UpgradeMigration1710 implements PostMigration {
propertiesToMatch.put(GraphPropertyEnum.INVARIANT_UUID, invariantUUID);
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- return titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
}
private Either<ComponentInstance, ResponseFormat> changeAssetVersion(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance instance, ComponentInstance newComponentInstance) {
@@ -599,7 +600,7 @@ public class UpgradeMigration1710 implements PostMigration {
private boolean upgradeNodeTypes() {
log.info("Starting upgrade node types upon upgrade migration 1710 process. ");
if (nodeTypes != null && !nodeTypes.isEmpty()) {
- Either<List<String>, TitanOperationStatus> getRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.NODE_TYPE, ComponentTypeEnum.RESOURCE);
+ Either<List<String>, JanusGraphOperationStatus> getRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.NODE_TYPE, ComponentTypeEnum.RESOURCE);
if (getRes.isRight()) {
return false;
}
@@ -633,7 +634,7 @@ public class UpgradeMigration1710 implements PostMigration {
private boolean upgradeVFs() {
log.info("Starting upgrade VFs upon upgrade migration 1710 process. ");
- Either<List<String>, TitanOperationStatus> getVfsRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.RESOURCE);
+ Either<List<String>, JanusGraphOperationStatus> getVfsRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.RESOURCE);
if (getVfsRes.isRight()) {
log.info(UPGRADE_VFS_FAILED);
return false;
@@ -665,11 +666,11 @@ public class UpgradeMigration1710 implements PostMigration {
finally {
if (result) {
log.info("Resource upgrade finished successfully: uniqueId {} ", currUid);
- titanDao.commit();
+ janusGraphDao.commit();
}
else {
log.error("Failed to upgrade resource with uniqueId {} ", currUid);
- titanDao.rollback();
+ janusGraphDao.rollback();
}
markCheckedOutResourceAsDeletedIfUpgradeFailed(currUid, result);
}
@@ -804,7 +805,7 @@ public class UpgradeMigration1710 implements PostMigration {
if (StringUtils.isNotEmpty(derivedFromGenericType) && !latestGenericTypes.containsKey(derivedFromGenericType)) {
log.info("Starting upgrade vf with name {}, invariantUUID {}, version {}, latest derived from generic type {}, latest derived from generic version {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType, derivedFromGenericVersion);
log.info("Starting to fetch latest generic node type {}. ", derivedFromGenericType);
- Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType);
if (getDerivedRes.isRight()) {
outputHandler.addRecord(component.getComponentType().name(), component.getName(), component.getInvariantUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value());
log.info("Failed to upgrade component with name {}, invariantUUID {}, version {} and latest generic. Status is {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType);
@@ -835,9 +836,10 @@ public class UpgradeMigration1710 implements PostMigration {
StorageOperationStatus result = StorageOperationStatus.OK;
log.info("Starting upgrade node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION));
log.info("Starting to find derived to for node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION));
- Either<List<GraphVertex>, TitanOperationStatus> parentResourceRes = titanDao.getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata);
- if (parentResourceRes.isRight() && parentResourceRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(parentResourceRes.right().value());
+ Either<List<GraphVertex>, JanusGraphOperationStatus> parentResourceRes = janusGraphDao
+ .getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata);
+ if (parentResourceRes.isRight() && parentResourceRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentResourceRes.right().value());
}
List<GraphVertex> derivedResourcesUid = getAllDerivedGraphVertices(allCertifiedUids, parentResourceRes);
@@ -871,13 +873,13 @@ public class UpgradeMigration1710 implements PostMigration {
}
if (performFullCertification(checkouRes.left().value()).isLeft()) {
upgradedNodeTypesMap.put(nodeType.getToscaResourceName(), checkouRes.left().value());
- titanDao.commit();
+ janusGraphDao.commit();
return true;
}
return false;
}
- private List<GraphVertex> getAllDerivedGraphVertices(List<String> allCertifiedUids, Either<List<GraphVertex>, TitanOperationStatus> parentResources) {
+ private List<GraphVertex> getAllDerivedGraphVertices(List<String> allCertifiedUids, Either<List<GraphVertex>, JanusGraphOperationStatus> parentResources) {
List<GraphVertex> derivedResourcesUid = new ArrayList<>();
if (parentResources.isLeft()) {
@@ -916,14 +918,15 @@ public class UpgradeMigration1710 implements PostMigration {
return changeStateEither;
}
- private Either<List<GraphVertex>, TitanOperationStatus> findDerivedResources(String parentResource) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource);
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
}
private boolean latestVersionExists(GraphVertex latestDerivedFrom, String currentVersion) {
@@ -940,14 +943,14 @@ public class UpgradeMigration1710 implements PostMigration {
return Double.parseDouble(latestVersion) > Double.parseDouble(currentVersion);
}
- private Either<List<String>, TitanOperationStatus> getAllLatestCertifiedComponentUids(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
+ private Either<List<String>, JanusGraphOperationStatus> getAllLatestCertifiedComponentUids(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
log.info("Starting to fetch all latest certified not checked out components with type {} upon upgrade migration 1710 process", componentType);
- Either<List<String>, TitanOperationStatus> result = null;
+ Either<List<String>, JanusGraphOperationStatus> result = null;
Map<String, String> latestCertifiedMap = new HashMap<>();
Map<String, String> latestNotCertifiedMap = new HashMap<>();
- Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = getAllLatestComponents(vertexType, componentType);
- if (getComponentsRes.isRight() && getComponentsRes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getComponentsRes = getAllLatestComponents(vertexType, componentType);
+ if (getComponentsRes.isRight() && getComponentsRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.error("Failed to fetch all latest certified not checked out components with type {}. Status is {}. ", componentType, getComponentsRes.right().value());
result = Either.right(getComponentsRes.right().value());
}
@@ -968,7 +971,7 @@ public class UpgradeMigration1710 implements PostMigration {
return result;
}
- private Either<List<GraphVertex>, TitanOperationStatus> getAllLatestComponents(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllLatestComponents(VertexTypeEnum vertexType, ComponentTypeEnum componentType) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
@@ -979,7 +982,8 @@ public class UpgradeMigration1710 implements PostMigration {
if (vertexType == VertexTypeEnum.TOPOLOGY_TEMPLATE && componentType == ComponentTypeEnum.RESOURCE) {
propertiesNotToMatch.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name());
}
- return titanDao.getByCriteria(vertexType, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao
+ .getByCriteria(vertexType, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
}
private Either<List<GraphVertex>, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName) {
@@ -990,11 +994,12 @@ public class UpgradeMigration1710 implements PostMigration {
propertiesToMatch.put(property, nodeName);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> highestResources = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata);
if (highestResources.isRight()) {
- TitanOperationStatus status = highestResources.right().value();
+ JanusGraphOperationStatus status = highestResources.right().value();
log.debug("Failed to fetch resource with name {}. Status is {} ", nodeName, status);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
List<GraphVertex> resources = highestResources.left().value();
List<GraphVertex> result = new ArrayList<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
index d520eee1b8..a47c63d451 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigration.java
@@ -6,17 +6,17 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementOperation;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
@@ -32,11 +32,11 @@ public class SdcCatalogMigration implements Migration {
private static final List<ResourceTypeEnum> EXCLUDE_TYPES = Arrays.asList(ResourceTypeEnum.VFCMT, ResourceTypeEnum.Configuration);
private ToscaElementOperation toscaElementOperation;
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public SdcCatalogMigration(TopologyTemplateOperation toscaElementOperation, TitanDao titanDao) {
+ public SdcCatalogMigration(TopologyTemplateOperation toscaElementOperation, JanusGraphDao janusGraphDao) {
this.toscaElementOperation = toscaElementOperation;
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
}
@Override
@@ -51,45 +51,46 @@ public class SdcCatalogMigration implements Migration {
@Override
public MigrationResult migrate() {
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
try {
status = getOrCreateCatalogRoot()
.either(this::associateCatalogRootToCatalogElements,
err -> {LOGGER.error("failed to create catalog root. err: {}", err); return err;});
- return status == TitanOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create and associate catalog root. error: " + status);
+ return status == JanusGraphOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create and associate catalog root. error: " + status);
} finally {
commitOrRollBack(status);
}
}
- private void commitOrRollBack(TitanOperationStatus status) {
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ private void commitOrRollBack(JanusGraphOperationStatus status) {
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private Either<GraphVertex, TitanOperationStatus> getOrCreateCatalogRoot() {
+ private Either<GraphVertex, JanusGraphOperationStatus> getOrCreateCatalogRoot() {
LOGGER.info("creating or getting catalog root vertex");
- return titanDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT)
+ return janusGraphDao.getVertexByLabel(VertexTypeEnum.CATALOG_ROOT)
.right()
.bind(this::createRootCatalogVertexOrError);
}
- private Either<GraphVertex, TitanOperationStatus> createRootCatalogVertexOrError(TitanOperationStatus titanOperationStatus) {
- return titanOperationStatus == TitanOperationStatus.NOT_FOUND ? createRootCatalogVertex() : Either.right(titanOperationStatus);
+ private Either<GraphVertex, JanusGraphOperationStatus> createRootCatalogVertexOrError(JanusGraphOperationStatus janusGraphOperationStatus) {
+ return janusGraphOperationStatus == JanusGraphOperationStatus.NOT_FOUND ? createRootCatalogVertex() : Either.right(
+ janusGraphOperationStatus);
}
- private Either<GraphVertex, TitanOperationStatus> createRootCatalogVertex() {
+ private Either<GraphVertex, JanusGraphOperationStatus> createRootCatalogVertex() {
LOGGER.info("Creating root catalog vertex");
GraphVertex catalogRootVertex = new GraphVertex(VertexTypeEnum.CATALOG_ROOT);
catalogRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
- return titanDao.createVertex(catalogRootVertex);
+ return janusGraphDao.createVertex(catalogRootVertex);
}
- private Either<List<GraphVertex>, TitanOperationStatus> getAllCatalogVertices() {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllCatalogVertices() {
LOGGER.info("fetching all catalog resources");
return toscaElementOperation.getListOfHighestComponents(ComponentTypeEnum.RESOURCE, EXCLUDE_TYPES, JsonParseFlagEnum.ParseMetadata)
.right()
@@ -98,12 +99,12 @@ public class SdcCatalogMigration implements Migration {
.bind(this::getAllCatalogVertices);
}
- private Either<List<GraphVertex>, TitanOperationStatus> errOrEmptyListIfNotFound(TitanOperationStatus err) {
- return TitanOperationStatus.NOT_FOUND.equals(err) ? Either.left(new ArrayList<>()) : Either.right(err);
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> errOrEmptyListIfNotFound(JanusGraphOperationStatus err) {
+ return JanusGraphOperationStatus.NOT_FOUND.equals(err) ? Either.left(new ArrayList<>()) : Either.right(err);
}
@SuppressWarnings("unchecked")
- private Either<List<GraphVertex>, TitanOperationStatus> getAllCatalogVertices(List<GraphVertex> allResourceCatalogVertices) {
+ private Either<List<GraphVertex>, JanusGraphOperationStatus> getAllCatalogVertices(List<GraphVertex> allResourceCatalogVertices) {
LOGGER.info("number of resources: {}", allResourceCatalogVertices.size());
LOGGER.info("fetching all catalog services");
return toscaElementOperation.getListOfHighestComponents(ComponentTypeEnum.SERVICE, EXCLUDE_TYPES, JsonParseFlagEnum.ParseMetadata)
@@ -113,20 +114,22 @@ public class SdcCatalogMigration implements Migration {
.map(allServiceVertices -> ListUtils.union(allServiceVertices, allResourceCatalogVertices));
}
- private TitanOperationStatus associateCatalogRootToCatalogElements(GraphVertex root) {
+ private JanusGraphOperationStatus associateCatalogRootToCatalogElements(GraphVertex root) {
return getAllCatalogVertices()
.either(catalogVertices -> associateCatalogRootToCatalogElements(root, catalogVertices),
err -> err);
}
- private TitanOperationStatus associateCatalogRootToCatalogElements(GraphVertex root, List<GraphVertex> catalogElements) {
+ private JanusGraphOperationStatus associateCatalogRootToCatalogElements(GraphVertex root, List<GraphVertex> catalogElements) {
LOGGER.info("number of catalog elements: {}", catalogElements.size());
LOGGER.info("connect all catalog elements to root edge");
List<GraphVertex> nonConnectedElements = catalogElements.stream().filter(this::edgeNotAlreadyExists).collect(Collectors.toList());
int numOfCreatedEdges = 0;
for (GraphVertex catalogElement : nonConnectedElements) {
- TitanOperationStatus edgeCreationStatus = titanDao.createEdge(root, catalogElement, EdgeLabelEnum.CATALOG_ELEMENT, null);
- if (edgeCreationStatus != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ edgeCreationStatus = janusGraphDao
+ .createEdge(root, catalogElement, EdgeLabelEnum.CATALOG_ELEMENT, null);
+ if (edgeCreationStatus != JanusGraphOperationStatus.OK) {
LOGGER.error("failed to create edge from catalog element to vertex {}", catalogElement.getUniqueId());
return edgeCreationStatus;
}
@@ -134,7 +137,7 @@ public class SdcCatalogMigration implements Migration {
numOfCreatedEdges++;
}
LOGGER.info("number edges created: {}", numOfCreatedEdges);
- return TitanOperationStatus.OK;
+ return JanusGraphOperationStatus.OK;
}
private boolean edgeNotAlreadyExists(GraphVertex catalogElement) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
index 9634025867..812c07e6b0 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigration.java
@@ -17,7 +17,7 @@
package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
import com.google.common.collect.ImmutableSet;
-import com.thinkaurelius.titan.core.TitanVertex;
+import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.math.BigInteger;
import java.util.ArrayList;
@@ -38,22 +38,20 @@ import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@@ -61,14 +59,14 @@ import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@org.springframework.stereotype.Component
public class ForwardPathMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private UserAdminOperation userAdminOperation;
private ToscaOperationFacade toscaOperationFacade;
private User user = null;
- public ForwardPathMigration(TitanDao titanDao,
+ public ForwardPathMigration(JanusGraphDao janusGraphDao,
UserAdminOperation userAdminOperation, ToscaOperationFacade toscaOperationFacade) {
- this.titanDao = titanDao;
+ this.janusGraphDao = janusGraphDao;
this.userAdminOperation = userAdminOperation;
this.toscaOperationFacade = toscaOperationFacade;
}
@@ -110,7 +108,7 @@ public class ForwardPathMigration implements Migration {
hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name());
Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>();
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- status = titanDao
+ status = janusGraphDao
.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::cleanServices, this::handleError);
return status;
@@ -138,10 +136,11 @@ public class ForwardPathMigration implements Migration {
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- titanDao.rollback();
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ janusGraphDao.rollback();
return DaoStatusConverter
- .convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ .convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus fixDataOnGraph(Component component) {
@@ -149,10 +148,10 @@ public class ForwardPathMigration implements Migration {
return StorageOperationStatus.OK;
}
Service service = (Service) component;
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(service.getUniqueId(),
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao.getVertexById(service.getUniqueId(),
JsonParseFlagEnum.NoParse);
if (getResponse.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value());
}
Set<String> ciNames = new HashSet<>();
@@ -163,13 +162,13 @@ public class ForwardPathMigration implements Migration {
GraphVertex componentVertex = getResponse.left().value();
GraphVertex toscaDataVertex;
- Either<GraphVertex, TitanOperationStatus> groupVertexEither = titanDao.getChildVertex(componentVertex,
+ Either<GraphVertex, JanusGraphOperationStatus> groupVertexEither = janusGraphDao.getChildVertex(componentVertex,
EdgeLabelEnum.FORWARDING_PATH, JsonParseFlagEnum.ParseJson);
- if (groupVertexEither.isRight() && groupVertexEither.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (groupVertexEither.isRight() && groupVertexEither.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
return StorageOperationStatus.OK;
}
if (groupVertexEither.isRight()) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(groupVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(groupVertexEither.right().value());
}
toscaDataVertex = groupVertexEither.left().value();
Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>(
@@ -186,42 +185,44 @@ public class ForwardPathMigration implements Migration {
}
}
if (toBeDeletedFP.isEmpty()) {
- titanDao.rollback();
+ janusGraphDao.rollback();
return StorageOperationStatus.OK;
}
toBeDeletedFP.stream().forEach(fpKey -> forwardingPaths.remove(fpKey));
toscaDataVertex.setJson(forwardingPaths);
- Either<GraphVertex, TitanOperationStatus> updatevertexEither = updateOrCopyOnUpdate(
+ Either<GraphVertex, JanusGraphOperationStatus> updatevertexEither = updateOrCopyOnUpdate(
toscaDataVertex, componentVertex);
if (updatevertexEither.isRight()) {
- titanDao.rollback();
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updatevertexEither.right().value());
+ janusGraphDao.rollback();
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updatevertexEither.right().value());
}
- titanDao.commit();
+ janusGraphDao.commit();
return StorageOperationStatus.OK;
}
- private Either<GraphVertex, TitanOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, Edge edgeToRemove) {
+ private Either<GraphVertex, JanusGraphOperationStatus> cloneDataVertex(GraphVertex dataVertex, GraphVertex toscaElementVertex, Edge edgeToRemove) {
EdgeLabelEnum label = EdgeLabelEnum.FORWARDING_PATH;
GraphVertex newDataVertex = new GraphVertex(dataVertex.getLabel());
String id = IdBuilderUtils.generateChildId(toscaElementVertex.getUniqueId(), dataVertex.getLabel());
newDataVertex.cloneData(dataVertex);
newDataVertex.setUniqueId(id);
- Either<GraphVertex, TitanOperationStatus> createVertex = titanDao.createVertex(newDataVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(newDataVertex);
if (createVertex.isRight()) {
return createVertex;
}
newDataVertex = createVertex.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(toscaElementVertex, newDataVertex, label, titanDao.getEdgeProperties(edgeToRemove));
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(toscaElementVertex, newDataVertex, label, janusGraphDao.getEdgeProperties(edgeToRemove));
+ if (createEdge != JanusGraphOperationStatus.OK) {
return Either.right(createEdge);
}
edgeToRemove.remove();
return Either.left(newDataVertex);
}
- private Either<GraphVertex, TitanOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex ) {
+ private Either<GraphVertex, JanusGraphOperationStatus> updateOrCopyOnUpdate(GraphVertex dataVertex, GraphVertex toscaElementVertex ) {
EdgeLabelEnum label = EdgeLabelEnum.FORWARDING_PATH;
Iterator<Edge> edges = dataVertex.getVertex().edges(Direction.IN, label.name());
int edgeCount = 0;
@@ -230,21 +231,22 @@ public class ForwardPathMigration implements Migration {
Edge edge = edges.next();
++edgeCount;
Vertex outVertex = edge.outVertex();
- String outId = (String) titanDao.getProperty((TitanVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String outId = (String) janusGraphDao
+ .getProperty((JanusGraphVertex) outVertex, GraphPropertyEnum.UNIQUE_ID.getProperty());
if (toscaElementVertex.getUniqueId().equals(outId)) {
edgeToRemove = edge;
}
}
if (edgeToRemove == null) {
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
}
switch (edgeCount) {
case 0:
// error
- return Either.right(TitanOperationStatus.GENERAL_ERROR);
+ return Either.right(JanusGraphOperationStatus.GENERAL_ERROR);
case 1:
// update
- return titanDao.updateVertex(dataVertex);
+ return janusGraphDao.updateVertex(dataVertex);
default:
// copy on update
return cloneDataVertex(dataVertex, toscaElementVertex, edgeToRemove);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
index 7d741624c2..02b45dc332 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigration.java
@@ -8,11 +8,11 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
@@ -33,7 +33,7 @@ import java.util.Map;
@Component
public class ResourceLifecycleMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private LifecycleBusinessLogic lifecycleBusinessLogic;
private UserAdminOperation userAdminOperation;
@@ -41,8 +41,8 @@ public class ResourceLifecycleMigration implements Migration {
private static final Logger log = Logger.getLogger(ResourceLifecycleMigration.class);
- public ResourceLifecycleMigration(TitanDao titanDao, LifecycleBusinessLogic lifecycleBusinessLogic, UserAdminOperation userAdminOperation) {
- this.titanDao = titanDao;
+ public ResourceLifecycleMigration(JanusGraphDao janusGraphDao, LifecycleBusinessLogic lifecycleBusinessLogic, UserAdminOperation userAdminOperation) {
+ this.janusGraphDao = janusGraphDao;
this.lifecycleBusinessLogic = lifecycleBusinessLogic;
this.userAdminOperation = userAdminOperation;
}
@@ -82,7 +82,7 @@ public class ResourceLifecycleMigration implements Migration {
if (StorageOperationStatus.OK == status) {
status = findResourcesAndChangeStatus(VertexTypeEnum.TOPOLOGY_TEMPLATE);
}
- titanDao.commit();
+ janusGraphDao.commit();
return status;
}
@@ -97,12 +97,12 @@ public class ResourceLifecycleMigration implements Migration {
hasNot.put(GraphPropertyEnum.IS_DELETED, true);
log.info("findResourcesAndChangeStatus for type {} and state {}", type ,LifecycleStateEnum.READY_FOR_CERTIFICATION);
- status = titanDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
+ status = janusGraphDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
log.info("status {} for type {} and state {}", status, type ,LifecycleStateEnum.READY_FOR_CERTIFICATION);
log.info("findResourcesAndChangeStatus for type {} and state {}", type ,LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFICATION_IN_PROGRESS.name());
- status = titanDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
+ status = janusGraphDao.getByCriteria(type, props, hasNot, JsonParseFlagEnum.ParseAll).either(this::changeState, this::handleError);
log.info("status {} for type {} and state {}", status, type ,LifecycleStateEnum.CERTIFICATION_IN_PROGRESS);
@@ -130,9 +130,10 @@ public class ResourceLifecycleMigration implements Migration {
return changeComponentState.isLeft() ? StorageOperationStatus.OK : StorageOperationStatus.GENERAL_ERROR;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- log.debug("receive titan error {}", err);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ log.debug("receive janusgraph error {}", err);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
index 4786839250..f85b6ade88 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigration.java
@@ -4,12 +4,12 @@ import fj.data.Either;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
@@ -17,8 +17,8 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -31,7 +31,7 @@ import java.util.Map.Entry;
@Component
public class SDCInstancesMigration implements Migration {
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private NodeTemplateOperation nodeTemplateOperation;
private static final Logger log = Logger.getLogger(SDCInstancesMigration.class);
@@ -41,8 +41,8 @@ public class SDCInstancesMigration implements Migration {
private static final List<String> UUID_PROPS_NAMES = Arrays.asList("providing_service_uuid", "providing_service_uuid");
- public SDCInstancesMigration(TitanDao titanDao, NodeTemplateOperation nodeTemplateOperation) {
- this.titanDao = titanDao;
+ public SDCInstancesMigration(JanusGraphDao janusGraphDao, NodeTemplateOperation nodeTemplateOperation) {
+ this.janusGraphDao = janusGraphDao;
this.nodeTemplateOperation = nodeTemplateOperation;
}
@@ -69,13 +69,15 @@ public class SDCInstancesMigration implements Migration {
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC);
- status = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
+ status = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::connectAll, this::handleError);
return status;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- return DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus connectAll(List<GraphVertex> containersV) {
@@ -96,7 +98,8 @@ public class SDCInstancesMigration implements Migration {
ComponentTypeEnum componentType = containerV.getType();
Map<String, MapPropertiesDataDefinition> instanceProperties = null;
if (componentType == ComponentTypeEnum.RESOURCE) {
- Either<GraphVertex, TitanOperationStatus> subcategoryV = titanDao.getChildVertex(containerV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> subcategoryV = janusGraphDao
+ .getChildVertex(containerV, EdgeLabelEnum.CATEGORY, JsonParseFlagEnum.NoParse);
if (subcategoryV.isRight()) {
log.debug("Failed to fetch category vertex for resource {} error {} ", containerV.getUniqueId(), subcategoryV.right().value());
return StorageOperationStatus.GENERAL_ERROR;
@@ -122,9 +125,9 @@ public class SDCInstancesMigration implements Migration {
} finally {
if (status == StorageOperationStatus.OK) {
- titanDao.commit();
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
}
@@ -133,10 +136,11 @@ public class SDCInstancesMigration implements Migration {
private Either<Map<String, MapPropertiesDataDefinition>, StorageOperationStatus> getInstProperties(GraphVertex containerV) {
Map<String, MapPropertiesDataDefinition> instanceProperties;
- Either<GraphVertex, TitanOperationStatus> instProps = titanDao.getChildVertex(containerV, EdgeLabelEnum.INST_PROPERTIES, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> instProps = janusGraphDao
+ .getChildVertex(containerV, EdgeLabelEnum.INST_PROPERTIES, JsonParseFlagEnum.ParseAll);
if (instProps.isRight()) {
- if (instProps.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (instProps.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
instanceProperties = new HashMap<>();
} else {
log.debug("Failed to fetch instance properties vertex for resource {} error {} ", containerV.getUniqueId(), instProps.right().value());
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
index bdab2cee2b..e8977227df 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigration.java
@@ -4,11 +4,11 @@ import fj.data.Either;
import org.openecomp.sdc.asdctool.migration.core.DBVersion;
import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
@@ -19,10 +19,10 @@ import java.math.BigInteger;
public class SdcArchiveMigration implements Migration {
private static final Logger logger = Logger.getLogger(SdcArchiveMigration.class);
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
- public SdcArchiveMigration(TitanDao titanDao) {
- this.titanDao = titanDao;
+ public SdcArchiveMigration(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
}
@Override
@@ -37,30 +37,30 @@ public class SdcArchiveMigration implements Migration {
@Override
public MigrationResult migrate() {
- TitanOperationStatus status = null;
+ JanusGraphOperationStatus status = null;
try {
status = getOrCreateArchiveRoot();
- return status == TitanOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create archive root node. error: " + status);
+ return status == JanusGraphOperationStatus.OK ? MigrationResult.success() : MigrationResult.error("failed to create archive root node. error: " + status);
} finally {
commitOrRollBack(status);
}
}
- private void commitOrRollBack(TitanOperationStatus status) {
- if (status == TitanOperationStatus.OK) {
- titanDao.commit();
+ private void commitOrRollBack(JanusGraphOperationStatus status) {
+ if (status == JanusGraphOperationStatus.OK) {
+ janusGraphDao.commit();
} else {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
}
- private TitanOperationStatus getOrCreateArchiveRoot() {
+ private JanusGraphOperationStatus getOrCreateArchiveRoot() {
logger.info("creating or getting catalog archive vertex");
- return titanDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT)
- .either(v -> TitanOperationStatus.OK, s -> this.createRootArchiveVertex());
+ return janusGraphDao.getVertexByLabel(VertexTypeEnum.ARCHIVE_ROOT)
+ .either(v -> JanusGraphOperationStatus.OK, s -> this.createRootArchiveVertex());
}
- private TitanOperationStatus createRootArchiveVertex() {
+ private JanusGraphOperationStatus createRootArchiveVertex() {
GraphVertex archiveRootVertex = new GraphVertex(VertexTypeEnum.ARCHIVE_ROOT);
archiveRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId());
archiveRootVertex.addMetadataProperty(GraphPropertyEnum.LABEL, VertexTypeEnum.ARCHIVE_ROOT);
@@ -68,9 +68,9 @@ public class SdcArchiveMigration implements Migration {
logger.info("Creating root archive vertex {}", archiveRootVertex.getUniqueId());
- final Either<GraphVertex, TitanOperationStatus> vertexE = titanDao.createVertex(archiveRootVertex);
+ final Either<GraphVertex, JanusGraphOperationStatus> vertexE = janusGraphDao.createVertex(archiveRootVertex);
- return vertexE.isLeft() ? TitanOperationStatus.OK : vertexE.right().value();
+ return vertexE.isLeft() ? JanusGraphOperationStatus.OK : vertexE.right().value();
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
index afbd3b411a..35e795095e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/InterfaceOperationMigration.java
@@ -28,17 +28,17 @@ import org.openecomp.sdc.asdctool.migration.core.task.Migration;
import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
@@ -51,7 +51,7 @@ public class InterfaceOperationMigration implements Migration {
private static final Logger LOGGER = Logger.getLogger(InterfaceOperationMigration.class);
@Autowired
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
@Autowired
private UserAdminOperation userAdminOperation;
@Autowired
@@ -86,7 +86,8 @@ public class InterfaceOperationMigration implements Migration {
private StorageOperationStatus getAndUpdateAllComponents(){
Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class);
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
- return titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
+ return janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, null, hasNotProps, JsonParseFlagEnum.ParseAll)
.either(this::updateComponentVertices, this::handleError);
}
@@ -101,16 +102,17 @@ public class InterfaceOperationMigration implements Migration {
return status;
}
- private StorageOperationStatus handleError(TitanOperationStatus err) {
- titanDao.rollback();
- return DaoStatusConverter.convertTitanStatusToStorageStatus(
- TitanOperationStatus.NOT_FOUND == err ? TitanOperationStatus.OK : err);
+ private StorageOperationStatus handleError(JanusGraphOperationStatus err) {
+ janusGraphDao.rollback();
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND == err ? JanusGraphOperationStatus.OK : err);
}
private StorageOperationStatus updateDataOnGraph(GraphVertex componentVertex) {
try {
- Either<GraphVertex, TitanOperationStatus> interfaceVertexEither =
- titanDao.getChildVertex(componentVertex, EdgeLabelEnum.INTERFACE, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> interfaceVertexEither =
+ janusGraphDao
+ .getChildVertex(componentVertex, EdgeLabelEnum.INTERFACE, JsonParseFlagEnum.ParseJson);
if (interfaceVertexEither.isLeft()) {
GraphVertex interfaceVertex = interfaceVertexEither.left().value();
Map<String, InterfaceDataDefinition> interfaceDefinitions = (Map<String, InterfaceDataDefinition>) interfaceVertex.getJson();
@@ -121,9 +123,10 @@ public class InterfaceOperationMigration implements Migration {
}
}
interfaceVertex.setJson(interfaceDefinitions);
- Either<GraphVertex, TitanOperationStatus> updateInterfaceVertexEither = titanDao.updateVertex(interfaceVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateInterfaceVertexEither = janusGraphDao
+ .updateVertex(interfaceVertex);
if(updateInterfaceVertexEither.isRight()){
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateInterfaceVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateInterfaceVertexEither.right().value());
}
}
@@ -134,8 +137,8 @@ public class InterfaceOperationMigration implements Migration {
}
}
- Either<GraphVertex, TitanOperationStatus> instInterfaceVertexEither =
- titanDao.getChildVertex(componentVertex, EdgeLabelEnum.INST_INTERFACES, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> instInterfaceVertexEither =
+ janusGraphDao.getChildVertex(componentVertex, EdgeLabelEnum.INST_INTERFACES, JsonParseFlagEnum.ParseJson);
if (instInterfaceVertexEither.isLeft()) {
GraphVertex instInterfaceVertex = instInterfaceVertexEither.left().value();
Map<String, MapInterfaceDataDefinition> instInterfaceDefinitions = (Map<String, MapInterfaceDataDefinition>) instInterfaceVertex.getJson();
@@ -148,17 +151,18 @@ public class InterfaceOperationMigration implements Migration {
}
}
instInterfaceVertex.setJson(instInterfaceDefinitions);
- Either<GraphVertex, TitanOperationStatus> updateInstInterfaceVertexEither = titanDao.updateVertex(instInterfaceVertex);
+ Either<GraphVertex, JanusGraphOperationStatus> updateInstInterfaceVertexEither = janusGraphDao
+ .updateVertex(instInterfaceVertex);
if(updateInstInterfaceVertexEither.isRight()){
- return DaoStatusConverter.convertTitanStatusToStorageStatus(updateInstInterfaceVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateInstInterfaceVertexEither.right().value());
}
}
}
- titanDao.commit();
+ janusGraphDao.commit();
} catch (Exception e) {
LOGGER.debug("Interface operation migration failed with error : ", e);
- titanDao.rollback();
+ janusGraphDao.rollback();
return StorageOperationStatus.GENERAL_ERROR;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java
index 31b1b1f07a..e7d39ffb3e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportTitanServlet.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServlet.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.asdctool.servlets;
-import com.thinkaurelius.titan.core.TitanGraph;
+import org.janusgraph.core.JanusGraph;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
@@ -39,30 +39,30 @@ import java.util.Map.Entry;
import java.util.Properties;
//import com.tinkerpop.blueprints.util.io.graphml.GraphMLWriter;
-@Path("/titan")
-public class ExportImportTitanServlet {
+@Path("/janusgraph")
+public class ExportImportJanusGraphServlet {
- private static Logger log = Logger.getLogger(ExportImportTitanServlet.class.getName());
+ private static Logger log = Logger.getLogger(ExportImportJanusGraphServlet.class.getName());
@GET
@Path("export")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
- public Response export(@FormDataParam("titanProperties") File titanPropertiesFile,
+ public Response export(@FormDataParam("janusGraphProperties") File janusGraphPropertiesFile,
@FormDataParam("metadata") String exportGraphMetadata) {
- printTitanConfigFile(titanPropertiesFile);
+ printJanusGraphConfigFile(janusGraphPropertiesFile);
printMetadata(exportGraphMetadata);
- Properties titanProperties = convertFileToProperties(titanPropertiesFile);
+ Properties janusGraphProperties = convertFileToProperties(janusGraphPropertiesFile);
- if (titanProperties == null) {
- Response response = Utils.buildOkResponse(400, "cannot parse titan properties file", null);
+ if (janusGraphProperties == null) {
+ Response response = Utils.buildOkResponse(400, "cannot parse janusgraph properties file", null);
return response;
}
Configuration conf = new BaseConfiguration();
- for (Entry<Object, Object> entry : titanProperties.entrySet()) {
+ for (Entry<Object, Object> entry : janusGraphProperties.entrySet()) {
String key = entry.getKey().toString();
Object value = entry.getValue();
conf.setProperty(key, value);
@@ -70,14 +70,14 @@ public class ExportImportTitanServlet {
conf.setProperty("storage.machine-id-appendix", System.currentTimeMillis() % 1000);
- try(TitanGraph openGraph = Utils.openGraph(conf)){
+ try(JanusGraph openGraph = Utils.openGraph(conf)){
if (openGraph == null) {
Response buildErrorResponse = Utils.buildOkResponse(500, "failed to open graph", null);
return buildErrorResponse;
}
- // Open Titan Graph
+ // Open JanusGraph Graph
Response buildOkResponse = Utils.buildOkResponse(200, "ok man", null);
@@ -85,11 +85,11 @@ public class ExportImportTitanServlet {
}
}
- private Properties convertFileToProperties(File titanPropertiesFile) {
+ private Properties convertFileToProperties(File janusGraphPropertiesFile) {
Properties properties = new Properties();
- try (FileReader fileReader = new FileReader(titanPropertiesFile)){
+ try (FileReader fileReader = new FileReader(janusGraphPropertiesFile)){
properties.load(fileReader);
} catch (Exception e) {
log.error("Failed to convert file to properties", e);
@@ -99,11 +99,11 @@ public class ExportImportTitanServlet {
return properties;
}
- private void printTitanConfigFile(File titanPropertiesFile) {
+ private void printJanusGraphConfigFile(File janusGraphPropertiesFile) {
if (log.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
- try (BufferedReader br = new BufferedReader(new FileReader(titanPropertiesFile))) {
+ try (BufferedReader br = new BufferedReader(new FileReader(janusGraphPropertiesFile))) {
String line;
while ((line = br.readLine()) != null) {
builder.append(line + Utils.NEW_LINE);
@@ -112,7 +112,7 @@ public class ExportImportTitanServlet {
log.debug(builder.toString());
} catch (IOException e) {
- log.error("Cannot print titan properties file", e);
+ log.error("Cannot print janusgraph properties file", e);
}
}
}
@@ -123,7 +123,7 @@ public class ExportImportTitanServlet {
}
- public String exportGraph(TitanGraph graph, String outputDirectory) {
+ public String exportGraph(JanusGraph graph, String outputDirectory) {
String result = null;