Example usage for org.apache.commons.configuration PropertiesConfiguration getPath

List of usage examples for org.apache.commons.configuration PropertiesConfiguration getPath

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration getPath.

Prototype

public String getPath() 

Source Link

Document

Returns the full path to the file this configuration is based on.

Usage

From source file:com.vmware.bdd.security.TestEncryptionGuard.java

@BeforeClass
public static void setUp() throws Exception {
    PropertiesConfiguration config = new PropertiesConfiguration(VC_PROPERTIES_NAME);
    String fileName = config.getPath();
    String path = fileName.substring(0, fileName.length() - VC_PROPERTIES_NAME.length());
    String keyFilePath = path + "guard.key";
    Configuration.setString("cms.guard_keystore", keyFilePath);
}

From source file:edu.kit.dama.ui.simon.util.SimonConfigurator.java

private void setupProbes() {
    for (PropertiesConfiguration config : configs) {
        try {//from   w  ww.  j  a v a 2s  .c om
            String probeClass = config.getString("probe.class");
            String probeName = config.getString("probe.name",
                    "Unnamed Probe (" + config.getFile().getName() + ")");
            String probeCategory = config.getString("probe.category");
            if (probeClass != null) {
                LOGGER.debug(" - Creating instance for probe {}", probeName);
                Class clazz = Class.forName(probeClass);
                AbstractProbe probe = (AbstractProbe) clazz.newInstance();
                probe.setName(probeName);
                probe.setCategory(probeCategory);
                LOGGER.debug(" - Configuring probe instance");
                if (probe.configure(config)) {
                    LOGGER.debug("Probe successfully configured.");
                } else {
                    LOGGER.info("Failed to configure probe " + probeName + ". Ignoring probe.");
                }
                probes.add(probe);
            } else {
                LOGGER.info("Property probe.class for probe " + probeName + " not defined. Ignoring probe.");
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
            LOGGER.info("Failed to instantiate probe from file " + config.getPath() + ". Ignoring probe.", ex);
        }
    }
}