List of usage examples for java.lang System getProperties
public static Properties getProperties()
From source file:io.apiman.common.config.SystemPropertiesConfiguration.java
/** * @see org.apache.commons.configuration.AbstractConfiguration#addPropertyDirect(java.lang.String, java.lang.Object) */// w w w. j a v a2 s . c o m @Override protected void addPropertyDirect(String key, Object value) { System.getProperties().setProperty(key, String.valueOf(value)); }
From source file:ch.cyberduck.core.cryptomator.SwiftTouchFeatureTest.java
@Test public void testTouchLongFilenameEncrypted() throws Exception { final Host host = new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials(System.getProperties().getProperty("rackspace.key"), System.getProperties().getProperty("rackspace.secret"))); final SwiftSession session = new SwiftSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path home = new Path("/test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory)); final Path vault = new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path test = new Path(vault, new RandomStringGenerator.Builder().build().generate(130), EnumSet.of(Path.Type.file)); final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore()); cryptomator.create(session, null, new VaultCredentials("test")); session.withRegistry(/*ww w .j a va 2s.c om*/ new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator)); final SwiftRegionService regionService = new SwiftRegionService(session); new CryptoTouchFeature<StorageObject>(session, new SwiftTouchFeature(session, regionService), new SwiftWriteFeature(session, regionService), cryptomator).touch(test, new TransferStatus()); assertTrue(new CryptoFindFeature(session, new SwiftFindFeature(session), cryptomator).find(test)); new CryptoDeleteFeature(session, new SwiftDeleteFeature(session), cryptomator) .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:com.garyclayburg.BootVaadin.java
public static void dumpSystemProperties() { log.info("system properties dump"); Properties systemProperties = System.getProperties(); TreeMap tm = new TreeMap(systemProperties); for (Object o : tm.keySet()) { String key = (String) o; log.info(key + ": " + tm.get(o)); }//from www. ja va 2 s.c o m Map<String, String> getenv = new TreeMap<>(System.getenv()); log.info("system environment dump"); for (String key : getenv.keySet()) { log.info("env " + key + ": " + getenv.get(key)); } }
From source file:com.hs.mail.web.controller.FetchAccountFormController.java
private Store connect(String userName, String password) throws MessagingException { Session session = Session.getInstance(System.getProperties(), null); Store store = session.getStore("imap"); store.connect("localhost", userName, password); return store; }
From source file:org.focusns.service.env.impl.EnvironmentServiceImpl.java
protected Environment lookupJava() { if (envJava == null) { Properties props = System.getProperties(); Map<String, String> env = System.getenv(); ////from w w w . j a v a 2 s. c om envJava = new EnvironmentJava(); envJava.setJavaVendor(props.getProperty("java.vendor")); envJava.setJavaVersion(props.getProperty("java.version")); envJava.setJavaHome(env.get("JAVA_HOME")); envJava.setJavaOptions(env.get("JAVA_OPTS")); envJava.setJavaClassPath(props.getProperty("java.class.path")); envJava.setJavaLibraryPath(props.getProperty("java.library.path")); envJava.setJavaRuntimeName(props.getProperty("java.runtime.name")); envJava.setJavaRuntimeVersion(props.getProperty("java.runtime.version")); // envJava.setJavaVMName(props.getProperty("java.vm.name")); envJava.setJavaVMVendor(props.getProperty("java.vm.vendor")); envJava.setJavaVMVersion(props.getProperty("java.vm.version")); envJava.setJavaVMInfo(props.getProperty("java.vm.info")); } // return envJava; }
From source file:org.obp.Configuration.java
public Object getOsInfo() { return MapUtil.filterByKeyPrefix(System.getProperties(), "os."); }
From source file:ch.cyberduck.core.irods.IRODSUploadFeatureTest.java
@Test @Ignore//from www . j a v a2s . c o m public void testAppend() throws Exception { final ProtocolFactory factory = new ProtocolFactory( new HashSet<>(Collections.singleton(new IRODSProtocol()))); final Profile profile = new ProfilePlistReader(factory) .read(new Local("../profiles/iRODS (iPlant Collaborative).cyberduckprofile")); final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials(System.getProperties().getProperty("irods.key"), System.getProperties().getProperty("irods.secret"))); final IRODSSession session = new IRODSSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final int length = 32770; final byte[] content = RandomUtils.nextBytes(length); final OutputStream out = local.getOutputStream(false); IOUtils.write(content, out); out.close(); final Checksum checksumPart1; final Checksum checksumPart2; final Path test = new Path(new IRODSHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); { final TransferStatus status = new TransferStatus().length(content.length / 2); checksumPart1 = new IRODSUploadFeature(session).upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertEquals(content.length / 2, status.getOffset()); } { final TransferStatus status = new TransferStatus().length(content.length / 2).skip(content.length / 2) .append(true); checksumPart2 = new IRODSUploadFeature(session).upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, new DisabledConnectionCallback()); assertEquals(content.length / 2, status.getOffset()); } assertNotEquals(checksumPart1, checksumPart2); final byte[] buffer = new byte[content.length]; final InputStream in = new IRODSReadFeature(session).read(test, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(in, buffer); in.close(); assertArrayEquals(content, buffer); new IRODSDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); session.close(); }
From source file:com.matthewrathbone.hadoop.MRTester.java
public MRTester(String b) throws Exception { this.base = new File(b); this.baseDir = new Path("file://" + base.getAbsolutePath()); String mrDir = "mapred/local"; String logs = "logs"; conf.set("mapred.local.dir", new File(base, mrDir).getAbsolutePath()); conf.set("mapred.job.tracker.handle.count", "2"); conf.set("tasktracker.http.threads", "2"); // avoid heap space issues during testing -- default is 100 conf.set("io.sort.mb", "20"); conf.set("mapred.map.max.attempts", "2"); conf.set("mapred.reduce.max.attempts", "2"); conf.set("jobclient.completion.poll.interval", "30"); System.getProperties().setProperty("hadoop.log.dir", new File(base, logs).getAbsolutePath()); this.fileSystem = FileSystem.get(baseDir.toUri(), conf); assert (fileSystem.mkdirs(new Path(baseDir, mrDir))); assert (fileSystem.mkdirs(new Path(baseDir, logs))); }
From source file:ProgressMeterStrmDemo.java
public void readTheFile() throws IOException { // OK, we're going to read a file. Do it... FileInputStream is = new FileInputStream("index.htm"); BufferedReader ds = new BufferedReader(new InputStreamReader( new ProgressMonitorInputStream(this, "Loading...", new FileInputStream("index.htm")))); // Now read it... String line;// w w w . j a va 2s .co m while ((line = ds.readLine()) != null) { if (System.getProperties().getProperty("debug.lines") != null) System.err.println("Read this line: " + line); try { Thread.sleep(200); // slow it down a bit. } catch (InterruptedException e) { return; } } // Close file, since it was opened. ds.close(); }
From source file:com.finance.it.micro_lending.RestApplicationTests.java
@AfterClass public static void tearDownClass() { System.getProperties().remove("loan.thershold.start.time"); System.getProperties().remove("loan.thershold.end.time"); System.getProperties().remove("loan.maxAmount"); System.getProperties().remove("loan.day.maxAttempts"); }