Example usage for java.lang System getProperties

List of usage examples for java.lang System getProperties

Introduction

In this page you can find the example usage for java.lang System getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Determines the current system properties.

Usage

From source file:com.tcloud.bee.key.server.jetty.config.RootConfiguration.java

@Bean
public Properties retrieveSystemProperties() {
    return System.getProperties();
}

From source file:io.apiman.common.config.SystemPropertiesConfiguration.java

/**
 * @see org.apache.commons.configuration.Configuration#containsKey(java.lang.String)
 *///from  w  w w.  j  av a2s  .  c  o  m
@Override
public boolean containsKey(String key) {
    return System.getProperties().containsKey(key);
}

From source file:com.thoughtworks.go.agent.service.RemoteRegistrationRequesterTest.java

@Before
public void before() {
    original = new Properties(System.getProperties());
}

From source file:com.egt.ejb.toolkit.ToolKitUtils.java

public static String mkEjbSrcDir(String root, String project, String subproject) {
    String sep = System.getProperties().getProperty("file.separator");
    String com = PREFIJO_PAQUETE.replace(".", sep);
    String ejb = getEjbPackageName(project).replace(".", sep);
    String sub = StringUtils.isBlank(subproject) ? "" : sep + subproject.replace("-", sep).replace(".", sep);
    String dir = StringUtils.chomp(root, sep) + sep + project + sep + "src" + sep + "java" + sep + com + sep
            + ejb + sub;/*  w ww . j av  a2 s  .  c  o  m*/
    mkdirs(dir);
    return dir + sep;
}

From source file:com.htmlhifive.pitalium.core.config.PtlTestConfig.java

/**
 * JVM???????/* w  w  w  . j  a  va  2 s.com*/
 * 
 * @return ?
 */
static Map<String, String> getSystemStartupArguments() {
    Properties properties = System.getProperties();
    Map<String, String> results = new HashMap<String, String>();
    int prefixLength = SYSTEM_STARTUP_ARGUMENTS_PREFIX.length();
    for (Object key : properties.keySet()) {
        String propertyKey = (String) key;
        if (!propertyKey.startsWith(SYSTEM_STARTUP_ARGUMENTS_PREFIX)) {
            continue;
        }

        String value = properties.getProperty(propertyKey);
        results.put(propertyKey.substring(prefixLength), value);
    }

    LOG.debug("System startup arguments: {}", results);
    return results;
}

From source file:org.apache.cxf.dosgi.singlebundle.AggregatedActivatorTest.java

@Override
protected void setUp() throws Exception {
    oldDefaultPort = AggregatedActivator.DEFAULT_HTTP_PORT;
    // Change the default port to one that we know is available
    ServerSocket s = new ServerSocket(0);
    int availablePort = s.getLocalPort();
    s.close();// ww  w . jav  a2 s.  c  o m
    AggregatedActivator.DEFAULT_HTTP_PORT = "" + availablePort;

    savedProps = new HashMap<Object, Object>(System.getProperties());
    super.setUp();
}

From source file:org.zalando.stups.spring.http.client.ClientHttpRequestFactorySelector.java

public static ClientHttpRequestFactory getRequestFactory(TimeoutConfig timeoutConfig) {
    Properties properties = System.getProperties();
    String proxyHost = properties.getProperty("http.proxyHost");
    int proxyPort = properties.containsKey("http.proxyPort")
            ? Integer.valueOf(properties.getProperty("http.proxyPort"))
            : 80;/*from www. j a v a  2  s  .  c o  m*/
    if (HTTP_COMPONENTS_AVAILABLE) {
        HttpComponentsClientHttpRequestFactory factory = (HttpComponentsClientHttpRequestFactory) HttpComponentsClientRequestFactoryCreator
                .createRequestFactory(proxyHost, proxyPort);
        factory.setReadTimeout(timeoutConfig.getReadTimeout());
        factory.setConnectTimeout(timeoutConfig.getConnectTimeout());
        factory.setConnectionRequestTimeout(timeoutConfig.getConnectionRequestTimeout());
        return factory;
    } else {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        requestFactory.setConnectTimeout(timeoutConfig.getConnectTimeout());
        requestFactory.setReadTimeout(timeoutConfig.getReadTimeout());
        if (proxyHost != null) {
            requestFactory.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)));
        }
        return requestFactory;
    }
}

From source file:com.srotya.tau.api.dao.alertreceiver.DatabaseResource.java

@Override
protected void before() throws Throwable {
    java.util.logging.Logger.getLogger("org.hibernate").setLevel(Level.OFF);
    Properties config = new Properties(System.getProperties());
    File db = new File(TARGET_RULES_DB);
    if (db.exists()) {
        FileUtils.deleteDirectory(db);/*from  w w w.j  a v a2s .c  o  m*/
    }
    config.setProperty("javax.persistence.jdbc.url", CONNECTION_STRING);
    try {
        emf = Persistence.createEntityManagerFactory("tau", config);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }

    EntityManager em = emf.createEntityManager();

    RuleGroup ruleGroup = new RuleGroup();
    ruleGroup.setRuleGroupId("all");
    ruleGroup.setRuleGroupName("all");
    RuleGroupManager.getInstance().createRuleGroup(em, ruleGroup);
}

From source file:org.jinglenodes.Main.java

public static void start(final String springFile) {
    try {//from  www.  j a  va  2  s  .  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();
    }
}

From source file:mitm.common.properties.PropertyUtils.java

/**
 * Returns the property as an int. If propery is not found, or the property is not something that can
 * be represented by an Integer, defaultValue will be returned.
 *//* w  w w.j a  va 2 s .c  o  m*/
public static int getIntegerSystemProperty(String name, int defaultValue) {
    return getIntegerProperty(System.getProperties(), name, defaultValue);
}