Class EmbeddedFilesResolver
java.lang.Object
org.sentrysoftware.metricshub.engine.connector.parser.EmbeddedFilesResolver
Resolves and internalizes embedded files within a JsonNode.
-
Constructor Summary
ConstructorsConstructorDescriptionEmbeddedFilesResolver(com.fasterxml.jackson.databind.JsonNode connector, Path connectorDirectory, Set<URI> parents) Constructs an EmbeddedFilesResolver with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionfindAbsoluteUri(String fileName, Path connectorDirectory) Find the absolute URI of the file in parametervoidLook for all references of embedded files that look like: $file("...")$, find the referenced file, add its content in a new node at the end of the connector and replace the reference to the external file by a reference to the internalized embedded file
-
Constructor Details
-
EmbeddedFilesResolver
public EmbeddedFilesResolver(com.fasterxml.jackson.databind.JsonNode connector, Path connectorDirectory, Set<URI> parents) Constructs an EmbeddedFilesResolver with the given parameters.- Parameters:
connector- The JsonNode representing the connector.connectorDirectory- The directory of the connector.parents- Set of parent directories URIs.
-
-
Method Details
-
internalize
Look for all references of embedded files that look like: $file("...")$, find the referenced file, add its content in a new node at the end of the connector and replace the reference to the external file by a reference to the internalized embedded file- Throws:
IOException- If there is an issue finding the embedded file or processing the JSON structure.
-
findAbsoluteUri
Find the absolute URI of the file in parameter- Parameters:
fileName- The name or relative path of the fileconnectorDirectory- The name of the connector directory where to look for the file- Returns:
- The absolute path of the file if found, null otherwise.
- Throws:
IllegalStateException- when the file can't be found
-