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:net.orpiske.ssps.common.db.derby.DerbyManagerFactory.java

/**
 * Creates a new database manager instance
 * @return a new database manager instance
 * @throws DatabaseInitializationException
 *//*from   w  w  w .  j  ava 2 s .c  o m*/
public static DerbyDatabaseManager newInstance() throws DatabaseInitializationException {
    Properties props = System.getProperties();
    props.setProperty("derby.system.home", Utils.getSdmDirectoryPath());

    boolean volatileStorage = config.getBoolean("registry.volatile.storage", false);

    return new DerbyDatabaseManager("registry", props, volatileStorage);
}

From source file:Main.java

public static String transferXmlToString(Document doc) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {/*from ww  w .j av a  2s . c o m*/
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer t = tf.newTransformer();
        Properties p = t.getOutputProperties();
        p.setProperty(OutputKeys.ENCODING, "UTF-8");
        t.setOutputProperties(p);
        t.transform(new DOMSource(doc), new StreamResult(bos));
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (TransformerException e) {
        e.printStackTrace();
    }
    String xmlStr = "";
    try {
        xmlStr = bos.toString("UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return xmlStr;
}

From source file:com.threepillar.labs.meeting.Main.java

public static void googleCalendarInvite() throws Exception {

    // set the client/secret and OAUTH2 AccessToken, RefreshToken and
    // ExpiryTime
    Properties props = new Properties();
    props.setProperty(GoogleInviteImpl.CLIENT_ID, "XXXXXXX");
    props.setProperty(GoogleInviteImpl.CLIENT_SECRET, "XXXXXXX");
    props.setProperty(GoogleInviteImpl.ACCESS_TOKEN, "XXXXXXX");
    props.setProperty(GoogleInviteImpl.REFRESH_TOKEN, "XXXXXXX");
    props.setProperty(GoogleInviteImpl.EXPIRY_TIME_IN_MILLIS, "XXXXXXX");

    // set the organizer of the event.
    Participant from = new Participant("From", "From@gmail.com", ParticipantType.REQUIRED);

    // set the attendee of the event.
    Participant attendee1 = new Participant("Attendee", "attendee@gmail.com", ParticipantType.REQUIRED);

    List<Participant> list = new ArrayList<Participant>();
    list.add(attendee1);//from  w  w w  .  j a  v  a2  s  .c o m
    Date startDate = new Date(System.currentTimeMillis() + 30000);
    Date endDate = new Date(startDate.getTime() + 1800000);
    Invite invite = new GoogleInviteImpl(props);
    invite.sendInvite("Testing Event", "Testing dummy event", from, list, startDate, endDate, "Delhi");
}

From source file:com.asakusafw.cleaner.testutil.UnitTestUtil.java

public static void setUpEnv() throws Exception {
    Properties p = System.getProperties();
    p.setProperty(Constants.CLEAN_HOME, "src/test");
    ConfigurationLoader.setSysProp(p);/*from w w  w  .ja  v a2s  .c  o m*/
    System.setProperties(p);
}

From source file:ParseNonXML.java

public static Properties buildProperties() {
    Properties props = new Properties();
    for (int i = 0; i < 10; i++)
        props.setProperty("key" + i, "value" + i);
    return props;
}

From source file:Main.java

private static boolean writeTo(Document doc, String fileName) throws Exception {
    boolean isOver = false;
    DOMSource doms = new DOMSource(doc);
    File f = new File(fileName);
    StreamResult sr = new StreamResult(f);
    try {//from   w w  w . j ava 2  s .c  o m
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer t = tf.newTransformer();
        Properties properties = t.getOutputProperties();
        properties.setProperty(OutputKeys.ENCODING, "UTF-8");
        t.setOutputProperties(properties);
        t.transform(doms, sr);
        isOver = true;
    } catch (TransformerConfigurationException tce) {
        tce.printStackTrace();
    } catch (TransformerException te) {
        te.printStackTrace();
    }
    return isOver;
}

From source file:io.pivotal.gemfire.main.GemFireServerXmlApplication.java

static Properties gemfireProperties() {
    Properties gemfireProperties = new Properties();

    gemfireProperties.setProperty("name", GemFireServerXmlApplication.class.getSimpleName());
    gemfireProperties.setProperty("mcast-port", "0");
    gemfireProperties.setProperty("log-level", systemProperty("gemfire.log.level", "config"));
    gemfireProperties.setProperty("locators", systemProperty("gemfire.locator.host-port", "localhost[11235]"));
    gemfireProperties.setProperty("start-locator",
            systemProperty("gemfire.locator.host-port", "localhost[11235]"));
    gemfireProperties.setProperty("jmx-manager", "true");
    gemfireProperties.setProperty("jmx-manager-port", systemProperty("gemfire.manager.port", "1199"));
    gemfireProperties.setProperty("jmx-manager-start", "true");

    return gemfireProperties;
}

From source file:Main.java

public static void setProperties(Properties properties, String keystorePath, String keystorePassword) {
    properties.setProperty("javax.net.ssl.keyStore", keystorePath);
    properties.setProperty("javax.net.ssl.trustStore", keystorePath);
    properties.setProperty("javax.net.ssl.keyStorePassword", keystorePassword);
    properties.setProperty("javax.net.ssl.keyStoreType", "bks");
    properties.setProperty("android.gov.nist.javax.sip.ENABLED_CIPHER_SUITES",
            "TLS_RSA_WITH_AES_128_CBC_SHA SSL_RSA_WITH_3DES_EDE_CBC_SHA");
}

From source file:Main.java

public static void removeHandset(String file, String name) throws Exception {
    DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
    DocumentBuilder dombuilder = domfac.newDocumentBuilder();
    FileInputStream is = new FileInputStream(file);

    Document doc = dombuilder.parse(is);
    NodeList devices = doc.getElementsByTagName("devices");
    NodeList nodeList = doc.getElementsByTagName("device");
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node deviceNode = nodeList.item(i);
        if (deviceNode.getTextContent().equals(name)) {
            devices.item(0).removeChild(deviceNode);
        }/*from w  w w .jav a  2  s .  c om*/
    }

    //save
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    Properties props = t.getOutputProperties();
    props.setProperty(OutputKeys.ENCODING, "GB2312");
    t.setOutputProperties(props);
    DOMSource dom = new DOMSource(doc);
    StreamResult sr = new StreamResult(file);
    t.transform(dom, sr);
}

From source file:org.trustedanalytics.platformcontext.unit.TestConfiguration.java

@Bean
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {

    PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    ppc.setIgnoreResourceNotFound(true);
    final Properties properties = new Properties();
    properties.setProperty("cf.resource", ApiControllerTest.CF_RESOURCE);
    properties.setProperty("cf.cli.version", "");
    properties.setProperty("cf.cli.url", "");
    properties.setProperty("platform.version", "0.1");
    properties.setProperty("platform.coreorg", "coreOrg");
    ppc.setProperties(properties);//from w  ww  . j a  v  a  2 s  . co m

    return ppc;
}