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:sys.core.configuracion.ApplicationHelper.java

public static void cargarLogger() {
    Logger logger = null;// w  w w . ja  v a  2s  . co m
    try {
        RecursosManager recursosManager = (RecursosManager) WebServletContextListener.getApplicationContext()
                .getBean("recursosManager");
        String rutaLog = "";
        {
            ParametroDto p = recursosManager
                    .obtenerParametroPorID(ConstantesCore.Parametro.PARAMETRO_GENERAL_LOG);
            if (p.getValorCadena() != null) {
                rutaLog = p.getValorCadena();
            } else {
                rutaLog = "D:\\log\\FastRemisse";
            }
        }
        System.out.print("= = = = = = = = = =  INICIANDO CONTEXTO FAST REMISSE = = = = = = = = = =  ");
        Properties prop = new Properties();
        prop.setProperty("log4j.rootCategory", "INFO, LOGFILE, CONSOLE");
        prop.setProperty("log4j.appender.CONSOLE", "org.apache.log4j.ConsoleAppender");
        prop.setProperty("log4j.appender.CONSOLE.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.CONSOLE.layout.ConversionPattern",
                "[%d{yyyy-MM-dd HH:mm:ss}] - [%5p] (%C{1}.%M:%L) - %m%n");
        prop.setProperty("log4j.appender.LOGFILE", "org.apache.log4j.DailyRollingFileAppender");
        prop.setProperty("log4j.appender.LOGFILE.file", rutaLog);
        prop.setProperty("log4j.appender.LOGFILE.DatePattern", "'.'yyyy-MM-dd'.log'");
        prop.setProperty("log4j.appender.LOGFILE.MaxFileSize", "2048KB");
        prop.setProperty("log4j.appender.archivo.maxFileSize", "20MB");
        prop.setProperty("log4j.appender.archivo.maxBackupIndex", "5");
        prop.setProperty("log4j.appender.LOGFILE.append", "true");
        prop.setProperty("log4j.appender.LOGFILE.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.LOGFILE.layout.ConversionPattern",
                "[%d{yyyy-MM-dd HH:mm:ss}] - [%5p] (%C{1}.%M:%L) - %m%n");
        //prop.setProperty("log4j.logger.org.springframework", "INFO, LOGFILE, CONSOLE");
        //prop.setProperty("log4j.logger.org.hibernate", "INFO, LOGFILE, CONSOLE");
        PropertyConfigurator.configure(prop);

        logger.info(
                "= = = = = = = = = =  CONTEXTO FAST REMISSE CARGADO SATISFACTORIAMENTE = = = = = = = = = =  ");
        System.out.print(
                "= = = = = = = = = =  CONTEXTO FAST REMISSE CARGADO SATISFACTORIAMENTE = = = = = = = = = =  ");

    } catch (Exception e) {
        BasicConfigurator.configure();
    }
}

From source file:com.nateyolles.sling.publick.utils.VltUtils.java

public static ExportOptions getExportOptions(WorkspaceFilter filter, String[] packageRoots, String packageGroup,
        String packageName, String packageVersion) {
    DefaultMetaInf inf = new DefaultMetaInf();
    ExportOptions opts = new ExportOptions();
    inf.setFilter(filter);//from  w ww .  j  a  va 2  s.  c  o  m

    Properties props = new Properties();
    props.setProperty(VaultPackage.NAME_GROUP, packageGroup);
    props.setProperty(VaultPackage.NAME_NAME, packageName);
    props.setProperty(VaultPackage.NAME_VERSION, packageVersion);
    inf.setProperties(props);

    opts.setMetaInf(inf);

    String root = getPackageRoot(filter.getFilterSets(), packageRoots);
    opts.setRootPath(root);
    opts.setMountPath(root);

    return opts;
}

From source file:com.obidea.semantika.database.connection.ConnectionProviderFactory.java

public static Properties getConnectionProperties(PropertiesConfiguration properties) {
    Properties toReturn = new Properties();
    Iterator<String> iter = properties.getKeys();
    while (iter.hasNext()) {
        String propKey = iter.next();
        if (propKey.contains(Environment.CONNECTION_PREFIX)) {
            toReturn.setProperty(propKey, properties.getString(propKey));
        }//from ww w .  ja v a 2  s  .  c  o  m
    }
    return toReturn;
}

From source file:de.pawlidi.openaletheia.utils.PropertiesUtils.java

public static void setStringProperty(Properties properties, final String key, final String value) {
    if (StringUtils.isNotEmpty(value)) {
        properties.setProperty(key, value);
    }/*from  w  ww. ja  v  a2 s .c o  m*/
}

From source file:com.kylinolap.query.test.KylinQueryTest.java

private static void setUpCubeConn() throws SQLException {
    // Cube Connection
    File olapTmp = OLAPSchemaFactory.createTempOLAPJson(ProjectInstance.DEFAULT_PROJECT_NAME, config);
    Properties props = new Properties();
    props.setProperty(OLAPQuery.PROP_SCAN_THRESHOLD, "10000");
    cubeConnection = DriverManager.getConnection("jdbc:optiq:model=" + olapTmp.getAbsolutePath(), props);
}

From source file:gobblin.kafka.writer.KafkaDataWriter.java

private static void setDefaultIfUnset(Properties props, String key, String value) {
    if (!props.containsKey(key)) {
        props.setProperty(key, value);
    }// w w w  . java2  s . c  om
}

From source file:com.enonic.cms.framework.util.PropertiesUtil.java

/**
 * Return a subset of properties./*from   ww w. j av a 2  s.c  o m*/
 */
public static Properties getSubSet(final Properties props, final String base) {
    Properties sub = new Properties();
    for (Map.Entry entry : props.entrySet()) {
        String key = (String) entry.getKey();
        String value = (String) entry.getValue();

        if (key.startsWith(base)) {
            sub.setProperty(key.substring(base.length()), value);
        }
    }

    return sub;
}

From source file:de.tudarmstadt.ukp.uby.resource.UbyResource.java

private static void addOverride(Properties aProps, String aKey, String aValue) {
    if (aValue != null) {
        aProps.setProperty(aKey, aValue);
    }//from  ww  w. jav  a  2 s .  c o m
}

From source file:com.cisco.dvbu.ps.common.util.wsapi.WsApiHelperObjects.java

public static Properties getServerProperties(CompositeServer targetServer) throws CompositeException {
    Properties props = new Properties();
    props.setProperty(AdapterConstants.ADAPTER_HOST, targetServer.getHostname());
    props.setProperty(AdapterConstants.ADAPTER_PORT, String.valueOf(targetServer.getPort()));
    props.setProperty(AdapterConstants.ADAPTER_USER, targetServer.getUser());
    props.setProperty(AdapterConstants.ADAPTER_PSWD, targetServer.getPassword());
    props.setProperty(AdapterConstants.ADAPTER_DOMAIN, targetServer.getDomain());
    props.setProperty(AdapterConstants.ADAPTER_USE_HTTPS, String.valueOf(targetServer.isUseHttps()));

    return props;
}

From source file:com.fusesource.customer.wssec.client.Main.java

static Properties merlinCrypto(String keystoreLocation, String keystorePassword, String certAlias) {
    Properties p = new Properties();

    p.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
    p.setProperty("org.apache.ws.security.crypto.merlin.file", keystoreLocation);
    p.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
    p.setProperty("org.apache.ws.security.crypto.merlin.keystore.alias", certAlias);
    p.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", keystorePassword);

    return p;//from  w w w.  j a  v  a  2s . c  o m
}