List of usage examples for java.lang System getProperties
public static Properties getProperties()
From source file:com.ning.metrics.collector.guice.ServerModule.java
@Override protected void configureServlets() { final ConfigurationObjectFactory configFactory = new CollectorConfigurationObjectFactory( System.getProperties()); final CollectorConfig config = configFactory.build(CollectorConfig.class); bind(ConfigurationObjectFactory.class).toInstance(configFactory); bind(CollectorConfig.class).toInstance(config); installStats();/* ww w . j av a 2 s. c o m*/ installHealthChecks(); installJMX(); installArecibo(config); installNagios(config); installF5(); installJaxrsSupport(config); installScribe(); installPersistentSink(); installHDFS(); installRealtimeSink(); // Static files bind(DefaultServlet.class).asEagerSingleton(); serve("/media/*").with(DefaultServlet.class); serveRegex(ASYNC_RESOURCES_PATTERN).with(GuiceManagedAtmosphereServlet.class, new HashMap<String, String>() { { put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.ning.metrics.collector.jaxrs"); } }); serveRegex(EVENTS_RESOURCES_PATTERN).with(GuiceContainer.class, new HashMap<String, String>() { { put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.ning.metrics.collector.jaxrs"); } }); }
From source file:org.jolokia.support.spring.SpringJolokiaServerTest.java
private void checkSystemPropertyMode(String mode, String propContext, String configContext, String expectContext) throws Exception { if (propContext != null) { System.setProperty("jolokia.agentContext", propContext); }/*from w w w . j a va2 s. c o m*/ SpringJolokiaAgent server = new SpringJolokiaAgent(); server.setConfig(getConfig(true, 100, "agentContext", configContext)); server.setSystemPropertiesMode(mode); server.afterPropertiesSet(); assertEquals(server.getServerConfig().getContextPath(), expectContext); System.getProperties().remove("jolokia.agentContext"); checkServerAndStop(server); // Allow to shutdown server ... Thread.sleep(500); }
From source file:com.silverpeas.mailinglist.service.job.TestZimbraConnection.java
@Test public void testOpenImapConnection() { URL url = this.getClass().getClassLoader().getResource("truststore.jks"); String path = url.getPath();//ww w. ja va 2s.c o m System.setProperty("javax.net.ssl.trustStore", path); System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); Store mailAccount = null; Folder inbox = null; Session mailSession = Session.getInstance(System.getProperties()); try { mailSession.setDebug(true); mailAccount = mailSession.getStore(props.getProperty("mail.server.protocol")); mailAccount.connect(props.getProperty("mail.server.host"), Integer.parseInt(props.getProperty("mail.server.port")), props.getProperty("mail.server.login"), props.getProperty("mail.server.password")); inbox = mailAccount.getFolder("INBOX"); if (inbox == null) { throw new MessagingException("No POP3 INBOX"); } // -- Open the folder for read write -- inbox.open(Folder.READ_WRITE); // -- Get the message wrappers and process them -- Message[] msgs = inbox.getMessages(); FetchProfile profile = new FetchProfile(); profile.add(FetchProfile.Item.FLAGS); inbox.fetch(msgs, profile); } catch (MessagingException mex) { SilverTrace.error("mailingList", "MessageChecker.checkNewMessages", "mail.processing.error", mex); } catch (Exception mex) { SilverTrace.error("mailingList", "MessageChecker.checkNewMessages", "mail.processing.error", mex); } finally { // -- Close down nicely -- try { if (inbox != null) { inbox.close(false); } if (mailAccount != null) { mailAccount.close(); } } catch (Exception ex2) { SilverTrace.error("mailingList", "MessageChecker.checkNewMessages", "mail.processing.error", ex2); } } }
From source file:org.obp.Configuration.java
public Object getJavaInfo() { return MapUtil.filterByKeyPrefix(System.getProperties(), "java."); }
From source file:com.adaptris.util.text.XmlTransformerTest.java
@Test public void testTransform() throws Exception { XmlTransformerFactory factory = new XsltTransformerFactory(); XmlTransformer transform = factory.configure(new XmlTransformer()); transform.registerBuilder(DocumentBuilderFactoryBuilder.newInstance()); String xsl = backslashToSlash(PROPERTIES.getProperty(KEY_XML_TEST_TRANSFORM_URL)); AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT)); try (InputStream in = m1.getInputStream(); OutputStream out = m1.getOutputStream()) { StreamResult output = new StreamResult(out); StreamSource input = new StreamSource(in); transform.transform(factory.createTransformer(xsl), input, output, xsl, new HashMap<>(System.getProperties())); }/*w w w .j av a 2s . c o m*/ AdaptrisMessage m2 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT)); try (InputStream in = m2.getInputStream(); OutputStream out = m2.getOutputStream()) { StreamResult output = new StreamResult(out); StreamSource input = new StreamSource(in); transform.transform(factory.createTransformer(xsl), input, output, xsl); } }
From source file:com.nridge.core.base.std.Platform.java
/** * Determines if the current platform that the JVM is executing within is * a UNIX-based operating system./*from www .j a v a 2 s . co m*/ * @return <i>true</i> if it is or <i>false</i> otherwise. */ public static boolean isUNIX() { String osName; Properties osProperties; osProperties = System.getProperties(); osName = (String) osProperties.get("os.name"); return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_UNIX); }
From source file:com.ning.metrics.collector.guice.module.ServerModule.java
@Override protected void configureServlets() { final ConfigurationObjectFactory configFactory = new CollectorConfigurationObjectFactory( System.getProperties()); final CollectorConfig config = configFactory.build(CollectorConfig.class); bind(ConfigurationObjectFactory.class).toInstance(configFactory); bind(CollectorConfig.class).toInstance(config); install(new CollectorObjectMapperModule()); installStats();/* ww w . j a va 2s . c om*/ installHealthChecks(); installJMX(); installArecibo(config); installNagios(config); installF5(); installJaxrsSupport(config); installScribe(); installPersistentSink(); installEventSpoolWriter(config); installHDFS(); installDBModule(config); installRealtimeSink(); // Static files bind(DefaultServlet.class).asEagerSingleton(); serve("/media/*").with(DefaultServlet.class); serveRegex(ASYNC_RESOURCES_PATTERN).with(GuiceManagedAtmosphereServlet.class, new HashMap<String, String>() { { put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.ning.metrics.collector.jaxrs"); } }); serveRegex(EVENTS_RESOURCES_PATTERN).with(GuiceContainer.class, new HashMap<String, String>() { { put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.ning.metrics.collector.jaxrs"); } }); }
From source file:com.tacitknowledge.util.migration.DistributedJdbcMigrationLauncherFactoryTest.java
/** * @see junit.framework.TestCase#setUp() *///from w ww . j a v a 2 s. c o m protected void setUp() throws Exception { super.setUp(); log.debug("setting up " + this.getClass().getName()); // Make sure we load our test launcher factory, which fakes out the data source context System.getProperties().setProperty("migration.factory", "com.tacitknowledge.util.migration.jdbc.TestJdbcMigrationLauncherFactory"); DistributedJdbcMigrationLauncherFactory factory = new TestDistributedJdbcMigrationLauncherFactory(); // Create the launcher (this does configure it as a side-effect) launcher = (DistributedJdbcMigrationLauncher) factory.createMigrationLauncher("orchestration"); // Make sure we get notification of any migrations launcher.getMigrationProcess().addListener(this); context = new TestMigrationContext(); }
From source file:com.googlecode.psiprobe.tools.Mailer.java
public void send(MailMessage mailMessage) throws MessagingException { Properties props = (Properties) System.getProperties().clone(); if (smtp != null) { props.put(PROPERTY_KEY_SMTP, smtp); }//from w w w.jav a 2s . c o m PrintStream debugOut = LogOutputStream.createPrintStream(log, LogOutputStream.LEVEL_DEBUG); Session session = Session.getDefaultInstance(props); session.setDebug(true); session.setDebugOut(debugOut); MimeMessage message = createMimeMessage(session, mailMessage); log.debug("Sending message"); Transport.send(message); }
From source file:com.omertron.themoviedbapi.tools.WebBrowser.java
public static URLConnection openProxiedConnection(URL url) throws MovieDbException { try {// w ww .ja v a2s. c o m if (proxyHost != null) { System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", proxyHost); System.getProperties().put("proxyPort", proxyPort); } URLConnection cnx = url.openConnection(); if (proxyUsername != null) { cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword); } return cnx; } catch (IOException ex) { throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex); } }