Skip to content
Snippets Groups Projects
Commit 4a1a89d5 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5156 Accept FIM messages in XTA adapter

schema classpath handling
parent 0dda7dca
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import io.micrometer.common.util.StringUtils;
import jakarta.annotation.PostConstruct;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
......@@ -29,6 +30,9 @@ public class FimService {
@Autowired
private FimDataMapper fimDataMapper;
@Autowired
private ResourceLoader resourceLoader;
@Autowired
private final List<FimSchemeAdapter> fimSchemeAdapters = new ArrayList<>();
......@@ -55,7 +59,7 @@ public class FimService {
private FimScheme loadFimScheme(final String path) throws ParserConfigurationException, IOException, SAXException {
final DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
final Document doc = builder.parse(new File(path));
final Document doc = builder.parse(resourceLoader.getResource("classpath:" + path).getFile());
final String targetNamespace = doc.getDocumentElement().getAttribute("targetNamespace");
final FimSchemeIdentifier fimSchemeIdentifier = FimSchemeIdentifier.fromString(targetNamespace);
final FimSchemeAdapter fimSchemeAdapter = fimSchemeAdapterCatalogue.getOrDefault(fimSchemeIdentifier, DEFAULT_FIM_SCHEME_ADAPTER);
......
fim:
schemeLocations:
- src/main/resources/fim-s17000652_1.4/S17000652V1.4_xfall.xsd
\ No newline at end of file
- fim-s17000652_1.4/S17000652V1.4_xfall.xsd
\ No newline at end of file
fim:
schemeLocations:
- src/main/resources/fim-s17000652_1.4/S17000652V1.4_xfall.xsd
- src/test/resources/test2/test2.xsd
\ No newline at end of file
- fim-s17000652_1.4/S17000652V1.4_xfall.xsd
- test2/test2.xsd
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment