summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-08-30 12:24:19 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-08-30 12:24:19 -0400
commit7bbeeda4e4ff25a073c9d1a8992fe68aaf470e6b (patch)
tree4c9f0476f1b08bd2625b4d421e5485cbddff399e /ms/controllerblueprints/modules
parentd39c13bf2aff5f80029a4b8beb949f1f4a9ed189 (diff)
Refactor catalog service to blueprint processor.
Change-Id: Ia4bfc7c1b3ffb4020458f18deb71a2cf451ab65e Issue-ID: CCSDK-1663 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/db-resources/pom.xml48
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt87
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt91
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt90
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt21
-rw-r--r--ms/controllerblueprints/modules/pom.xml1
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml4
7 files changed, 0 insertions, 342 deletions
diff --git a/ms/controllerblueprints/modules/db-resources/pom.xml b/ms/controllerblueprints/modules/db-resources/pom.xml
deleted file mode 100644
index 58d395ee0..000000000
--- a/ms/controllerblueprints/modules/db-resources/pom.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.6.1-SNAPSHOT</version>
- </parent>
- <artifactId>db-resources</artifactId>
- <name>Controller Blueprints DB Resources</name>
-
- <properties>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
deleted file mode 100644
index 7244e00e5..000000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- * Modifications Copyright © 2019 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints.db.resources
-
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.slf4j.LoggerFactory
-import java.io.File
-import java.nio.file.Path
-import javax.persistence.MappedSuperclass
-
-@MappedSuperclass
-abstract class BlueprintCatalogServiceImpl(
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintValidator: BluePrintValidatorService) : BluePrintCatalogService {
-
- private val log = LoggerFactory.getLogger(BlueprintCatalogServiceImpl::class.java)!!
-
- override suspend fun saveToDatabase(processingId: String, blueprintFile: File, validate: Boolean): String {
-
- var archiveFile: File? = null
- var workingDir: String? = null
-
- if (blueprintFile.isDirectory) {
- log.info("Save processing($processingId) Working Dir(${blueprintFile.absolutePath})")
- workingDir = blueprintFile.absolutePath
- archiveFile = normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath, processingId, "cba.zip")
-
- if (!BluePrintArchiveUtils.compress(blueprintFile, archiveFile)) {
- throw BluePrintException("Fail to compress blueprint")
- }
- } else {
- // Compressed File
- log.info("Save processing($processingId) CBA(${blueprintFile.absolutePath})")
- workingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, processingId)
- archiveFile = blueprintFile
- // Decompress the CBA file to working Directory
- blueprintFile.deCompress(workingDir)
- }
-
- var valid = BluePrintConstants.FLAG_N
- if (validate) {
- blueprintValidator.validateBluePrints(workingDir!!)
- valid = BluePrintConstants.FLAG_Y
- }
-
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(processingId, workingDir!!)
- val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = processingId
- metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID] = valid
-
- save(metadata, archiveFile)
-
- return processingId
- }
-
- override suspend fun getFromDatabase(name: String, version: String, extract: Boolean): Path = get(name, version,
- extract)
- ?: throw BluePrintException("Could not find blueprint $name:$version from database")
-
- override suspend fun deleteFromDatabase(name: String, version: String) = delete(name, version)
-
- abstract suspend fun save(metadata: MutableMap<String, String>, archiveFile: File)
- abstract suspend fun get(name: String, version: String, extract: Boolean): Path?
- abstract suspend fun delete(name: String, version: String)
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt
deleted file mode 100644
index a2c37593b..000000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelContentRepository.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints.db.resources.repository
-
-import org.jetbrains.annotations.NotNull
-import java.util.Optional
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
-
-/**
- * @param <T> Model
- * @param <B> ModelContent
- */
-@NoRepositoryBean
-interface ModelContentRepository<T, B> : JpaRepository<B, String> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<T>
- */
- @NotNull
- override fun findById(@NotNull id: String): Optional<B>
-
- /**
- * This is a findTopByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return B?
- */
- fun findTopByBlueprintModelAndContentType(blueprintModel: T, contentType: String): B?
-
- /**
- * This is a findByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return List<B>
- */
- fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B>
-
- /**
- * This is a findByBlueprintModel method
- *
- * @param blueprintModel T
- * @return List<B>
- */
- fun findByBlueprintModel(blueprintModel: T): List<B>
-
- /**
- * This is a findByBlueprintModelAndContentTypeAndName method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @param name name
- * @return B?
- */
- fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T, contentType: String, name: String): B?
-
- /**
- * This is a deleteByMdeleteByBlueprintModelodelName method
- *
- * @param blueprintModel T
- */
- fun deleteByBlueprintModel(blueprintModel: T)
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- override fun deleteById(@NotNull id: String)
-
-}
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt
deleted file mode 100644
index c00b7b6e4..000000000
--- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/repository/ModelRepository.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints.db.resources.repository
-
-import org.jetbrains.annotations.NotNull
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
-import java.util.*
-import javax.transaction.Transactional
-
-/**
- * @param <T> Model
- */
-@NoRepositoryBean
-interface ModelRepository<T> : JpaRepository<T, String> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<T>
- */
- @NotNull
- override fun findById(@NotNull id: String): Optional<T>
-
- /**
- * This is a findByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- * @return T?
- */
- fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): T?
-
- /**
- * This is a findTopByArtifactNameOrderByArtifactIdDesc method
- *
- * @param artifactName artifactName
- * @return T?
- */
- fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): T?
-
- /**
- * This is a findTopByArtifactName method
- *
- * @param artifactName artifactName
- * @return List<T>
- */
- fun findTopByArtifactName(artifactName: String): List<T>
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags tags
- * @return List<T>
- */
- fun findByTagsContainingIgnoreCase(tags: String): List<T>
-
- /**
- * This is a deleteByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- */
- @Transactional
- fun deleteByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String)
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- override fun deleteById(@NotNull id: String)
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt b/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt
deleted file mode 100644
index 9c08301de..000000000
--- a/ms/controllerblueprints/modules/db-resources/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImplTest.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2019 Bell Canada
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.controllerblueprints.db.resources
-
-// TODO
-class BlueprintCatalogServiceImplTest \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index 0b3d05192..07121226f 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -30,7 +30,6 @@
<modules>
<module>blueprint-core</module>
<module>resource-dict</module>
- <module>db-resources</module>
<module>blueprint-validation</module>
<module>service</module>
</modules>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index d06669eb6..0d822514a 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -38,10 +38,6 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-validation</artifactId>
</dependency>
<dependency>