Example usage for java.util Properties setProperty

List of usage examples for java.util Properties setProperty

Introduction

In this page you can find the example usage for java.util Properties setProperty.

Prototype

public synchronized Object setProperty(String key, String value) 

Source Link

Document

Calls the Hashtable method put .

Usage

From source file:elh.eus.absa.NLPpipelineWrapper.java

/**
 * /*from ww  w.  j av a 2  s .c o  m*/
 * Set properties for the Ixa-pipe-pos tagger module
 * 
 * @param model
 * @param language (ISO-639 code) 
 * @param beamSize
 * @param lemmatize
 * @param multiwords
 * 
 * @return Properties props
 * 
 */
public static Properties setPostaggerProperties(String model, String language, String beamSize,
        String lemmatize, String multiwords) {
    Properties props = new Properties();
    props.setProperty("model", model);
    props.setProperty("language", language);
    props.setProperty("beamSize", beamSize);
    props.setProperty("lemmatize", lemmatize);
    //this is a work around for ixa-pipes, because it only allows multiword matching for es and gl.
    if (!language.matches("(gl|es)")) {
        multiwords = "false";
    }
    props.setProperty("multiwords", multiwords);
    return props;
}

From source file:eu.project.ttc.tools.cli.TermSuiteCLIUtils.java

/**
 * Sets the <code>value</code> of the specified <code>property</code> if no
 * value exists for it in the given <code>properties</code>.
 * /*from ww w .  ja v  a  2  s  .c  o m*/
 * @param properties
 *            The property list
 * @param property
 *            The property name
 * @param value
 *            The value to set
 */
public static void setToValueIfNotExists(Properties properties, String property, String value) {
    if (properties.getProperty(property) == null)
        properties.setProperty(property, value);
}

From source file:framework.clss.ConnectionBD.java

/**
 * Open conection with Data Base//from www . ja  va  2s . co  m
 *
 */

public static void inicializa_BasicDataSourceFactory() {
    Properties propiedades = new Properties();
    /*
    setMaxActive(): N mx de conexiones que se pueden abrir simultneamente.
    setMinIdle(): N mn de conexiones inactivas que queremos que haya. Si el n de conexiones baja de este n, se abriran ms.
    setMaxIdle(): N mx de conexiones inactivas que queremos que haya. Si hay ms, se irn cerrando.
    */
    propiedades.setProperty("driverClassName", "com.mysql.jdbc.Driver");
    propiedades.setProperty("url", "jdbc:mysql://localhost:3306/mysql");
    propiedades.setProperty("maxActive", "10");
    propiedades.setProperty("maxIdle", "8");
    propiedades.setProperty("minIdle", "0");
    propiedades.setProperty("maxWait", "500");
    propiedades.setProperty("initialSize", "5");
    propiedades.setProperty("defaultAutoCommit", "true");
    propiedades.setProperty("username", "root");
    propiedades.setProperty("password", "");
    propiedades.setProperty("validationQuery", "select 1");
    propiedades.setProperty("validationQueryTimeout", "100");
    propiedades.setProperty("initConnectionSqls", "SELECT 1;SELECT 2");
    propiedades.setProperty("poolPreparedStatements", "true");
    propiedades.setProperty("maxOpenPreparedStatements", "10");

    try {
        //propiedades.load(new FileInputStream("src/config/datasource_config.properties"));
        dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(propiedades);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e.toString());
    }
}

From source file:com.ibm.watson.developer_cloud.professor_languo.configuration.IndexerAndSearcherFactory.java

/**
 * Checks that strings are not null when reading from the System environment variables and then
 * load the values to the destination properties file
 * //  www .j a  va  2  s  .c  om
 * @param destProperties - the properties file to load into
 * @param keys - the variable names
 * @throws IllegalArgumentException if any of the variables are null
 */
private static void checkStringsNotNull(Properties destProperties, String... keys)
        throws IllegalArgumentException {
    for (String key : keys) {
        String value = System.getenv(key);
        checkValueNotNull(key, value);
        destProperties.setProperty(key, value);
    }
}

From source file:elh.eus.absa.NLPpipelineWrapper.java

/**
 * Set a Properties object with the CLI parameters for annotation.
 * @param model the model parameter//from  www.  j  a va  2 s  .co m
 * @param language language parameter
 * @param lexer rule based parameter
 * @param dictTag directly tag from a dictionary
 * @param dictPath directory to the dictionaries
 * @return the properties object
 */
public static Properties setIxaPipesNERCProperties(String model, String language, String lexer, String dictTag,
        String dictPath) {
    Properties annotateProperties = new Properties();
    annotateProperties.setProperty("model", model);
    annotateProperties.setProperty("language", language);
    annotateProperties.setProperty("ruleBasedOption", lexer);
    annotateProperties.setProperty("dictTag", dictTag);
    annotateProperties.setProperty("dictPath", dictPath);
    return annotateProperties;
}

From source file:com.bluexml.tools.miscellaneous.Translate.java

public static void writeBackValues(File values, File propertiesFile) throws IOException {
    List<String> readLines = FileUtils.readLines(values, "UTF-8");
    Properties props = new Properties();
    TreeMap<String, String> propsMap = loadProperties(propertiesFile);
    Set<String> keySet = propsMap.keySet();
    int index = 0;
    for (String key : keySet) {
        String value = readLines.get(index);
        System.out.println("before trans :" + value);

        System.out.println("after trans :" + value);
        System.out.println();//from   ww  w.  j  a  v a 2  s.  c o m
        props.setProperty(key, value);
        index++;
    }

    FileOutputStream out = new FileOutputStream(propertiesFile);
    props.store(out, null);
    out.close();

}

From source file:com.ibm.watson.developer_cloud.professor_languo.configuration.IndexerAndSearcherFactory.java

/**
 * Checks that strings are not empty or null when loading them from the System environment into
 * the destination properties object/* w  ww .  java 2  s.  c o m*/
 * 
 * @param keys - the variable names
 * @destProperties - the destination properties
 * @throws IllegalArgumentException if any of the variables are empty or null
 */
private static void checkStringsNotEmptyOrNull(Properties destProperties, String... keys)
        throws IllegalArgumentException {
    for (String key : keys) {
        String value = System.getenv(key);
        checkValueNotEmptyOrNull(key, value);
        destProperties.setProperty(key, value);
    }
}

From source file:com.ibm.watson.developer_cloud.professor_languo.configuration.IndexerAndSearcherFactory.java

/**
 * Checks that strings are not null when loading them to the properties file from the source
 * properties file to the destination properties file
 * //from w ww  .  j  a v  a2s .  c o  m
 * @param keys
 * @throws IllegalArgumentException if any of the string are null
 */
private static void checkStringsNotNull(Properties srcProperties, Properties destProperties, String... keys)
        throws IllegalArgumentException {
    for (String key : keys) {
        String value = srcProperties.getProperty(key);
        checkValueNotNull(key, value);
        destProperties.setProperty(key, value);
    }
}

From source file:org.apache.cxf.transport.jms.JMSOldConfigHolder.java

public static Properties getInitialContextEnv(AddressType addrType) {
    Properties env = new Properties();
    java.util.ListIterator listIter = addrType.getJMSNamingProperty().listIterator();
    while (listIter.hasNext()) {
        JMSNamingPropertyType propertyPair = (JMSNamingPropertyType) listIter.next();
        if (null != propertyPair.getValue()) {
            env.setProperty(propertyPair.getName(), propertyPair.getValue());
        }//from www.  ja v a  2 s.c  o  m
    }
    if (LOG.isLoggable(Level.FINE)) {
        Enumeration props = env.propertyNames();
        while (props.hasMoreElements()) {
            String name = (String) props.nextElement();
            String value = env.getProperty(name);
            LOG.log(Level.FINE, "Context property: " + name + " | " + value);
        }
    }
    return env;
}

From source file:com.ibm.watson.developer_cloud.professor_languo.configuration.IndexerAndSearcherFactory.java

/**
 * Checks that strings are not null or blank when loading them to the properties file from the
 * source properties file to the destination properties file
 * /* www.j  av  a 2s.c  o  m*/
 * @param keys
 * @throws IllegalArgumentException if any of the string arguments is blank or null
 */
private static void checkStringsNotEmptyOrNull(Properties srcProperties, Properties destProperties,
        String... keys) throws IllegalArgumentException {
    for (String key : keys) {
        String value = srcProperties.getProperty(key);
        checkValueNotEmptyOrNull(key, value);
        destProperties.setProperty(key, value);
    }
}