summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/dcaegen2/services/pmmapper/App.java2
-rw-r--r--src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
index b213a45..b52a5f1 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
@@ -71,7 +71,7 @@ public class App {
MetadataFilter metadataFilter = new MetadataFilter(mapperConfig);
MeasConverter measConverter = new MeasConverter();
MeasFilterHandler filterHandler = new MeasFilterHandler(measConverter);
- Mapper mapper = new Mapper(mappingTemplate);
+ Mapper mapper = new Mapper(mappingTemplate, measConverter);
MeasSplitter splitter = new MeasSplitter(measConverter);
XMLValidator validator = new XMLValidator(xmlSchema);
VESPublisher vesPublisher = new VESPublisher(mapperConfig);
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
index 44bbc27..a9b7e86 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
@@ -28,6 +28,7 @@ import lombok.NonNull;
import org.onap.dcaegen2.services.pmmapper.exceptions.MappingException;
import org.onap.dcaegen2.services.pmmapper.exceptions.XMLParseException;
import org.onap.dcaegen2.services.pmmapper.model.Event;
+import org.onap.dcaegen2.services.pmmapper.utils.MeasConverter;
import org.onap.logging.ref.slf4j.ONAPLogAdapter;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
@@ -49,9 +50,11 @@ import java.util.UUID;
public class Mapper {
private static final ONAPLogAdapter logger = new ONAPLogAdapter(LoggerFactory.getLogger(Mapper.class));
private Template mappingTemplate;
+ private MeasConverter converter;
- public Mapper(@NonNull Path pathToTemplate) {
+ public Mapper(@NonNull Path pathToTemplate, MeasConverter converter) {
logger.unwrap().trace("Constructing Mapper from {}", pathToTemplate);
+ this.converter = converter;
Configuration configuration = new Configuration(Configuration.VERSION_2_3_28);
configuration.setTagSyntax(Configuration.ANGLE_BRACKET_TAG_SYNTAX);
try {
@@ -72,7 +75,8 @@ public class Mapper {
logger.unwrap().info("Mapping event");
NodeModel pmNodeModel;
try {
- pmNodeModel = NodeModel.parse(new InputSource(new StringReader(event.getBody())));
+ String measCollecFile = converter.convert(event.getMeasCollecFile());
+ pmNodeModel = NodeModel.parse(new InputSource(new StringReader(measCollecFile)));
} catch (IOException | SAXException | ParserConfigurationException exception) {
logger.unwrap().error("Failed to parse input as XML", exception);
throw new XMLParseException("Failed to parse input as XML", exception);