Example usage for java.util Properties get

List of usage examples for java.util Properties get

Introduction

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

Prototype

@Override
    public Object get(Object key) 

Source Link

Usage

From source file:com.sourcesense.alfresco.opensso.integration.WebClientSSOIntegrationTest.java

@Before
public void setUp() throws Exception {
    Properties properties = new Properties();
    properties.load(getClass().getClassLoader().getResourceAsStream("AMConfig.properties"));
    this.agent_login = (String) properties.get("com.sun.identity.agents.app.username");
    agent_password = (String) properties.get("com.iplanet.am.service.password");
    String openssoNaming = (String) properties.get("com.iplanet.am.naming.url");
    opensso_url = openssoNaming.substring(0, openssoNaming.lastIndexOf('/')).concat("/UI/Login");

    selenium = new DefaultSelenium("localhost", 4444, "*firefox3", opensso_url);
    selenium.start();//from   w  w w . j  av  a  2s.c  o m

}

From source file:com.wipro.ats.bdre.clustermigration.MigrationPreprocessor.java

private MigrationPreprocessorInfo prepareMigrate(String parentProcessId, String processId,
        String instanceExecId) throws SQLException {
    MigrationPreprocessorInfo migrationPreprocessorInfo = new MigrationPreprocessorInfo();
    Properties params = getParams(parentProcessId, "hive-migration");
    String table = params.get("src-table").toString();
    String sourceDb = params.get("src-db").toString();
    String destDb = params.get("dest-db").toString();
    String sourceStgtable = table + "_stg";
    String bdreTechPartition = params.get("bdre-tech-pt").toString();
    String sourceNameNodeAddress = params.get("src-nn").toString();
    String destNameNodeAddress = params.get("dest-nn").toString();
    String sourceJobTrackerAddress = params.get("src-jt").toString();
    String sourceHiveConnection = params.get("src-hive").toString();
    String destHiveConnection = params.get("dest-hive").toString();
    Connection conn = getHiveJDBCConnection(sourceDb, sourceHiveConnection);
    Statement st = conn.createStatement();
    Connection destConn = getHiveJDBCConnection(destDb, destHiveConnection);
    Statement destSt = destConn.createStatement();
    List<String> sourcePartitionList = getCurrentSourcePartitionList(st, sourceDb, table);

    List<String> previousPartitionList = getLastSourcePartitionList(processId, table);

    Set<String> modifiedBusinessPartitionSet = getChangedBusinessPartitionSet(sourcePartitionList,
            previousPartitionList);//from   ww w.j a v  a2 s .c o  m

    List<String> sourceColumnList = getCurrentSourceColumnList(sourceDb, table, sourceHiveConnection);

    List<String> destColumnList = getDestColumnList(processId, table);

    List<String> addedColumnList = getNewRegularColumnsAtSourceList(sourceColumnList, destColumnList);

    //persisting the current partition info to process logs
    logCurrentSourcePartitions(sourcePartitionList, processId, instanceExecId, table);

    //persisting the current column info to process logs
    logCurrentSourceColumns(sourceColumnList, processId, instanceExecId, table);

    //creating the source stage table
    formStageAndDestTableDDLs(st, sourceColumnList, sourceDb, destDb, table, sourceStgtable, bdreTechPartition,
            processId, instanceExecId);

    if (checkIfDestTableExists(destDb, table, destHiveConnection))
        alterDestTable(destSt, addedColumnList, destDb, table);
    else
        execDestTableDDL(destDb, destHiveConnection);

    filterConditions = formFilterCondition(modifiedBusinessPartitionSet, sourcePartitionColumns);
    LOGGER.debug("filterConditions = " + filterConditions);

    srcStgTableLocation = getTableLocation(sourceDb, sourceHiveConnection, sourceStgtable);
    destTableLocation = getTableLocation(destDb, destHiveConnection, table);
    migrationPreprocessorInfo = setOozieUtilProperties(sourceDb, destDb, sourceStgtable, table,
            sourceJobTrackerAddress, sourceNameNodeAddress, destNameNodeAddress, processId, instanceExecId,
            migrationPreprocessorInfo);

    st.close();
    destSt.close();
    conn.close();
    destConn.close();
    return migrationPreprocessorInfo;
}

From source file:com.hortonworks.registries.schemaregistry.examples.avro.TruckEventsKafkaAvroSerDesApp.java

private Map<String, Object> createProducerConfig(Properties props) {
    String bootstrapServers = props.getProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG);
    Map<String, Object> config = new HashMap<>();
    config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
    config.putAll(Collections.singletonMap(SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL.name(),
            props.get(SCHEMA_REGISTRY_URL)));
    config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
    config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaAvroSerializer.class.getName());
    return config;
}

From source file:com.hortonworks.registries.schemaregistry.examples.avro.KafkaAvroSerDesApp.java

private Map<String, Object> createConsumerConfig(Properties props) {
    String bootstrapServers = props.getProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG);
    Map<String, Object> config = new HashMap<>();
    config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
    config.putAll(Collections.singletonMap(SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL.name(),
            props.get(SCHEMA_REGISTRY_URL)));
    config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
    config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, KafkaAvroDeserializer.class.getName());
    if (props.containsKey(ConsumerConfig.GROUP_ID_CONFIG)) {
        config.put(ConsumerConfig.GROUP_ID_CONFIG, props.getProperty(ConsumerConfig.GROUP_ID_CONFIG));
    } else {/*from ww  w. j a  va  2  s. c om*/
        config.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID().toString());
    }
    config.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
    return config;
}

From source file:com.liferay.blade.cli.command.CreateCommand.java

private File _getDefaultModulesDir() throws Exception {
    BladeCLI bladeCLI = getBladeCLI();//from   w ww . j  av  a 2s .  co  m

    BaseArgs args = bladeCLI.getArgs();

    File base = new File(args.getBase());

    File baseDir = base.getCanonicalFile();

    if (!isWorkspace(baseDir)) {
        return baseDir;
    }

    Properties properties = getWorkspaceProperties();

    String modulesDirValue = (String) properties.get(WorkspaceConstants.DEFAULT_MODULES_DIR_PROPERTY);

    if (modulesDirValue == null) {
        modulesDirValue = WorkspaceConstants.DEFAULT_MODULES_DIR;
    }

    if (modulesDirValue.contains(",")) {
        bladeCLI.out("WARNING: " + WorkspaceConstants.DEFAULT_MODULES_DIR_PROPERTY + " has multiple values: "
                + modulesDirValue);
        modulesDirValue = modulesDirValue.substring(0, modulesDirValue.indexOf(","));

        bladeCLI.out("WARNING: using " + modulesDirValue);
    }

    WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(baseDir);

    File projectDir = workspaceProvider.getWorkspaceDir(baseDir);

    File modulesDir = new File(projectDir, modulesDirValue);

    if (_containsDir(baseDir, modulesDir)) {
        return baseDir;
    }

    return modulesDir;
}

From source file:org.apache.zeppelin.lens.LensInterpreter.java

public LensInterpreter(Properties property) {
    super(property);
    try {/*from   w  w w. j a v a2 s. co  m*/
        m_lensConf = new LensClientConfig();
        m_lensConf.set(LENS_SERVER_URL, property.get(LENS_SERVER_URL).toString());
        m_lensConf.set(LENS_CLIENT_DBNAME, property.get(LENS_CLIENT_DBNAME).toString());
        m_lensConf.set(LENS_SESSION_CLUSTER_USER, property.get(LENS_SESSION_CLUSTER_USER).toString());
        m_lensConf.set(LENS_PERSIST_RESULTSET, property.get(LENS_PERSIST_RESULTSET).toString());
        try {
            m_maxResults = Integer.parseInt(property.get(ZEPPELIN_MAX_ROWS).toString());
        } catch (NumberFormatException | NullPointerException e) {
            m_maxResults = 1000;
            s_logger.error("unable to parse " + ZEPPELIN_MAX_ROWS + " :" + property.get(ZEPPELIN_MAX_ROWS), e);
        }
        try {
            m_maxThreads = Integer.parseInt(property.get(ZEPPELIN_LENS_CONCURRENT_SESSIONS).toString());
        } catch (NumberFormatException | NullPointerException e) {
            m_maxThreads = 10;
            s_logger.error("unable to parse " + ZEPPELIN_LENS_CONCURRENT_SESSIONS + " :"
                    + property.get(ZEPPELIN_LENS_CONCURRENT_SESSIONS), e);
        }
        s_logger.info("LensInterpreter created");
    } catch (Exception e) {
        s_logger.error(e.toString(), e);
        s_logger.error("unable to create lens interpreter", e);
    }
}

From source file:de.steilerdev.myVerein.server.model.Settings.java

public Map<String, Object> getSettingsMap() {
    Map<String, Object> settingsMap = new HashMap<>();
    try {/*from  w w  w  .j ava  2s. c  o m*/
        Properties settingsFromFile;
        if ((settingsFromFile = loadSettingsFromFile()) != null) {
            for (Object key : settingsFromFile.keySet()) {
                settingsMap.put((String) key, settingsFromFile.get(key));
            }
        } else {
            logger.warn("Unable to load settings from file");
        }
    } catch (IOException e) {
        logger.error("Unable to load settings from file");
        settingsMap = new HashMap<>();
    }
    settingsMap.put("clubName", clubName);
    settingsMap.put("customUserFields", customUserFields);

    return settingsMap;
}

From source file:com.vetstreet.embedded.jirb.SshServerFactory.java

public void afterPropertiesSet() throws Exception {
    SshServer sshd = SshServer.setUpDefaultServer();
    sshd.setPort(port);// ww  w  . j  a  v a 2 s.co  m
    sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
    Factory<Command> factory = null;
    //   factory = new ProcessShellFactory(new String[] {  "/bin/bash", "-i", "irb" }, EnumSet.of(ProcessShellFactory.TtyOptions.ONlCr));
    factory = new ShellFactoryImpl(this);//ShellFactoryImpl();
    sshd.setShellFactory(factory);
    final Properties userprops = new Properties();
    if (userpasses != null) {
        userprops.load(userpasses.getInputStream());
    }
    PasswordAuthenticator authenticator = null;
    if (configurationMap == null) {
        authenticator = new PasswordAuthenticator() {
            public boolean authenticate(String arg0, String arg1, ServerSession arg2) {
                Object response = userprops.get(arg0);
                if (response != null)
                    return response.equals(arg1);
                else if (arg0.equals("jirb") && arg1.equals("jruby15awesom3"))
                    return true;
                else
                    return false;
            }
        };
    } else {
        SecurityContextManager manager = new SecurityContextManager(context, configurationMap);
        authenticator = manager.getPasswordAuthenticator();
    }
    if (authenticator == null)
        throw new Exception("Null authenticator! Configuration issue.");
    sshd.setPasswordAuthenticator(authenticator);
    this.server = sshd;
    this.start();
}

From source file:net.sourceforge.jabm.VariableBindingsIterator.java

@SuppressWarnings("rawtypes")
public void parseVarFile(String varFile) throws IOException {
    Properties properties = new Properties();
    variableRanges = new HashMap<String, VariableRange>();
    properties.load(new FileInputStream(varFile));
    for (Object variable : properties.keySet()) {
        Class type = getType(variable.toString());
        VariableRange range = parseVariableRange(properties.get(variable).toString(), type);
        logger.debug("range = " + range);
        variableRanges.put(variable.toString(), range);
    }/* w ww .j  a  v  a  2s  .  co  m*/
    variables = new ArrayList<String>(variableRanges.keySet());
}

From source file:com.aurel.track.DBScriptTest.java

/***************************** HELPERS *****************************/

public PropertiesConfiguration getRealPropertyObj(String dbTypePrefix) {
    try {//w w w .j  av  a  2s  . com
        String propFilePath = System.getProperty("user.dir")
                + "/src/test/resources/schema/DBScriptTester.properties";
        FileInputStream input = new FileInputStream(propFilePath);
        Properties prop = new Properties();
        prop.load(input);
        PropertiesConfiguration props = new PropertiesConfiguration();
        props.addProperty("torque.dsfactory.track.connection.user", prop.get(dbTypePrefix + "user"));
        props.addProperty("torque.dsfactory.track.connection.password", prop.get(dbTypePrefix + "password"));
        props.addProperty("torque.database.track.adapter", prop.get(dbTypePrefix + "adapter"));
        props.addProperty("torque.dsfactory.track.connection.driver", prop.get(dbTypePrefix + "driver"));
        props.addProperty("torque.dsfactory.track.connection.url", prop.get(dbTypePrefix + "url"));
        props.addProperty("torque.dsfactory.track.factory",
                "org.apache.torque.dsfactory.SharedPoolDataSourceFactory");
        props.addProperty("torque.dsfactory.track.pool.maxActive", "30");
        props.addProperty("torque.dsfactory.track.pool.testOnBorrow", "true");
        props.addProperty("torque.dsfactory.track.pool.validationQuery", "SELECT PKEY FROM TSTATE");
        return props;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return null;
}