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:com.boozallen.cognition.ingest.storm.bolt.enrich.ElasticSearchJsonBolt.java

void configureBolt(Configuration conf) {
    esJsonField = conf.getString(ES_JSON_FIELD, ES_JSON_FIELD_DEFAULT);
    indexName = conf.getString(INDEX_NAME, INDEX_NAME_DEFAULT);
    indexField = conf.getString(INDEX_FIELD, INDEX_FIELD_DEFAULT);
}

From source file:net.sf.jclal.listener.RealScenarioListener.java

/**
 * @param configuration/*www. j  a  va2s.c  om*/
 *            The configuration object for the Real Scenario Listener.
 *
 *            The XML labels supported are:
 *
 *            <ul>
 *            <li>informative-instances= filepath where will be saved the
 *            informative instances</li>
 *            </ul>
 */
@Override
public void configure(Configuration configuration) {

    super.configure(configuration);

    String informative = configuration.getString("informative-instances", getInformativeInstances());
    setInformativeInstances(informative);
}

From source file:com.appeligo.search.entity.Message.java

/**
 * An array of type objects used to provide keys into the message template repository
 * when a default message format can be used to craft a message.
 * @author fear/*from   w  w  w  . jav a2  s  .  c o  m*/
public enum MessageType {
   REGISTRATION,
   SMS_VERIFY,
   WELCOME,
   FEEDBACK,
   KEYWORD_ALERT,
   PROGRAM_REMINDER,
   PASSWORD_RESET,
}
 */

public Message() {
    Configuration config = ConfigUtils.getMessageConfig();
    setFrom(config.getString("defaultFrom", "noreply@fliptv.com"));
    setPriority(1);
}

From source file:com.evolveum.midpoint.web.page.admin.resources.PageResourceVisualization.java

@NotNull
private ResourceVisualizationDto loadVisualizationDto() {

    Task task = createSimpleTask(OPERATION_EXPORT_DATA_MODEL);
    OperationResult result = task.getResult();
    String dot;//from   w  ww  . j ava  2 s  . c  o  m
    try {
        resourceObject.revive(getPrismContext());
        dot = getModelDiagnosticService().exportDataModel(resourceObject.asObjectable(),
                DataModelVisualizer.Target.DOT, task, result);
    } catch (CommonException | RuntimeException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't export the data model for {}", e,
                ObjectTypeUtil.toShortString(resourceObject));
        showResult(result);
        throw redirectBackViaRestartResponseException();
    }

    String renderer = DEFAULT_RENDERER;
    Configuration dotConfig = getMidpointConfiguration().getConfiguration(DOT_CONFIGURATION);
    if (dotConfig != null) {
        renderer = dotConfig.getString(RENDERER, renderer);
    }

    renderer += " -Tsvg";
    StringBuilder output = new StringBuilder();
    try {
        SystemUtil.executeCommand(renderer, dot, output);
        return new ResourceVisualizationDto(dot, output.toString(), null);
    } catch (IOException | RuntimeException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't execute SVG renderer command: {}", e, renderer);
        return new ResourceVisualizationDto(dot, null, e);
    }
}

From source file:cross.io.InputDataFactory.java

@Override
public void configure(final Configuration cfg) {
    if (cfg.containsKey("input.dataInfo")) {
        this.input = cfg.getStringArray("input.dataInfo");
    }//from   ww  w .ja va 2s  .  com
    this.basedir = cfg.getString("input.basedir", "");
    if (this.basedir.isEmpty() || this.basedir.equals(".")) {
        log.debug("Configuration has no value for input.basedir! {}", this.basedir);
        this.basedir = System.getProperty("user.dir");
    }
    this.recurse = cfg.getBoolean("input.basedir.recurse", false);
}

From source file:com.appeligo.search.entity.Message.java

/**
 * Will definitely need some localization at some point.
 * @param type/*  www  . ja v  a2s .c  o  m*/
 * @param context
 * @throws MessageContextException
 */
public void createContent(String type, Map<String, String> context) throws MessageContextException {
    Configuration config = ConfigUtils.getMessageConfig();
    String subject = config.getString(type + ".subject", "No subject");
    String[] bodyComponents = config.getStringArray(type + ".body");
    StringBuilder sb = new StringBuilder();
    for (String bodyComponent : bodyComponents) {
        if (sb.length() != 0) {
            sb.append(", ");
        }
        sb.append(bodyComponent);
    }
    String body = sb.toString();
    String mimeType = config.getString(type + ".mimeType", "text/plain");
    this.setMimeType(mimeType);
    subject = macroReplacement(subject, context);
    body = macroReplacement(body, context);
    if (log.isDebugEnabled()) {
        log.debug("Preparing message from: " + subject + ":" + body + ":" + mimeType);
    }
    this.setSubject(subject);
    this.setBody(body);

    this.setFrom(config.getString(type + ".from", this.getFrom()));
}

From source file:com.boozallen.cognition.ingest.storm.topology.ConfigurableIngestTopology.java

void configureStreamGrouping(String prevComponent, Configuration boltConf, BoltDeclarer declarer)
        throws ConfigurationException {

    String streamType = boltConf.getString(STREAM_GROUPING_CONF_TYPE, STREAM_GROUPING_LOCAL_OR_SHUFFLE);
    String streamId = boltConf.getString(STREAM_ID, Utils.DEFAULT_STREAM_ID);

    if (StringUtils.equals(streamType, STREAM_GROUPING_FIELDS)) {
        configureStreamFieldsGrouping(prevComponent, streamId, boltConf, declarer);
    } else if (StringUtils.equals(streamType, STREAM_GROUPING_LOCAL_OR_SHUFFLE)) {
        declarer.localOrShuffleGrouping(prevComponent, streamId);
    } else {//from   www.  ja v a 2s . com
        declarer.shuffleGrouping(prevComponent, streamId);
    }
}

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

private UDPNetworkLayerMultinet createClientMultiNetworkLayer(NetworkConnectionStorage connectionStorage,
        Configuration configuration) throws Exception {
    NetworkLayerParams networkParams = createNetworkLayerParams(connectionStorage, configuration);
    // if not set, "01" is default
    String version = configuration.getString("networkLayer.type.udp.version", "01");
    if (!version.equals("01")) {
        throw new Exception("Unsupported network layer version: " + version);
    }//w  w  w .j  ava 2  s.  c om

    return new UDPNetworkLayerMultinet(networkParams.connectionStorage, networkParams.localAddress,
            networkParams.localPort, networkParams.maxRecvPacketSize, networkParams.receptionTimeout);
}

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

private UDPNetworkLayer createClientSingleNetworkLayer(NetworkConnectionStorage connectionStorage,
        Configuration configuration) throws Exception {
    NetworkLayerParams networkParams = createNetworkLayerParams(connectionStorage, configuration);
    // if not set, "01" is default
    String version = configuration.getString("networkLayer.type.udp.version", "01");
    if (!version.equals("01")) {
        throw new Exception("Unsupported network layer version: " + version);
    }/*from w  w  w.ja v  a 2s .  c o m*/

    return new UDPNetworkLayer(networkParams.connectionStorage, networkParams.localAddress,
            networkParams.localPort, networkParams.remoteAddress, networkParams.remotePort,
            networkParams.maxRecvPacketSize, networkParams.receptionTimeout);
}

From source file:com.github.anba.test262.BaseTest262.java

protected BaseTest262(Configuration configuration, String testsuite, String sourceName, String path) {
    Configuration c = configuration.subset(testsuite);
    this.testsuite = testsuite;
    this.sourceName = sourceName;
    this.path = path;
    this.strictSupported = c.getBoolean("strict", false);
    this.encoding = c.getString("encoding", "UTF-8");
}