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:org.duracloud.mill.audit.generator.AuditLogGeneratorDriver.java

@Override
protected void executeImpl(CommandLine cmd) {
    PropertyDefinitionListBuilder builder = new PropertyDefinitionListBuilder();
    List<PropertyDefinition> list = builder.addAws().addMillDb().addDuracloudAuditSpace().addWorkDir().build();

    new PropertyVerifier(list).verify(System.getProperties());

    SystemConfig config = SystemConfig.instance();
    config.setAuditLogSpaceId(System.getProperty(ConfigConstants.AUDIT_LOGS_SPACE_ID));

    String logRootDir = System.getProperty(ConfigConstants.WORK_DIRECTORY_PATH) + File.separator + "audit-logs";
    initializeLogRoot(logRootDir);/*from ww w . ja v a2s  . c o m*/
    ApplicationContext context = new AnnotationConfigApplicationContext("org.duracloud.mill");
    log.info("spring context initialized.");
    AuditLogGenerator generator = context.getBean(AuditLogGenerator.class);
    generator.execute();
    log.info("exiting...");
}

From source file:de.awtools.config.SystemGlueConfig.java

@Override
protected Object doGetProperty(final String key) {
    return System.getProperties().getProperty(key);
}

From source file:de.daibutsu.main.MainStart.java

public void run() {
    System.getProperties().setProperty("sun.awt.exception.handler", ExceptionHandler.class.getName());
    try {/*from   w  w  w. j a v a  2 s.c o  m*/
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        throw new RuntimeException("Error!", e);
    }

    starteAnwendung();
}

From source file:org.springdata.ehcache.config.CacheManagerFactoryBean.java

@Override
public void afterPropertiesSet() throws FileNotFoundException {

    Assert.hasText(configFile, "configFile property must be set");

    if (StringUtils.hasText(terracottaLicenseFile)) {
        System.getProperties().setProperty("com.tc.productkey.path", terracottaLicenseFile);
    }// w w w  .  j a  v a 2s . c om

    logger.info("Initializing ehcache ...");
    cacheManager = new CacheManager(configFile);

}

From source file:org.cloudfoundry.reconfiguration.play.StandardPropertySetterTest.java

@After
public void tearDown() {
    for (Iterator<Object> i = System.getProperties().keySet().iterator(); i.hasNext();) {
        String key = (String) i.next();
        if (key.startsWith("cloud.services") || key.startsWith("applyEvolutions")) {
            i.remove();//  w w w.ja  v  a 2 s .c  o  m
        }
    }
}

From source file:com.anyi.gp.license.RegisterTools.java

public static List getMacAddresses() {
    List result = new ArrayList();
    try {/*from  w  w  w. j  ava2  s.co  m*/
        Properties props = System.getProperties();
        String command = "ipconfig -a";
        if (props.getProperty("os.name").toLowerCase().startsWith("windows"))
            command = "ipconfig /all";

        Process process = Runtime.getRuntime().exec(command);
        InputStreamReader ir = new InputStreamReader(process.getInputStream());
        LineNumberReader input = new LineNumberReader(ir);
        String line;
        while ((line = input.readLine()) != null)
            if (line.indexOf("Physical Address") > 0) {
                String MACAddr = line.substring(line.indexOf("-") - 2);
                // System.out.println("MAC address = [" + MACAddr + "]");
                result.add(MACAddr);
            }
    } catch (java.io.IOException e) {
        e.printStackTrace();
        // System.err.println("IOException " + e.getMessage());
    }
    return result;
}

From source file:com.srotya.tau.api.dao.TestRuleGroupManager.java

@BeforeClass
public static void beforeClass() throws Exception {
    Properties config = new Properties(System.getProperties());
    File db = new File(TARGET_RULES_DB);
    if (db.exists()) {
        FileUtils.deleteDirectory(db);//from   w ww  .j a  va2 s .  c o m
    }
    config.setProperty("javax.persistence.jdbc.url", CONNECTION_STRING);
    try {
        emf = Persistence.createEntityManagerFactory("tau", config);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:org.constretto.test.ConstrettoSpringJUnit4ClassRunner.java

@Override
public void run(RunNotifier notifier) {
    String originalTags = changeTagsSystemProperty();
    String originalEnvironment = changeAssembleSystemProperty();
    super.run(notifier);
    if (originalTags == null) {
        System.getProperties().remove(DefaultConfigurationContextResolver.TAGS);
    } else {/*from  ww w  .jav a  2 s .  com*/
        System.setProperty(DefaultConfigurationContextResolver.TAGS, originalTags);
    }
    if (originalEnvironment == null) {
        System.getProperties().remove(DefaultAssemblyContextResolver.ASSEMBLY_KEY);
    } else {
        System.setProperty(DefaultAssemblyContextResolver.ASSEMBLY_KEY, originalEnvironment);
    }
}

From source file:org.hawkular.apm.server.api.utils.zipkin.BinaryAnnotationMappingStorage.java

/**
 * Default storage. It loads mappings from jboss configuration directory.
 *//*from www .  j  a v a2s  .  c  om*/
public BinaryAnnotationMappingStorage() {

    String jbossConfigDir = System.getProperties().getProperty("jboss.server.config.dir");
    if (jbossConfigDir == null) {
        log.errorf("Property jboss.server.config.dir is not set, Binary Annotation mapping rules set to empty");
        keyBasedMappings = Collections.emptyMap();
        return;
    }

    String path = System.getProperty("jboss.server.config.dir") + File.separatorChar
            + HAWKULAR_ZIPKIN_BINARY_ANNOTATION_MAPPING;

    loadMappings(path);
}

From source file:MailAccessor.java

private void handleMessages(HttpServletRequest request, PrintWriter out) throws IOException, ServletException {

    HttpSession httpSession = request.getSession();
    String user = (String) httpSession.getAttribute("user");
    String password = (String) httpSession.getAttribute("pass");
    String popAddr = (String) httpSession.getAttribute("pop");

    Store popStore = null;/*  ww w  . j ava 2s  .  c  o  m*/
    Folder folder = null;

    if (!check(popAddr))
        popAddr = MailAccessor.DEFAULT_SERVER;

    try {

        if ((!check(user)) || (!check(password)))
            throw new ServletException("A valid username and password is required to check email.");

        Properties properties = System.getProperties();

        Session session = Session.getDefaultInstance(properties);

        popStore = session.getStore("pop3");

        popStore.connect(popAddr, user, password);

        folder = popStore.getFolder("INBOX");

        if (!folder.exists())
            throw new ServletException("An 'INBOX' folder does not exist for the user.");

        folder.open(Folder.READ_ONLY);

        Message[] messages = folder.getMessages();
        int msgLen = messages.length;

        if (msgLen == 0)
            out.println("<h2>The INBOX folder does not yet contain any email messages.</h2>");

        for (int i = 0; i < msgLen; i++) {
            displayMessage(messages[i], out);
            out.println("<br /><br />");
        }

    } catch (Exception exc) {

        out.println("<h2>Sorry, an error occurred while accessing the email messages.</h2>");
        out.println(exc.toString());

    } finally {
        try {
            if (folder != null)
                folder.close(false);

            if (popStore != null)
                popStore.close();
        } catch (Exception e) {
        }
    }
}