Class EmbeddedFileHelper
java.lang.Object
org.sentrysoftware.metricshub.engine.strategy.utils.EmbeddedFileHelper
The
EmbeddedFileHelper class provides utility methods for handling embedded files in various contexts, such as
command lines, AWK directives, headers, and bodies. It allows finding and processing file references in a given string.
The class is designed to have a private no-argument constructor to prevent instantiation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<EmbeddedFile> findEmbeddedFile(@NonNull String value, @NonNull Map<Integer, EmbeddedFile> connectorEmbeddedFiles, @NonNull String hostname, @NonNull String connectorId) Finds one embedded file that is referenced in the given string.static Map<Integer, EmbeddedFile> findEmbeddedFiles(@NonNull String value, @NonNull Map<Integer, EmbeddedFile> connectorEmbeddedFiles) Finds all the embedded files that are referenced in the given string.
-
Constructor Details
-
EmbeddedFileHelper
public EmbeddedFileHelper()
-
-
Method Details
-
findEmbeddedFiles
public static Map<Integer,EmbeddedFile> findEmbeddedFiles(@NonNull @NonNull String value, @NonNull @NonNull Map<Integer, EmbeddedFile> connectorEmbeddedFiles) Finds all the embedded files that are referenced in the given string.- Parameters:
value- The value can be a command line or any value referencing multiple embedded files.connectorEmbeddedFiles- All the embedded files referenced in the connector.- Returns:
- A map of the file reference to
EmbeddedFileinstance.
-
findEmbeddedFile
public static Optional<EmbeddedFile> findEmbeddedFile(@NonNull @NonNull String value, @NonNull @NonNull Map<Integer, EmbeddedFile> connectorEmbeddedFiles, @NonNull @NonNull String hostname, @NonNull @NonNull String connectorId) Finds one embedded file that is referenced in the given string.- Parameters:
value- The value which references the embedded file, it can be an AWK directive, header, body, etc.connectorEmbeddedFiles- All the embedded files referenced in the connector.hostname- The hostname of the host being monitored and used to log the failure where many embedded files are retrieved.connectorId- The identifier of the connector used for logging.- Returns:
- An Optional of
EmbeddedFileinstance.
-