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:de.ingrid.interfaces.csw.admin.command.AdminManager.java

/**
 * Read the override configuration and write a new bcrypt-hash password.
 *//*from   w w w.  j a va2s.  c  o m*/
private static void resetPassword(String newPassword) {
    try {
        InputStream is = new FileInputStream("conf/config.override.properties");
        Properties props = new Properties();
        props.load(is);
        props.setProperty("ingrid.admin.password", BCrypt.hashpw(newPassword, BCrypt.gensalt()));

        OutputStream os = new FileOutputStream("conf/config.override.properties");
        props.store(os, "Override configuration written by the application");
        os.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.orpiske.sas.service.utils.LogConfigurator.java

private static void configureTrace(Properties properties) {
    properties.setProperty("log4j.rootLogger", "TRACE, stdout");
}

From source file:net.orpiske.sas.service.utils.LogConfigurator.java

private static void configureDebug(Properties properties) {
    properties.setProperty("log4j.rootLogger", "DEBUG, stdout");
}

From source file:net.orpiske.sas.service.utils.LogConfigurator.java

private static void configureVerbose(Properties properties) {
    properties.setProperty("log4j.rootLogger", "INFO, stdout");
}

From source file:fr.norad.jaxrs.oauth2.core.tck.spring.SpringConfiguration.java

@Bean
static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
    PropertySourcesPlaceholderConfigurer props = new PropertySourcesPlaceholderConfigurer();
    Properties properties = new Properties();
    properties.setProperty("token.lifetime.second.default", "42");
    properties.setProperty("refresh_token.lifetime.second.default", "42");
    props.setProperties(properties);//from  ww  w.  j av  a  2  s.  c o  m
    return props;
}

From source file:com.l2jfree.security.HexID.java

/**
 * Save hexadecimal ID of the server in the properties file.
 * /*from w w w  .  j  a v  a2  s .co m*/
 * @param string (String) : hexadecimal ID of the server to store
 * @param fileName (String) : name of the properties file
 */
public static void saveHexid(String string, String fileName) {
    OutputStream out = null;
    try {
        out = new FileOutputStream(fileName);

        final Properties hexSetting = new Properties();
        hexSetting.setProperty("HexID", string);
        hexSetting.store(out, "the hexID to auth into login");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(out);
    }
}

From source file:com.l2jfree.security.HexID.java

/**
 * Save hexadecimal ID of the server in the properties file.
 * /*from  w  w  w .j a  va 2s. com*/
 * @param serverId game server ID
 * @param hexId (String) : hexadecimal ID of the server to store
 * @param fileName (String) : name of the properties file
 */
public static void saveHexid(int serverId, String hexId, String fileName) {
    OutputStream out = null;
    try {
        out = new FileOutputStream(fileName);

        final Properties hexSetting = new Properties();
        hexSetting.setProperty("ServerID", String.valueOf(serverId));
        hexSetting.setProperty("HexID", hexId);
        hexSetting.store(out, "the hexID to auth into login");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(out);
    }
}

From source file:net.orpiske.sas.service.utils.LogConfigurator.java

private static void configureCommon(Properties properties) {
    properties.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender");

    properties.setProperty("log4j.appender.stdout.Target", "System.out");
    properties.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout");
    properties.setProperty("log4j.appender.stdout.layout.ConversionPattern", "%m%n");
}

From source file:Main.java

/**
 * Return XQuery XML serialization properties for pretty XML output formatting.
 * //  w  ww.  j av  a2 s.  c  o  m
 * @return XML serialization properties for printouts
 */
public static Properties newSerializationPropertiesForPrintout() {
    final Properties serializationProps = new Properties();
    // Make sure we output in XML format
    serializationProps.setProperty("method", "xml");
    // Pretty printing
    serializationProps.setProperty("indent", "yes");
    return serializationProps;
}

From source file:org.jinglenodes.Main.java

public static void start(final String springFile) {
    try {// ww  w .  jav  a 2s.  co m
        long init = System.currentTimeMillis();
        log.info("Using home directory: " + appDir);
        Properties p = System.getProperties();
        p.setProperty("sipgateway.home", appDir);
        PropertyConfigurator.configure(appDir + "/conf/log4j.xml");
        DOMConfigurator.configureAndWatch(appDir + "/conf/log4j.xml");
        ApplicationContext appContext = new FileSystemXmlApplicationContext("file:" + appDir + springFile);
        BeanFactory factory = appContext;
        sipGatewayApplication = (SIPGatewayApplication) factory.getBean("sip");
        double time = (double) (System.currentTimeMillis() - init) / 1000.0;
        addShutdownHook();
        log.info("Started Sip Gateway in " + time + " seconds");
        Thread.currentThread().wait();
    } catch (Exception e) {
        log.error(e);
        e.printStackTrace();
    }
}