List of usage examples for java.lang System setProperty
public static String setProperty(String key, String value)
From source file:com.mirth.connect.server.util.SqlConfig.java
/** * This method loads the MyBatis SQL config file for the database in use, * then appends sqlMap entries from any installed plugins *//*from w ww . j av a2 s . c o m*/ public static void init() { try { LogFactory.useLog4JLogging(); System.setProperty("derby.stream.error.method", "com.mirth.connect.server.Mirth.getNullOutputStream"); DatabaseSettings databaseSettings = ControllerFactory.getFactory().createConfigurationController() .getDatabaseSettings(); BufferedReader br = new BufferedReader(Resources.getResourceAsReader("SqlMapConfig.xml")); // parse the SqlMapConfig (ignoring the DTD) DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); Document document = factory.newDocumentBuilder().parse(new InputSource(br)); addPluginSqlMaps(databaseSettings.getDatabase(), new DonkeyElement(document.getDocumentElement()).getChildElement("mappers")); DocumentSerializer docSerializer = new DocumentSerializer(); Reader reader = new StringReader(docSerializer.toXML(document)); sqlSessionfactory = new SqlSessionFactoryBuilder().build(reader, databaseSettings.getProperties()); sqlSessionManager = SqlSessionManager.newInstance(sqlSessionfactory); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:net.fenyo.mail4hotspot.service.Browser.java
public void setProxyHost(final String proxy_host) { System.setProperty("http.proxyHost", proxy_host); }
From source file:com.caricah.iotracah.datastore.IotDataSource.java
public void setupDatasource(String driver, String dbUrl, String username, String password) throws NamingException { System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); System.setProperty(Context.PROVIDER_URL, "file:////tmp"); Context ctx = new InitialContext(); // Construct DriverAdapterCPDS reference Reference cpdsRef = new Reference("org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS", "org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS", null); cpdsRef.add(new StringRefAddr("driver", driver)); cpdsRef.add(new StringRefAddr("url", dbUrl)); cpdsRef.add(new StringRefAddr("user", username)); cpdsRef.add(new StringRefAddr("password", password)); ctx.rebind("jdbc_cpds", cpdsRef); Reference ref = new Reference("org.apache.commons.dbcp2.datasources.SharedPoolDataSource", "org.apache.commons.dbcp2.datasources.SharedPoolDataSourceFactory", null); ref.add(new StringRefAddr("dataSourceName", "jdbc_cpds")); ref.add(new StringRefAddr("defaultMaxTotal", "100")); ref.add(new StringRefAddr("defaultMaxIdle", "30")); ref.add(new StringRefAddr("defaultMaxWaitMillis", "10000")); ctx.rebind("jdbc_commonpool", ref); }
From source file:com.hs.mail.security.config.JaasLoginSupport.java
public void afterPropertiesSet() throws Exception { File file = location.getFile(); System.setProperty("java.security.auth.login.config", file.getAbsolutePath()); }
From source file:com.streamsets.pipeline.cluster.ClusterFunctionImpl.java
private static synchronized void initialize(Properties properties, Integer id, String rootDataDir) throws Exception { if (initialized) { return;/*from w w w . j a v a 2 s . co m*/ } File dataDir = new File(System.getProperty("user.dir"), "data"); FileUtils.copyDirectory(new File(rootDataDir), dataDir); System.setProperty("sdc.data.dir", dataDir.getAbsolutePath()); // must occur before creating the EmbeddedSDCPool as // the hdfs target validation evaluates the sdc:id EL NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMinimumIntegerDigits(6); numberFormat.setGroupingUsed(false); final String sdcId = numberFormat.format(id); Utils.setSdcIdCallable(new Callable<String>() { @Override public String call() { return sdcId; } }); sdcPool = new EmbeddedSDCPool(properties); initialized = true; }
From source file:dk.dtu.imm.esculapauml.core.tests.uml.LoggingTest.java
public LoggingTest() { if (!configured) { System.setProperty("org.apache.commons.logging.log", EsculapaUMLLog4JLoger.class.getName()); PropertyConfigurator.configure(Activator.LOG_PROPERTIES_FILE); configured = true;/*from ww w. j a va 2s.co m*/ } }
From source file:UrlEngine.java
@Override public ResponseEntity<String> submit(JCurlRequestOptions requestOptions) throws Exception { System.setProperty("http.keepAlive", "true"); ResponseEntity<String> responseEntity = null; URL obj = new URL(requestOptions.getUrl()); for (int i = 0; i < requestOptions.getCount(); i++) { HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // add request header con.setRequestMethod("GET"); con.setConnectTimeout(2000);//from www . ja v a 2 s .com for (Map.Entry<String, String> e : requestOptions.getHeaderMap().entrySet()) { con.setRequestProperty(e.getKey(), e.getValue()); } System.out.println("\nSending 'GET' request to URL : " + requestOptions.getUrl()); con.connect(); int responseCode = con.getResponseCode(); System.out.println("Response Code : " + responseCode); final InputStream is = con.getInputStream(); String response = IOUtils.toString(is); is.close(); //print result System.out.println(response); responseEntity = new ResponseEntity<String>(response, HttpStatus.valueOf(responseCode)); } return responseEntity; }
From source file:com.impetus.kundera.ycsb.HBaseYCSBTest.java
/** * @throws java.lang.Exception/*www. j a va2 s .c o m*/ */ @Before public void setUp() throws Exception { System.setProperty("fileName", "src/main/resources/db-hbase.properties"); super.setUp(); }
From source file:com.thoughtworks.go.agent.launcher.LockfileTest.java
@Before public void setUp() { System.setProperty(Lockfile.SLEEP_TIME_FOR_LAST_MODIFIED_CHECK_PROPERTY, "0"); }
From source file:com.wbtech.ums.NetworkUtil.java
private static void initSSL() { CobubLog.d(UmsConstants.LOG_TAG, NetworkUtil.class, "InitSSL start it:" + UmsConstants.SDK_POS_NAME); System.setProperty("javax.net.ssl.keyStoreProvider", UmsConstants.SDK_POS_NAME); System.setProperty("javax.net.ssl.certAlias", UmsConstants.SDK_CSR_ALIAS); CobubLog.d(UmsConstants.LOG_TAG, NetworkUtil.class, "InitSSL end it:" + UmsConstants.SDK_CSR_ALIAS); }