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.kylinolap.rest.service.AdminService.java

/**
 * Get Java Env info as string/*from w w w  .j  a  v  a2  s  . co  m*/
 * 
 * @return
 */
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
public String getEnv() {
    logger.debug("Get Kylin Runtime environment");
    PropertiesConfiguration tempConfig = new PropertiesConfiguration();

    // Add Java Env

    try {
        String content = "";
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // env
        Map<String, String> env = System.getenv();
        for (String envName : env.keySet()) {
            tempConfig.addProperty(envName, env.get(envName));
        }
        // properties
        Properties properteis = System.getProperties();
        for (Object propName : properteis.keySet()) {
            tempConfig.setProperty((String) propName, properteis.get(propName));
        }

        // do save
        tempConfig.save(baos);
        content = baos.toString();
        return content;
    } catch (ConfigurationException e) {
        logger.debug("Failed to get Kylin Runtime env", e);
        throw new InternalErrorException("Failed to get Kylin env Config", e);
    }
}

From source file:cn.guoyukun.spring.jpa.repository.hibernate.type.CollectionToStringUserType.java

@Override
public void setParameterValues(Properties parameters) {
    String separator = (String) parameters.get("separator");
    if (!StringUtils.isEmpty(separator)) {
        this.separator = separator;
    } else {/*ww w  .  jav a 2 s  .c om*/
        this.separator = ",";
    }

    String collectionType = (String) parameters.get("collectionType");
    if (!StringUtils.isEmpty(collectionType)) {
        try {
            this.collectionType = Class.forName(collectionType);
        } catch (ClassNotFoundException e) {
            throw new HibernateException(e);
        }
    } else {
        this.collectionType = java.util.ArrayList.class;
    }

    String elementType = (String) parameters.get("elementType");
    if (!StringUtils.isEmpty(elementType)) {
        try {
            this.elementType = Class.forName(elementType);
        } catch (ClassNotFoundException e) {
            throw new HibernateException(e);
        }
    } else {
        this.elementType = Long.TYPE;
    }
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.DefItemEditorPlugin.java

public void initialize(Properties properties, boolean isViewMode) {
    isRow = properties.get("type").equals("rowDef");
}

From source file:com.opensoc.enrichment.adapters.geo.GeoMysqlAdapterTest.java

protected void setUp() throws Exception {
    super.setUp();
    Properties prop = super.getTestProperties();
    assertNotNull(prop);/*  www  . j a  v  a  2  s  .c o m*/
    System.out.println("username =" + (String) prop.get("mysql.username"));
    if (skipTests(this.getMode())) {
        System.out.println(getClass().getName() + " Skipping Tests !!Local Mode");
        return;//skip tests
    } else {
        GeoMysqlAdapterTest.setGeoMySqlAdapter(new GeoMysqlAdapter((String) prop.get("mysql.ip"),
                (new Integer((String) prop.get("mysql.port"))).intValue(), (String) prop.get("mysql.username"),
                (String) prop.get("mysql.password"), (String) prop.get("bolt.enrichment.geo.adapter.table")));
        connected = geoMySqlAdapter.initializeAdapter();
        assertTrue(connected);
        URL schema_url = getClass().getClassLoader().getResource("TestSchemas/GeoMySqlSchema.json");
        super.setSchemaJsonString(super.readSchemaFromFile(schema_url));
    }
}

From source file:de.yaio.commons.config.Configuration.java

public void putProperties(final Properties props) {
    for (final Object prop : props.keySet()) {
        this.putProperty(new ConfigurationOption(prop.toString(), props.get(prop)));
    }//from ww  w  . j  av  a2  s.c  o m
}

From source file:com.cpjit.swagger4j.support.internal.DefaultApiViewWriter.java

/**
 * @since 1.2.2//from   w  ww. ja va2s  .com
 */
protected String buildResourcePath(HttpServletRequest request, Properties config) {
    String uri = request.getRequestURI();
    String suffix = (String) config.get("suffix");
    if (suffix != null) {
        int index = uri.lastIndexOf(suffix);
        if (index > 0) {
            uri = uri.substring(0, index);
        }
    }
    String path = uri.substring(uri.indexOf("statics") + 7);
    path = "com/cpjit/swagger4j/support/internal/statics" + path;
    return path;
}

From source file:com.threepillar.labs.meeting.google.GoogleInviteImpl.java

/**
 * Constructs an instance of this class. It accepts OAuth configuration
 * properties.//from  w  w w  .  j av a  2s. c  o  m
 * 
 * @param properties
 *            the OAUTH configuration properties. Properties should contain
 *            <code>CLIENT_ID</code>, <code>CLIENT_SECRET</code>,
 *            <code>ACCESS_TOKEN</code>, <code>REFRESH_TOKEN</code>,
 *            <code>EXPIRY_TIME_IN_MILLIS</code>,
 *            <code>APPLICATION_NAME</code>
 */
public GoogleInviteImpl(final Properties properties) {
    this.properties = properties;
    if (properties.get(APPLICATION_NAME) != null) {
        this.applicationName = (String) properties.get(APPLICATION_NAME);
    }
}

From source file:org.openspaces.esb.mule.eventcontainer.OpenSpacesMessageDispatcher.java

/**
 * Extract the writeLease, updateOrWrite & updateTimeout from the URI.
 * If atrribute is missing sets the default.
 *///from  w w w.  j av a2s . c o m
private void initWritingAttributes(ImmutableEndpoint endpoint) {
    Properties params = endpoint.getEndpointURI().getParams();
    if (params != null) {
        try {
            String writeLeaseStr = (String) params.get(ENDPOINT_PARAM_WRITE_LEASE);
            if (writeLeaseStr != null) {
                writeLease = Long.valueOf(writeLeaseStr);
            }
            String updateOrWriteStr = (String) params.get(ENDPOINT_PARAM_UPDATE_OR_WRITE);
            if (updateOrWriteStr != null) {
                updateOrWrite = Boolean.valueOf(updateOrWriteStr);
            }
            String updateTimeoutStr = (String) params.get(ENDPOINT_PARAM_UPDATE_TIMEOUT);
            if (updateTimeoutStr != null) {
                updateTimeout = Long.valueOf(updateTimeoutStr);
            }
        } catch (NumberFormatException e) {
            throw new MuleRuntimeException(
                    CoreMessages.failedToCreateConnectorFromUri(endpoint.getEndpointURI()), e);
        }
    }
}

From source file:edu.sampleu.admin.XmlIngester.java

private List<File> buildFileUploadList() throws Exception {
    List<File> fileUploadList = new ArrayList<File>();
    try {//from ww w .  j  av a 2 s . c om
        // update properties with timestamp value if includeDTSinPrefix is true
        Properties props = loadProperties(PROPS_LOCATION, DEFAULT_PROPS_LOCATION);
        if (props.get("userIncludeDTSinPrefix") != null
                && "true".equalsIgnoreCase((String) props.get("userIncludeDTSinPrefix"))) {
            props.setProperty("userPrefix", "" + props.get("userPrefix") + AutomatedFunctionalTestUtils.DTS);
        }
        systemPropertiesOverride(props);

        // build files and add to array
        fileUploadList.add(writeTemplateToFile(folder.newFile("loadtest-users.xml"),
                cfg.getTemplate(TMPL_USER_CONTENT), props));
        fileUploadList.add(writeTemplateToFile(folder.newFile("loadtest-group.xml"),
                cfg.getTemplate(TMPL_GROUP_CONTENT), props));
    } catch (Exception e) {
        throw new Exception("Unable to generate files for upload", e);
    }
    return fileUploadList;
}

From source file:edu.samplu.admin.test.XMLIngester.java

private List<File> buildFileUploadList() throws Exception {
    List<File> fileUploadList = new ArrayList<File>();
    try {//from w  ww . j  a v  a2  s  . co  m
        // update properties with timestamp value if includeDTSinPrefix is true
        Properties props = loadProperties(PROPS_LOCATION, DEFAULT_PROPS_LOCATION);
        if (props.get("userIncludeDTSinPrefix") != null
                && "true".equalsIgnoreCase((String) props.get("userIncludeDTSinPrefix"))) {
            props.setProperty("userPrefix", "" + props.get("userPrefix") + ITUtil.DTS);
        }
        systemPropertiesOverride(props);

        // build files and add to array
        fileUploadList.add(writeTemplateToFile(folder.newFile("loadtest-users.xml"),
                cfg.getTemplate(TMPL_USER_CONTENT), props));
        fileUploadList.add(writeTemplateToFile(folder.newFile("loadtest-group.xml"),
                cfg.getTemplate(TMPL_GROUP_CONTENT), props));
    } catch (Exception e) {
        throw new Exception("Unable to generate files for upload", e);
    }
    return fileUploadList;
}