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);

Source Link

Document

Get a string associated with the given configuration key.

Usage

From source file:dk.itst.oiosaml.configuration.SAMLConfiguration.java

public static String getStringPrefixedWithBRSHome(Configuration conf, String key) {
    return conf.getString(SAMLUtil.OIOSAML_HOME) + "/" + conf.getString(key);
}

From source file:edu.cwru.sepia.Main.java

private static StateCreator getStateCreator(Configuration config) throws JAXBException {
    String mapFilename = config.getString("Map");
    JAXBContext context = JAXBContext.newInstance(XmlState.class);
    XmlState state = (XmlState) context.createUnmarshaller().unmarshal(new File(mapFilename));
    return new XmlStateCreator(state);
}

From source file:com.linkedin.pinot.controller.api.events.MetadataEventNotifierFactory.java

public static MetadataEventNotifierFactory loadFactory(Configuration configuration) {
    MetadataEventNotifierFactory metadataEventNotifierFactory;
    String metadataEventNotifierClassName = configuration.getString(METADATA_EVENT_CLASS_CONFIG);
    if (metadataEventNotifierClassName == null) {
        metadataEventNotifierClassName = DefaultMetadataEventNotifierFactory.class.getName();
    }/*from  w  ww .ja  v  a 2s  .c  o m*/
    try {
        LOGGER.info("Instantiating metadata event notifier factory class {}", metadataEventNotifierClassName);
        metadataEventNotifierFactory = (MetadataEventNotifierFactory) Class
                .forName(metadataEventNotifierClassName).newInstance();
        metadataEventNotifierFactory.init(configuration);
        return metadataEventNotifierFactory;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.indeed.imhotep.builder.tsv.KerberosUtils.java

public static void loginFromKeytab(@Nonnull Configuration props) throws IOException {
    // first try and login from the config
    final String principal = props.getString("kerberos.principal");
    final String keytabPath = props.getString("kerberos.keytab");

    loginFromKeytab(principal, keytabPath);
}

From source file:com.germinus.easyconf.ClassParameter.java

public static Object getNewInstance(Configuration conf, String propertyName)
        throws ClassNotFoundException, IllegalAccessException, InstantiationException {
    String className = conf.getString(propertyName);
    log.info("Returning " + className + " class instance.");
    return ClasspathUtil.locateClass(className).newInstance();
}

From source file:com.parallax.server.blocklyprop.db.utils.DataSourceSetup.java

public static PoolingDataSource connect(Configuration configuration) throws ClassNotFoundException {
    String driver = configuration.getString("database.driver");
    String url = configuration.getString("database.url");
    String username = configuration.getString("database.username");
    String password = configuration.getString("database.password");

    Class.forName(driver);/*from w w  w  .ja v a 2 s .  co  m*/

    //
    // First, we'll create a ConnectionFactory that the
    // pool will use to create Connections.
    // We'll use the DriverManagerConnectionFactory,
    // using the connect string passed in the command line
    // arguments.
    //
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url, username, password);

    //
    // Next we'll create the PoolableConnectionFactory, which wraps
    // the "real" Connections created by the ConnectionFactory with
    // the classes that implement the pooling functionality.
    //
    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,
            null);
    poolableConnectionFactory.setValidationQuery("SELECT 1");
    poolableConnectionFactory.setMaxConnLifetimeMillis(5000);

    //
    // Now we'll need a ObjectPool that serves as the
    // actual pool of connections.
    //
    // We'll use a GenericObjectPool instance, although
    // any ObjectPool implementation will suffice.
    //
    ObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(poolableConnectionFactory);

    // Set the factory's pool property to the owning pool
    poolableConnectionFactory.setPool(connectionPool);

    //
    // Finally, we create the PoolingDriver itself,
    // passing in the object pool we created.
    //
    PoolingDataSource<PoolableConnection> dataSourceInstance = new PoolingDataSource<>(connectionPool);

    for (NeedsDataSource dataSourceUser : dataSourceUsers) {
        dataSourceUser.setDataSource(dataSourceInstance);
    }
    DataSourceSetup.dataSource = dataSourceInstance;
    return dataSourceInstance;
}

From source file:eagle.storage.DataStorageManager.java

/**
 * Get data storage by configuration/*from ww w .j a  v a2s  .c o  m*/
 *
 * @param configuration
 * @return
 * @throws IllegalDataStorageTypeException
 */
public static DataStorage newDataStorage(Configuration configuration) throws IllegalDataStorageTypeException {
    String storageType = configuration.getString(EAGLE_STORAGE_TYPE);
    if (storageType == null) {
        throw new IllegalDataStorageTypeException(EAGLE_STORAGE_TYPE + " is null");
    }
    return newDataStorage(storageType);
}

From source file:com.nesscomputing.quartz.NessQuartzModule.java

private static Duration parseDuration(final Configuration config, final String key) {
    final TimeSpan timeSpan = new TimeSpan(config.getString(key));
    return new Duration(timeSpan.getMillis());
}

From source file:com.nesscomputing.quartz.NessQuartzModule.java

private static DateTime parseStartTime(final Configuration config, final String key) {
    return DAY_HOURS_MINUTES_PARSER.parseDateTime(config.getString(key));
}

From source file:com.gs.obevo.db.apps.reveng.DbMergeInfo.java

public static MutableCollection<DbMergeInfo> parseFromProperties(Configuration config) {
    Set<String> dbs = new HashSet<String>(config.getList("instances"));

    MutableList<DbMergeInfo> dbMergeInfos = Lists.mutable.empty();
    for (String db : dbs) {
        Configuration subset = config.subset(db);
        if (subset.containsKey("inputDir")) {
            File inputDir = new File(subset.getString("inputDir"));
            DbMergeInfo mergeInfo = new DbMergeInfo(db, inputDir);
            if (subset.containsKey("driverClassName")) {
                mergeInfo.setDriverClassName(subset.getString("driverClassName"));
                mergeInfo.setUrl(subset.getString("url"));
                mergeInfo.setUsername(subset.getString("username"));
                mergeInfo.setPassword(subset.getString("password"));
                mergeInfo.setPhysicalSchema(subset.getString("physicalSchema"));
            }/* w  w  w . j a  v a  2  s .  co  m*/

            dbMergeInfos.add(mergeInfo);
        }
    }

    return dbMergeInfos;
}