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:net.testdriven.psiprobe.controllers.system.SysInfoController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    SystemInformation systemInformation = new SystemInformation();
    systemInformation.setAppBase(getContainerWrapper().getTomcatContainer().getAppBase().getAbsolutePath());
    systemInformation.setConfigBase(getContainerWrapper().getTomcatContainer().getConfigBase());

    Map sysProps = new Properties();
    sysProps.putAll(System.getProperties());

    if (!SecurityUtils.hasAttributeValueRole(getServletContext(), request)) {
        for (Object filterOutKey : filterOutKeys) {
            sysProps.remove(filterOutKey);
        }//  ww w  . j a v a2  s .c o m
    }

    systemInformation.setSystemProperties(sysProps);

    return new ModelAndView(getViewName()).addObject("systemInformation", systemInformation)
            .addObject("runtime", getRuntimeInfoAccessor().getRuntimeInformation())
            .addObject("collectionPeriod", getCollectionPeriod());
}

From source file:ch.cyberduck.core.spectra.SpectraReadFeatureTest.java

@Test(expected = NotfoundException.class)
public void testReadNotFound() throws Exception {
    final Host host = new Host(new SpectraProtocol() {
        @Override//from w  w w.  jav a2  s .c o m
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"),
            Integer.valueOf(System.getProperties().getProperty("spectra.port")),
            new Credentials(System.getProperties().getProperty("spectra.user"),
                    System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(),
            new DefaultX509KeyManager());
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final TransferStatus status = new TransferStatus();
    final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, "nosuchname", EnumSet.of(Path.Type.file));
    new SpectraBulkService(session).pre(Transfer.Type.download, Collections.singletonMap(test, status),
            new DisabledConnectionCallback());
    new SpectraReadFeature(session).read(test, status, new DisabledConnectionCallback());
}

From source file:ch.cyberduck.core.cryptomator.DAVTouchFeatureTest.java

@Test
public void testTouchLongFilenameEncrypted() throws Exception {
    final Host host = new Host(new DAVProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("webdav.user"),
                    System.getProperties().getProperty("webdav.password")));
    host.setDefaultPath("/dav/basic");
    final DAVSession session = new DAVSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new DefaultHomeFinderService(session).find();
    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(/*from w  ww . ja v  a2 s  . co m*/
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    new CryptoTouchFeature<String>(session,
            new DefaultTouchFeature<String>(new DAVUploadFeature(new DAVWriteFeature(session))),
            new DAVWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DAVFindFeature(session), cryptomator).find(test));
    new CryptoDeleteFeature(session, new DAVDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:net.gazeplay.commons.utils.games.Utils.java

/**
 * @return Default directory for GazePlay : in user's home directory, in a folder called GazePlay
 *///from   www.  j  a va 2 s .c o  m
public static String getGazePlayFolder() {

    return System.getProperties().getProperty("user.home") + FILESEPARATOR + "GazePlay" + FILESEPARATOR;
}

From source file:com.googlecode.psiprobe.controllers.system.SysInfoController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    SystemInformation systemInformation = new SystemInformation();
    systemInformation.setAppBase(getContainerWrapper().getTomcatContainer().getAppBase().getAbsolutePath());
    systemInformation.setConfigBase(getContainerWrapper().getTomcatContainer().getConfigBase());

    Map sysProps = new Properties();
    sysProps.putAll(System.getProperties());

    if (!SecurityUtils.hasAttributeValueRole(getServletContext(), request)) {
        for (Iterator it = filterOutKeys.iterator(); it.hasNext();) {
            sysProps.remove(it.next());//from   ww  w . j a v  a 2  s  .c  o m
        }
    }

    systemInformation.setSystemProperties(sysProps);

    return new ModelAndView(getViewName()).addObject("systemInformation", systemInformation)
            .addObject("runtime", getRuntimeInfoAccessor().getRuntimeInformation())
            .addObject("collectionPeriod", new Long(getCollectionPeriod()));
}

From source file:ch.cyberduck.core.cryptomator.FTPDirectoryFeatureTest.java

@Test
public void testMakeDirectoryEncrypted() throws Exception {
    final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("ftp.user"),
                    System.getProperties().getProperty("ftp.password")));
    final FTPSession session = new FTPSession(host);
    session.open(new DisabledHostKeyCallback());
    final PathCache cache = new PathCache(100);
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path testdirectory = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path testdirectory2 = new Path(testdirectory, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path testfile2 = new Path(testdirectory2, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(//from w  w  w  .  j ava 2s  . c o  m
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    new CryptoDirectoryFeature<Integer>(session, new FTPDirectoryFeature(session), new FTPWriteFeature(session),
            cryptomator).mkdir(testdirectory, null, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).withCache(cache)
            .find(testdirectory));
    new CryptoDirectoryFeature<Integer>(session, new FTPDirectoryFeature(session), new FTPWriteFeature(session),
            cryptomator).mkdir(testdirectory2, null, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).withCache(cache)
            .find(testdirectory2));
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).withCache(cache)
            .find(testfile2));
    new CryptoDeleteFeature(session, new FTPDeleteFeature(session), cryptomator).delete(
            Arrays.asList(testdirectory2, testdirectory), new DisabledLoginCallback(),
            new Delete.DisabledCallback());
    session.close();
}

From source file:ch.cyberduck.core.cryptomator.SwiftDirectoryFeatureTest.java

@Test
public void testMakeDirectoryEncrypted() 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 AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(//from w  w  w.j  a v  a2  s . c  o m
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    new CryptoDirectoryFeature<StorageObject>(session, new SwiftDirectoryFeature(session),
            new SwiftWriteFeature(session, new SwiftRegionService(session)), cryptomator).mkdir(test, null,
                    new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(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:ch.cyberduck.core.b2.B2LargeUploadServiceTest.java

@Test
public void testUpload() throws Exception {
    final B2Session session = new B2Session(new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(),
            new Credentials(System.getProperties().getProperty("b2.user"),
                    System.getProperties().getProperty("b2.key"))));
    final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());

    final Path test = new Path(bucket, UUID.randomUUID().toString() + ".txt", EnumSet.of(Path.Type.file));
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());

    // Each segment, except the last, must be larger than 100MB.
    final int length = 100 * 1024 * 1024 + 1;
    final byte[] content = RandomUtils.nextBytes(length);

    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);//from ww  w  .  j  a  va2  s .  c  o m
    out.close();
    final TransferStatus status = new TransferStatus();
    status.setLength(content.length);
    final Checksum checksum = new SHA1ChecksumCompute().compute(new ByteArrayInputStream(content),
            new TransferStatus());
    status.setChecksum(checksum);

    final B2LargeUploadService upload = new B2LargeUploadService(session, new B2WriteFeature(session),
            PreferencesFactory.get().getLong("b2.upload.largeobject.size"),
            PreferencesFactory.get().getInteger("b2.upload.largeobject.concurrency"));

    upload.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(),
            status, new DisabledConnectionCallback());
    assertEquals(checksum, new B2AttributesFinderFeature(session).find(test).getChecksum());

    assertTrue(status.isComplete());
    assertFalse(status.isCanceled());
    assertEquals(content.length, status.getOffset());

    assertTrue(new DefaultFindFeature(session).find(test));
    final InputStream in = new B2ReadFeature(session).read(test, new TransferStatus(),
            new DisabledConnectionCallback());
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length);
    new StreamCopier(status, status).transfer(in, buffer);
    in.close();
    buffer.close();
    assertArrayEquals(content, buffer.toByteArray());
    new B2DeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(),
            new Delete.DisabledCallback());
    local.delete();
    session.close();
}

From source file:com.lrs.enviroment.Metadata.java

private void afterLoading() {
    Map map = new HashMap();
    // allow override via system properties
    map.putAll(System.getProperties());
    delegateMap.putAll(map);/*from   w w  w .  j  av a  2  s  .  co  m*/

}