summaryrefslogtreecommitdiffstats
path: root/ms/error-catalog/services/src
diff options
context:
space:
mode:
authorBrinda Santh Muthuramalingam <brindasanth@in.ibm.com>2020-03-19 12:51:30 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-19 12:51:30 +0000
commitfa12b4f311e77612e4e856b209a8c81c71f0b29d (patch)
tree0811c8b874e97a60213ab18d208b779a146f0ca3 /ms/error-catalog/services/src
parent114c5c16fe51231af038f30ed7ffaee2b22a3431 (diff)
parent8865ccde1a486e203a3812813f5350ddb726265f (diff)
Merge "Fix GroupId and package name in Error Catalog"
Diffstat (limited to 'ms/error-catalog/services/src')
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogConfiguration.kt)4
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogDBService.kt)12
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogExceptionHandler.kt)6
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogLoadService.kt)22
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogService.kt)26
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogServiceExtensions.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogServiceExtensions.kt)4
-rwxr-xr-xms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/Domain.kt)2
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/ErrorMessageModel.kt)2
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/DomainRepository.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/DomainRepository.kt)4
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/ErrorMessageModelRepository.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/ErrorMessageModelRepository.kt)4
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/utils/ErrorCatalogUtils.kt (renamed from ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/utils/ErrorCatalogUtils.kt)2
11 files changed, 45 insertions, 43 deletions
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogConfiguration.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
index a73401724..f0a75e087 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogConfiguration.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.EnableConfigurationProperties
@@ -30,5 +30,5 @@ open class ErrorCatalogConfiguration
open class ErrorCatalogProperties {
lateinit var type: String
lateinit var applicationId: String
- var errorDefinitionDir: String = ""
+ var errorDefinitionDir: String? = null
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogDBService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
index 841bcf539..95b44e683 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogDBService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
-import org.onap.ccsdk.error.catalog.core.ErrorMessageLibConstants
-import org.onap.ccsdk.error.catalog.services.domain.Domain
-import org.onap.ccsdk.error.catalog.services.domain.ErrorMessageModel
-import org.onap.ccsdk.error.catalog.services.repository.DomainRepository
-import org.onap.ccsdk.error.catalog.services.repository.ErrorMessageModelRepository
+import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants
+import org.onap.ccsdk.cds.error.catalog.services.domain.Domain
+import org.onap.ccsdk.cds.error.catalog.services.domain.ErrorMessageModel
+import org.onap.ccsdk.cds.error.catalog.services.repository.DomainRepository
+import org.onap.ccsdk.cds.error.catalog.services.repository.ErrorMessageModelRepository
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogExceptionHandler.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
index 91fa97b77..88e2f4522 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogExceptionHandler.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
-import org.onap.ccsdk.error.catalog.core.ErrorCatalogException
-import org.onap.ccsdk.error.catalog.core.ErrorPayload
+import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalogException
+import org.onap.ccsdk.cds.error.catalog.core.ErrorPayload
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogLoadService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
index b8a649eb0..ca7d72b50 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogLoadService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
-import org.onap.ccsdk.error.catalog.core.ErrorMessageLibConstants
-import org.onap.ccsdk.error.catalog.core.logger
-import org.onap.ccsdk.error.catalog.services.domain.ErrorMessageModel
+import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants
+import org.onap.ccsdk.cds.error.catalog.core.logger
+import org.onap.ccsdk.cds.error.catalog.services.domain.ErrorMessageModel
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.stereotype.Service
+import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import java.io.InputStream
@@ -99,11 +100,10 @@ open class ErrorCatalogLoadDBService(
havingValue = ErrorMessageLibConstants.ERROR_CATALOG_TYPE_PROPERTIES
)
open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: ErrorCatalogProperties) :
- ErrorCatalogLoadService {
+ ErrorCatalogLoadService {
private val propertyFileName = ErrorMessageLibConstants.ERROR_CATALOG_PROPERTIES_FILENAME
- private var propertyFileBaseDirectory = Paths.get(errorCatalogProperties.errorDefinitionDir)
- private var propertyFilePath = propertyFileBaseDirectory.resolve(propertyFileName)
+ private lateinit var propertyFile: File
private var log = logger(ErrorCatalogLoadPropertyService::class)
@@ -111,6 +111,8 @@ open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: E
override suspend fun loadErrorCatalog() {
log.info("Application ID: ${errorCatalogProperties.applicationId} > Initializing error catalog message from properties...")
+ val propertyDir = errorCatalogProperties.errorDefinitionDir ?: ErrorMessageLibConstants.ERROR_CATALOG_PROPERTIES_DIRECTORY
+ propertyFile = Paths.get(propertyDir, propertyFileName).toFile().normalize()
properties = parseErrorMessagesProps()
}
@@ -129,14 +131,14 @@ open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: E
var inputStream: InputStream? = null
val props = Properties()
try {
- inputStream = propertyFilePath.toFile().inputStream()
+ inputStream = propertyFile.inputStream()
props.load(inputStream)
} catch (e: FileNotFoundException) {
- log.error("Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName}' " +
+ log.error("Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName' " +
"not found in the application directory.")
} catch (e: IOException) {
log.error("Application ID: ${errorCatalogProperties.applicationId} > Fail to load property file " +
- "'$propertyFileName}' for message errors.")
+ "'$propertyFileName' for message errors.")
} finally {
inputStream!!.close()
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
index e55e552d9..91f817133 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.error.catalog.core.ErrorCatalog
-import org.onap.ccsdk.error.catalog.core.ErrorCatalogException
-import org.onap.ccsdk.error.catalog.core.ErrorMessageLibConstants
-import org.onap.ccsdk.error.catalog.core.ErrorPayload
-import org.onap.ccsdk.error.catalog.core.GrpcErrorCodes
-import org.onap.ccsdk.error.catalog.core.HttpErrorCodes
-import org.onap.ccsdk.error.catalog.services.utils.ErrorCatalogUtils
+import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalog
+import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalogException
+import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants
+import org.onap.ccsdk.cds.error.catalog.core.ErrorPayload
+import org.onap.ccsdk.cds.error.catalog.core.GrpcErrorCodes
+import org.onap.ccsdk.cds.error.catalog.core.HttpErrorCodes
+import org.onap.ccsdk.cds.error.catalog.services.utils.ErrorCatalogUtils
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.stereotype.Service
import javax.annotation.PostConstruct
@@ -70,11 +70,11 @@ open class ErrorCatalogService(private var errorCatalogLoadService: ErrorCatalog
}
return ErrorCatalog(
- errorCatalogException.name,
- errorCatalogException.domain,
- errorCode,
- action,
- errorCause
+ errorCatalogException.name,
+ errorCatalogException.domain,
+ errorCode,
+ action,
+ errorCause
)
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogServiceExtensions.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogServiceExtensions.kt
index 41481623a..bb4a8f15e 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/ErrorCatalogServiceExtensions.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogServiceExtensions.kt
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services
+package org.onap.ccsdk.cds.error.catalog.services
-import org.onap.ccsdk.error.catalog.core.ErrorPayload
+import org.onap.ccsdk.cds.error.catalog.core.ErrorPayload
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/Domain.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
index 50a05b231..7ade1c2a2 100755
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/Domain.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services.domain
+package org.onap.ccsdk.cds.error.catalog.services.domain
import java.io.Serializable
import javax.persistence.CascadeType
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/ErrorMessageModel.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
index 73e143095..a4e92af48 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/domain/ErrorMessageModel.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services.domain
+package org.onap.ccsdk.cds.error.catalog.services.domain
import java.io.Serializable
import java.util.UUID
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/DomainRepository.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/DomainRepository.kt
index 700340b10..197e385e0 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/DomainRepository.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/DomainRepository.kt
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services.repository
+package org.onap.ccsdk.cds.error.catalog.services.repository
-import org.onap.ccsdk.error.catalog.services.domain.Domain
+import org.onap.ccsdk.cds.error.catalog.services.domain.Domain
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/ErrorMessageModelRepository.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/ErrorMessageModelRepository.kt
index 084474970..4a0f78672 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/repository/ErrorMessageModelRepository.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/repository/ErrorMessageModelRepository.kt
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services.repository
+package org.onap.ccsdk.cds.error.catalog.services.repository
-import org.onap.ccsdk.error.catalog.services.domain.ErrorMessageModel
+import org.onap.ccsdk.cds.error.catalog.services.domain.ErrorMessageModel
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/utils/ErrorCatalogUtils.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/utils/ErrorCatalogUtils.kt
index 673082eed..967d3560c 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/error/catalog/services/utils/ErrorCatalogUtils.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/utils/ErrorCatalogUtils.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.ccsdk.error.catalog.services.utils
+package org.onap.ccsdk.cds.error.catalog.services.utils
object ErrorCatalogUtils {
private const val REGEX_PATTERN = "^cause=(.*),action=(.*)"