aboutsummaryrefslogtreecommitdiffstats
path: root/aai-utils
diff options
context:
space:
mode:
Diffstat (limited to 'aai-utils')
-rw-r--r--aai-utils/pom.xml10
-rw-r--r--aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoader.java14
-rw-r--r--aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoaderMsgs.java64
-rw-r--r--aai-utils/src/main/resources/oxm/OxmModelLoaderMsgs.properties40
-rw-r--r--aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java6
5 files changed, 14 insertions, 120 deletions
diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml
index 3d7b9818..a38890d4 100644
--- a/aai-utils/pom.xml
+++ b/aai-utils/pom.xml
@@ -50,11 +50,6 @@
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
- <!-- Common logging framework -->
- <dependency>
- <groupId>org.onap.aai.logging-service</groupId>
- <artifactId>common-logging</artifactId>
- </dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
@@ -73,6 +68,11 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
diff --git a/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoader.java b/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoader.java
index e9236476..f10a4fde 100644
--- a/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoader.java
+++ b/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoader.java
@@ -39,17 +39,17 @@ import javax.xml.bind.JAXBException;
import org.eclipse.persistence.jaxb.JAXBContextProperties;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
public class OxmModelLoader {
private static final Pattern AAI_OXM_FILE_PATTERN = Pattern.compile("aai_oxm_(.*).xml");
private static Map<String, DynamicJAXBContext> versionContextMap = new ConcurrentHashMap<>();
- private static final Logger LOGGER = LoggerFactory.getInstance().getLogger(OxmModelLoader.class.getName());
public synchronized static void loadModels() throws Exception {
OxmModelLoader.loadModels("classpath*:/oxm/aai_oxm*.xml", AAI_OXM_FILE_PATTERN);
@@ -65,8 +65,7 @@ public class OxmModelLoader {
try {
OxmModelLoader.loadModel(matcher.group(1), resource);
} catch (Exception e) {
- LOGGER.error(OxmModelLoaderMsgs.OXM_LOAD_ERROR,
- "Failed to load " + resource.getFilename() + ": " + e.getMessage());
+ log.error("CRD0503E|Unable to load OXM schema: {}", "Failed to load " + resource.getFilename() + ": " + e.getMessage());
throw new Exception("Failed to load schema");
}
}
@@ -79,7 +78,7 @@ public class OxmModelLoader {
Resource[] resources = resolver.getResources(oxmResourcesPattern);
if (resources.length == 0) {
- LOGGER.error(OxmModelLoaderMsgs.OXM_LOAD_ERROR, "No OXM schema files found on classpath");
+ log.error("CRD0503E|Unable to load OXM schema: {}", "No OXM schema files found on classpath");
throw new Exception("Failed to load schema");
}
return resources;
@@ -129,8 +128,7 @@ public class OxmModelLoader {
.createContextFromOXM(Thread.currentThread().getContextClassLoader(), properties);
versionContextMap.put(version, jaxbContext);
-
- LOGGER.info(OxmModelLoaderMsgs.LOADED_OXM_FILE, resourceName);
+ log.info("CRD0007I|Successfully loaded schema: {}", resourceName);
}
}
diff --git a/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoaderMsgs.java b/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoaderMsgs.java
deleted file mode 100644
index c2794e24..00000000
--- a/aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoaderMsgs.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Copyright © 2017-2018 Amdocs
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.aaiutils.oxm;
-
-import com.att.eelf.i18n.EELFResourceManager;
-
-import org.onap.aai.cl.eelf.LogMessageEnum;
-
-public enum OxmModelLoaderMsgs implements LogMessageEnum {
-
- /**
- * Invalid Model File
- * Arguments:
- * {0} = File/Dir
- * {1} = error
- */
-
- INVALID_OXM_FILE, INVALID_OXM_DIR,
-
- /**
- * Unable to load OXM schema: {0}
- *
- * <p>
- * Arguments:
- * {0} = error
- */
- OXM_LOAD_ERROR,
-
- /**
- * Successfully loaded schema: {0}
- *
- * <p>
- * Arguments:
- * {0} = oxm filename
- */
- LOADED_OXM_FILE;
-
- /**
- * Static initializer to ensure the resource bundles for this class are loaded...
- */
- static {
- EELFResourceManager.loadMessageBundle("oxm/OxmModelLoaderMsgs");
- }
-}
diff --git a/aai-utils/src/main/resources/oxm/OxmModelLoaderMsgs.properties b/aai-utils/src/main/resources/oxm/OxmModelLoaderMsgs.properties
deleted file mode 100644
index d4a5559f..00000000
--- a/aai-utils/src/main/resources/oxm/OxmModelLoaderMsgs.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-#Resource key=Error Code|Message text|Resolution text |Description text
-#######
-#Newlines can be utilized to add some clarity ensuring continuing line
-#has atleast one leading space
-#ResourceKey=\
-# CA0000E\
-# Sample error msg txt\
-# Sample resolution msg\
-# Sample description txt
-#
-######
-#Error code classification category
-#000 Info/Debug
-#100 Permission errors
-#200 Availability errors/Timeouts
-#300 Data errors
-#400 Schema Interface type/validation errors
-#500 Business process errors
-#900 Unknown errors
-#
-########################################################################
-
-INVALID_OXM_FILE=\
- CRD0002I|\
- Unable to parse schema file: {0} due to error : {1}\
-
-OXM_FILE_CHANGED=\
- CRD0003I|\
- OXM file change detected: {0}\
-
-INVALID_OXM_DIR=\
- CRD0005I|\
- Invalid OXM dir: {0}\
-
-LOADED_OXM_FILE=\
- CRD0007I|\
- Successfully loaded schema: {0}
-OXM_LOAD_ERROR=\
- CRD0503E|\
- Unable to load OXM schema: {0}
diff --git a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
index bcfdbebc..356f8708 100644
--- a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
+++ b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ public class OxmModelLoaderTest {
public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() {
Throwable exception = assertThrows(Exception.class, () ->
- OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml",
+ OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml",
Pattern.compile("non_existing_aai_oxm_(.*).xml")));
assertTrue(exception.getMessage().contains("Failed to load schema"));
}