io.tracee.configuration.TraceePropertiesFileLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tracee-core Show documentation
Show all versions of tracee-core Show documentation
Please refer to https://github.com/tracee/tracee.
package io.tracee.configuration;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
public final class TraceePropertiesFileLoader {
public static final String TRACEE_PROPERTIES_FILE = "META-INF/tracee.properties";
public static final String TRACEE_DEFAULT_PROPERTIES_FILE = "META-INF/tracee.default.properties";
public Properties loadTraceeProperties(String traceePropertiesFile) throws IOException {
final Properties propertiesFromFile = new Properties();
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
final Enumeration traceePropertyFiles = loader.getResources(traceePropertiesFile);
while (traceePropertyFiles.hasMoreElements()) {
final URL url = traceePropertyFiles.nextElement();
InputStream stream = null;
try {
stream = url.openStream();
propertiesFromFile.load(stream);
} finally {
try {
if (stream != null)
stream.close();
} catch (IOException ignored) { }
}
}
return propertiesFromFile;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy