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:com.sap.prd.mobile.ios.mios.StraightForwardLibAndAppWithoutSigningTest.java

@BeforeClass
public static void __setup() throws Exception {

    dynamicVersion = "1.0." + String.valueOf(System.currentTimeMillis());
    myLibArtifactFilePrefix = TestConstants.GROUP_ID_WITH_SLASH + "/MyLibrary/" + dynamicVersion + "/MyLibrary-"
            + dynamicVersion;//from ww  w .  j  a v a  2  s .  c  o m
    testName = StraightForwardLibAndAppWithoutSigningTest.class.getName() + File.separator
            + Thread.currentThread().getStackTrace()[1].getMethodName();

    remoteRepositoryDirectory = getRemoteRepositoryDirectory(
            StraightForwardLibAndAppWithoutSigningTest.class.getName());

    prepareRemoteRepository(remoteRepositoryDirectory);

    Properties pomReplacements = new Properties();
    pomReplacements.setProperty(PROP_NAME_DEPLOY_REPO_DIR, remoteRepositoryDirectory.getAbsolutePath());
    pomReplacements.setProperty(PROP_NAME_DYNAMIC_VERSION, dynamicVersion);

    Map<String, String> additionalSystemProperties = new HashMap<String, String>();
    additionalSystemProperties.put("mios.ota-service.url",
            "http://apple-ota.wdf.sap.corp:8080/ota-service/HTML");
    additionalSystemProperties.put("xcode.app.defaultConfigurations", "Release");
    additionalSystemProperties.put("xcode.app.defaultSdks", "iphoneos");
    additionalSystemProperties.put("archive.dir", "archive");
    additionalSystemProperties.put("xcode.useSymbolicLinks", Boolean.TRUE.toString());

    test(testName, new File(getTestRootDirectory(), "straight-forward/MyLibrary"), "deploy", THE_EMPTY_LIST,
            THE_EMPTY_MAP, pomReplacements, new NullProjectModifier());

    List<String> commandLineArgs = new ArrayList<String>();
    commandLineArgs.add("-Dxcode.codeSigningRequired=false");
    commandLineArgs.add("-Dxcode.codeSignIdentity=\"\"");

    appVerifier = test(testName, new File(getTestRootDirectory(), "straight-forward/MyApp"), "deploy",
            commandLineArgs, additionalSystemProperties, pomReplacements, new NullProjectModifier());

    myAppVersionRepoDir = TestConstants.GROUP_ID_WITH_SLASH + "/MyApp/" + dynamicVersion;
    myAppArtifactFilePrefix = myAppVersionRepoDir + "/MyApp-" + dynamicVersion;

    final File tmpFolder = new File(getTargetDirectory(), "tests/tmp");
    tmpFolder.deleteOnExit();

    extractedIpaFolder = new File(tmpFolder, "ipa");
    extractFileWithShellScript(
            new File(remoteRepositoryDirectory, myAppArtifactFilePrefix + "-Release-iphoneos.ipa"),
            extractedIpaFolder);

    File appstoreUploadFile = new File(remoteRepositoryDirectory,
            myAppArtifactFilePrefix + "-Release-iphoneos-app.zip");
    assertTrue(appstoreUploadFile.exists());

    appstoreFolder = new File(tmpFolder, "appstoreFolder");
    appstoreFolder.deleteOnExit();
    extractFileWithShellScript(appstoreUploadFile, appstoreFolder);

    appTestBaseDir = new File(appVerifier.getBasedir());

    archiveArtifactsDir = new File(appTestBaseDir,
            "archive/artifacts/com.sap.ondevice.production.ios.tests/MyApp");
}

From source file:Main.java

/** Extract all of the child nodes as a Properties object from a node in an XML document */
public static Properties extractChildNodes(Document document) {
    try {//w  ww.jav a 2s  .  co m
        Properties props = new Properties();
        Element top = document.getDocumentElement();
        NodeList children = top.getChildNodes();
        Node child;
        String name;
        String value;
        for (int i = 0; i < children.getLength(); i++) {
            child = children.item(i);
            name = child.getNodeName();
            value = child.getTextContent().trim();
            props.setProperty(name, value);
        }
        return props;
    } catch (Exception e) {
        return new Properties();
    }
}

From source file:gobblin.metastore.util.DatabaseJobHistoryStoreSchemaManager.java

private static Properties getProperties(Configuration config) {
    Properties props = new Properties();
    char delimiter = (config instanceof AbstractConfiguration)
            ? ((AbstractConfiguration) config).getListDelimiter()
            : ',';
    Iterator keys = config.getKeys();
    while (keys.hasNext()) {
        String key = (String) keys.next();
        List list = config.getList(key);

        props.setProperty("flyway." + key, StringUtils.join(list.iterator(), delimiter));
    }//w ww.  j a  v  a 2 s  . co  m
    return props;
}

From source file:com.smartitengineering.event.hub.spi.hbase.HBaseHubPersistorITCase.java

@BeforeClass
public static void setUp() throws Exception {
    /*/* w w w .j  ava 2  s  .c  o m*/
     * Start HBase and initialize tables
     */
    //-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
            "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
    try {
        TEST_UTIL.startMiniCluster();
    } catch (Exception ex) {
        LOGGER.error(ex.getMessage(), ex);
    }
    /*
     * Ensure DIs done
     */
    Properties properties = new Properties();
    properties.setProperty(GuiceUtil.CONTEXT_NAME_PROP, "com.smartitengineering.dao.impl.hbase");
    properties.setProperty(GuiceUtil.IGNORE_MISSING_DEP_PROP, Boolean.TRUE.toString());
    properties.setProperty(GuiceUtil.MODULES_LIST_PROP, ConfigurationModule.class.getName());
    GuiceUtil.getInstance(properties).register();
    new InitializerContextListener().contextInitialized(null);
}

From source file:classes.connectionPool.java

public static void start_BasicDataSourceFactory() {
    Properties propiedades = new Properties();
    /*/*  w ww  .  jav a2 s. c  o  m*/
    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://127.0.0.1:3306/bbdd_admin");
    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 {
        dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(propiedades);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e.toString());
    }
}

From source file:org.traccar.Context.java

public static void init(String[] arguments) throws Exception {

    config = new Config();
    if (arguments.length <= 0) {
        throw new RuntimeException("Configuration file is not provided");
    }/* w  ww .jav a 2 s .  c o  m*/

    config.load(arguments[0]);

    loggerEnabled = config.getBoolean("logger.enable");
    if (loggerEnabled) {
        Log.setupLogger(config);
    }

    objectMapper = new ObjectMapper();
    objectMapper.setConfig(
            objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));

    if (config.hasKey("database.url")) {
        dataManager = new DataManager(config);
    }

    if (dataManager != null) {
        deviceManager = new DeviceManager(dataManager);
    }

    identityManager = deviceManager;

    if (config.getBoolean("geocoder.enable")) {
        String type = config.getString("geocoder.type", "google");
        String url = config.getString("geocoder.url");
        String key = config.getString("geocoder.key");
        String language = config.getString("geocoder.language");

        int cacheSize = config.getInteger("geocoder.cacheSize");
        switch (type) {
        case "nominatim":
            geocoder = new NominatimGeocoder(url, key, language, cacheSize);
            break;
        case "gisgraphy":
            geocoder = new GisgraphyGeocoder(url, cacheSize);
            break;
        case "mapquest":
            geocoder = new MapQuestGeocoder(url, key, cacheSize);
            break;
        case "opencage":
            geocoder = new OpenCageGeocoder(url, key, cacheSize);
            break;
        case "bingmaps":
            geocoder = new BingMapsGeocoder(url, key, cacheSize);
            break;
        case "factual":
            geocoder = new FactualGeocoder(url, key, cacheSize);
            break;
        case "geocodefarm":
            geocoder = new GeocodeFarmGeocoder(key, language, cacheSize);
            break;
        default:
            geocoder = new GoogleGeocoder(key, language, cacheSize);
            break;
        }
    }

    if (config.getBoolean("geolocation.enable")) {
        String type = config.getString("geolocation.type", "mozilla");
        String url = config.getString("geolocation.url");
        String key = config.getString("geolocation.key");

        switch (type) {
        case "google":
            geolocationProvider = new GoogleGeolocationProvider(key);
            break;
        case "opencellid":
            geolocationProvider = new OpenCellIdGeolocationProvider(key);
            break;
        case "unwired":
            geolocationProvider = new UnwiredGeolocationProvider(url, key);
            break;
        default:
            geolocationProvider = new MozillaGeolocationProvider(key);
            break;
        }
    }

    if (config.getBoolean("web.enable")) {
        webServer = new WebServer(config, dataManager.getDataSource());
    }

    permissionsManager = new PermissionsManager(dataManager);

    connectionManager = new ConnectionManager();

    if (config.getBoolean("event.enable")) {
        geofenceManager = new GeofenceManager(dataManager);
        calendarManager = new CalendarManager(dataManager);
        notificationManager = new NotificationManager(dataManager);
        Properties velocityProperties = new Properties();
        velocityProperties.setProperty("file.resource.loader.path",
                Context.getConfig().getString("templates.rootPath", "templates") + "/");
        velocityProperties.setProperty("runtime.log.logsystem.class",
                "org.apache.velocity.runtime.log.NullLogChute");

        String address;
        try {
            address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress());
        } catch (UnknownHostException e) {
            address = "localhost";
        }

        String webUrl = URIUtil.newURI("http", address, config.getInteger("web.port", 8082), "", "");
        webUrl = Context.getConfig().getString("web.url", webUrl);
        velocityProperties.setProperty("web.url", webUrl);

        velocityEngine = new VelocityEngine();
        velocityEngine.init(velocityProperties);
    }

    serverManager = new ServerManager();

    if (config.getBoolean("event.forward.enable")) {
        eventForwarder = new EventForwarder();
    }

    aliasesManager = new AliasesManager(dataManager);

    statisticsManager = new StatisticsManager();

    if (config.getBoolean("sms.smpp.enable")) {
        smppClient = new SmppClient();
    }

}

From source file:de.uniluebeck.itm.spyglass.SpyglassEnvironment.java

/**
 * Create a default property file/*w  w  w .  j  ava  2  s.  c o m*/
 * @param f the file to write to
 */
private static void createDefaultConfig(final File f) throws IOException {
    if (!f.createNewFile()) {
        throw new IOException("Could not create property file!");
    }
    final Properties props = new Properties();
    final InputStream input = new FileInputStream(f);

    props.load(input);
    props.setProperty(PROPERTY_CONFIG_FILE_WORKING_DIR, "config/");
    props.setProperty(PROPERTY_CONFIG_FILE_IMAGE_DIR, "image/");
    props.setProperty(PROPERTY_CONFIG_RECORD_DIR, "record/");
    props.setProperty(PROPERTY_CONFIG_STANDALONE_SIZE_X, "800");
    props.setProperty(PROPERTY_CONFIG_STANDALONE_SIZE_Y, "600");
    props.setProperty(PROPERTY_CONFIG_DRAWINGAREA_SIZE, "83");
    props.setProperty(PROPERTY_CONFIG_AFFINE_TRANSFORM_MATRIX, "1.0,0.0,0.0,1.0,0.0,1.0");
    props.setProperty(PROPERTY_CONFIG_DRAWINGAREA_POSITION, "0,0,1000,500");

    storeProps(props);
}

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

/**
 * /*w w  w. ja va  2 s  . com*/
 * Set properties for the Ixa-pipe-tok tokenizer module
 * 
 * @param language (ISO-639 code) 
 * @param normalize
 * @param untokenizable
 * @param hardParagraph
 * 
 * @return Properties props
 * 
 */
private static Properties setTokenizerProperties(String language, String normalize, String untokenizable,
        String hardParagraph) {
    Properties props = new Properties();
    props.setProperty("language", language);
    props.setProperty("normalize", normalize);
    props.setProperty("untokenizable", untokenizable);
    props.setProperty("hardParagraph", hardParagraph);
    return props;
}

From source file:framework.classes.PoolConexion.java

/**
 * CONFIGURE CONNECTION/*from  www .j av a2 s  .  co  m*/
 */
public static void iniciar_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://127.0.0.1:3306/SQL_BD");
    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", "root");
    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:framework.classes.connectionDB.java

public static void init_BasicDataSourceFactory() {
    Properties propiedades = new Properties();
    /*/*from w w w.j  a v  a  2s. c  o  m*/
    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/app");
    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", "root");
    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 {

        dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(propiedades);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e.toString());
    }
}