diff options
author | Toine Siebelink <toine.siebelink@est.tech> | 2024-03-26 16:38:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-03-26 16:38:50 +0000 |
commit | bdc3fae4230ea23accfae66f250526d51f3b3210 (patch) | |
tree | b762ee11348917894cc20d2d033e3d14e1511ee0 /cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java | |
parent | 13a9b02bb46f77c6300a93f5e581206e58947e1e (diff) | |
parent | 23378b5639b0563382ac98761ae4cf2d9786453b (diff) |
Merge "Condense Liquibase steps"
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java index a3ebec3c5..4cc8cdaa6 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/AbstractModelLoader.java @@ -70,24 +70,6 @@ abstract class AbstractModelLoader implements ModelLoader { } } - void waitUntilDataspaceIsAvailable(final String dataspaceName) { - log.info("Model Loader start-up, waiting for database to be ready"); - int attemptCount = 0; - while (cpsDataspaceService.getDataspace(dataspaceName) == null) { - if (attemptCount < maximumAttemptCount) { - try { - Thread.sleep(attemptCount * retryTimeMs); - log.info("Retrieving dataspace {} ... {} attempt(s) ", dataspaceName, ++attemptCount); - } catch (final InterruptedException e) { - Thread.currentThread().interrupt(); - } - } else { - throw new NcmpStartUpException("Retrieval of NCMP dataspace failed", - dataspaceName + " not available (yet)"); - } - } - } - void createSchemaSet(final String dataspaceName, final String schemaSetName, final String... resourceNames) { try { final Map<String, String> yangResourcesContentMap = createYangResourcesToContentMap(resourceNames); @@ -100,6 +82,17 @@ abstract class AbstractModelLoader implements ModelLoader { } } + void createDataspace(final String dataspaceName) { + try { + cpsDataspaceService.createDataspace(dataspaceName); + } catch (final AlreadyDefinedException alreadyDefinedException) { + log.debug("Dataspace already exists"); + } catch (final Exception exception) { + log.error("Creating dataspace failed: {} ", exception.getMessage()); + throw new NcmpStartUpException("Creating dataspace failed", exception.getMessage()); + } + } + void deleteUnusedSchemaSets(final String dataspaceName, final String... schemaSetNames) { for (final String schemaSetName : schemaSetNames) { try { |