Example usage for org.apache.commons.configuration Configuration getString

List of usage examples for org.apache.commons.configuration Configuration getString

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getString.

Prototype

String getString(String key, String defaultValue);

Source Link

Document

Get a string associated with the given configuration key.

Usage

From source file:dk.itst.oiosaml.sp.metadata.CRLChecker.java

private boolean checkCRLSignature(X509CRL crl, X509Certificate certificate, Configuration conf) {
    if (conf.getString(Constants.PROP_CRL_TRUSTSTORE, null) == null)
        return true;

    CredentialRepository cr = new CredentialRepository();
    String location = SAMLConfiguration.getStringPrefixedWithBRSHome(conf, Constants.PROP_CRL_TRUSTSTORE);
    cr.getCertificate(location, conf.getString(Constants.PROP_CRL_TRUSTSTORE_PASSWORD), null);

    for (X509Credential cred : cr.getCredentials()) {
        try {/*from   w  w w . j ava  2s  .  com*/
            crl.verify(cred.getPublicKey());
            return true;
        } catch (Exception e) {
            log.debug("CRL not signed by " + cred);
        }
    }
    return false;
}

From source file:com.microrisc.simply.iqrf.dpa.v201.init.DPA_InitObjectsFactory.java

/**
 * Creates user peripherals to device interface mapping.
 * @param configuration configuration to use
 * @return user peripherals to device interface mapping
 * @throws Exception //from w  w  w  . j  a v  a  2s .  com
 */
private PeripheralToDevIfaceMapper createUserPerToDevIfaceMapper(Configuration configuration) throws Exception {
    String factoryClassName = configuration.getString("dpa.perToDevIfaceMapper.factory.class", "");
    // if user hasn't defined his mapping
    if (factoryClassName.isEmpty()) {
        return null;
    }

    Class factoryClass = Class.forName(factoryClassName);
    java.lang.reflect.Constructor constructor = factoryClass.getConstructor();
    PeripheralToDevIfaceMapperFactory factory = (PeripheralToDevIfaceMapperFactory) constructor.newInstance();
    return factory.createPeripheralToDevIfaceMapper();
}

From source file:com.microrisc.simply.network.udp.UDPNetworkLayerFactory.java

/**
 * Creates network layer parameters encapsulation object.
 * @param connectionStorage//from  w w w. j  a  va2s . c o  m
 * @param configuration
 * @return network layer parameters encapsulation object
 */
private NetworkLayerParams createNetworkLayerParams(NetworkConnectionStorage connectionStorage,
        Configuration configuration) {
    String localAddress = configuration.getString("networkLayer.type.udp.localaddress", "");
    int localPort = configuration.getInt("networkLayer.type.udp.localport", -1);
    String remoteAddress = configuration.getString("networkLayer.type.udp.remoteaddress", "");
    int remotePort = configuration.getInt("networkLayer.type.udp.remoteport", -1);

    int maxRecvPacketSize = configuration.getInt("networkLayer.type.udp.maxRecvPacketSize",
            UDPNetworkLayerMultinet.MAX_RECEIVED_PACKET_SIZE);
    int receptionTimeout = configuration.getInt("networkLayer.type.udp.receptionTimeout",
            UDPNetworkLayer.RECEPTION_TIMEOUT_DEFAULT);

    return new NetworkLayerParams(connectionStorage, localAddress, localPort, remoteAddress, remotePort,
            maxRecvPacketSize, receptionTimeout);
}

From source file:com.appeligo.config.ConfigurationTest.java

public void testConfigurationInitialization() throws Exception {
    Configuration configuration = ConfigurationService.getConfiguration("system");
    assertNotNull("No configuration object found.", configuration);
    assertEquals("Hello", configuration.getString("baseValue", "Goodbye"));
    assertEquals("Goodbye", configuration.getString("testValue", "Hello"));
}

From source file:edu.kit.dama.mdm.audit.impl.RabbitMQPublisher.java

@Override
public boolean performCustomConfiguration(Configuration pConfig) throws ConfigurationException {
    LOGGER.debug("Configurung RabbitMQPublisher");
    hostname = pConfig.getString(HOSTNAME_PROPERTY_KEY, "localhost");
    LOGGER.debug("Publisher hostname set to '{}'", hostname);
    exchangeName = pConfig.getString(EXCHANGE_NAME_KEY, "audit");
    LOGGER.debug("Publisher exchange name set to '{}'", exchangeName);
    return true;//  w  w w.ja  v  a2  s.com
}

From source file:com.boozallen.cognition.ingest.storm.bolt.starter.LineRegexReplaceInRegionBolt.java

void configureDelimiter(Configuration conf) {
    delimiter = IngestUtilities.getDelimiterByName(conf.getString(DELIMITER, "SPACE"));
}

From source file:io.servicecomb.serviceregistry.definition.MicroserviceDefinition.java

private void initCombinedFrom(List<ConfigModel> configModels) {
    for (ConfigModel model : configModels) {
        Configuration conf = ConfigUtil.createLocalConfig(Arrays.asList(model));
        String name = conf.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, DEFAULT_MICROSERVICE_NAME);
        if (!StringUtils.isEmpty(name)) {
            checkMicroserviceName(name);
            combinedFrom.add(name);/*  w ww. j  a va 2  s . co  m*/
        }
    }

    combinedFrom.remove(microserviceName);
}

From source file:edu.kit.dama.rest.util.auth.impl.OAuthAuthenticator.java

@Override
public boolean performCustomConfiguration(Configuration pConfig) throws ConfigurationException {
    defaultConsumerKey = pConfig.getString(DEFAULT_CONSUMER_KEY_PROPERTY_KEY, "DefaultConsumer");
    defaultConsumerSecret = pConfig.getString(DEFAULT_CONSUMER_SECRET_PROPERTY_KEY, "secret");
    return true;/* w  w  w .ja v  a 2 s .  c  om*/
}

From source file:com.parallax.server.blocklyprop.servlets.HelpServlet.java

@Inject
public void setConfiguration(Configuration configuration) {
    this.configuration = configuration;

    String destinationDirectory = configuration.getString("help.destination", DEFAULT_DESTINATION_DIRECTORY);
    destinationDirectoryFile = new File(new File(System.getProperty("user.home")), destinationDirectory);
}

From source file:cross.datastructures.fragments.FileFragmentFactory.java

/**
 *
 * @param cfg/*from  ww w.  j a v  a  2s. c o m*/
 */
@Override
public void configure(final Configuration cfg) {
    this.inputBasedir = cfg.getString("input.basedir", "");
}