Example usage for java.lang Integer getInteger

List of usage examples for java.lang Integer getInteger

Introduction

In this page you can find the example usage for java.lang Integer getInteger.

Prototype

public static Integer getInteger(String nm, Integer val) 

Source Link

Document

Returns the integer value of the system property with the specified name.

Usage

From source file:RolloverFileOutputStream.java

public RolloverFileOutputStream(String filename, boolean append) throws IOException {
    this(filename, append, Integer.getInteger("ROLLOVERFILE_RETAIN_DAYS", 31).intValue());
}

From source file:fr.ybonnel.simpleweb4j.MultipartIntegrationTest.java

@Before
public void startServer() {
    resetDefaultValues();/*from  w  w w.java 2  s.  c  o  m*/
    port = Integer.getInteger("test.http.port", random.nextInt(10000) + 10000);
    setPort(port);

    resource(new RestResource<TestUploadImage>("multipart", TestUploadImage.class) {
        @Override
        public TestUploadImage getById(String id) throws HttpErrorException {
            return null;
        }

        @Override
        public List<TestUploadImage> getAll() throws HttpErrorException {
            return Collections.emptyList();
        }

        @Override
        public void update(String id, TestUploadImage resource) throws HttpErrorException {
            resource.id = id;
            lastCall = resource;
        }

        @Override
        public TestUploadImage create(TestUploadImage resource) throws HttpErrorException {
            lastCall = resource;
            return resource;
        }

        @Override
        public Route<TestUploadImage, TestUploadImage> routeCreate() {
            return new Route<TestUploadImage, TestUploadImage>("multipart", TestUploadImage.class) {
                @Override
                public Response<TestUploadImage> handle(TestUploadImage param, RouteParameters routeParams)
                        throws HttpErrorException {
                    return new Response<>(create(param), HttpServletResponse.SC_CREATED);
                }

                @Override
                protected TestUploadImage getRouteParam(HttpServletRequest request) throws IOException {
                    try {
                        Part dataPart = request.getPart("data");
                        TestUploadImage data = ContentType.GSON
                                .fromJson(new InputStreamReader(dataPart.getInputStream()), getParamType());

                        Part imagePart = request.getPart("image");
                        if (null != imagePart) {
                            data.imageName = ((MultiPartInputStreamParser.MultiPart) imagePart)
                                    .getContentDispositionFilename();
                            data.image = IOUtils.toByteArray(imagePart.getInputStream());
                        }
                        return data;
                    } catch (ServletException e) {
                        e.printStackTrace();
                        return null;
                    }
                }
            };
        }

        @Override
        public Route<TestUploadImage, Void> routeUpdate() {
            return new Route<TestUploadImage, Void>("multipart/:id", TestUploadImage.class) {
                @Override
                public Response<Void> handle(TestUploadImage param, RouteParameters routeParams)
                        throws HttpErrorException {
                    update(routeParams.getParam("id"), param);
                    return new Response<>(null);
                }

                @Override
                protected TestUploadImage getRouteParam(HttpServletRequest request) throws IOException {
                    try {
                        Part dataPart = request.getPart("data");
                        InputStreamReader dataReader = new InputStreamReader(dataPart.getInputStream());
                        TestUploadImage data = ContentType.GSON.fromJson(dataReader, getParamType());
                        dataReader.close();

                        Part imagePart = request.getPart("image");
                        if (null != imagePart) {
                            data.imageName = ((MultiPartInputStreamParser.MultiPart) imagePart)
                                    .getContentDispositionFilename();
                            data.image = IOUtils.toByteArray(imagePart.getInputStream());
                        }
                        return data;
                    } catch (ServletException e) {
                        e.printStackTrace();
                        return null;
                    }
                }
            };
        }

        @Override
        public void delete(String id) throws HttpErrorException {
        }
    });

    start(false);
}

From source file:io.pivotal.gemfire.main.GemFireServerApplication.java

static CacheServer gemfireCacheServer(Cache gemfireCache) throws IOException {
    CacheServer gemfireCacheServer = gemfireCache.addCacheServer();

    gemfireCacheServer.setBindAddress(systemProperty("gemfire.cache.server.bind-address", "localhost"));
    gemfireCacheServer//from  w ww.  java 2s.  com
            .setHostnameForClients(systemProperty("gemfire.cache.server.hostname-for-clients", "localhost"));
    gemfireCacheServer.setPort(Integer.getInteger("gemfire.cache.server.port", 12480));
    gemfireCacheServer.setMaxConnections(DEFAULT_MAX_CONNECTIONS);
    gemfireCacheServer.setMaximumTimeBetweenPings(DEFAULT_MAX_TIME_BETWEEN_PINGS);
    gemfireCacheServer.start();

    return gemfireCacheServer;
}

From source file:org.jboss.test.web.test.ssl.SSLUnitTestCase.java

/** Test that access of the transport constrained redirects to the ssl connector
 * when using the SecurityDomain based connector config.
 * /*from  ww w  .  j av a  2  s.c  o m*/
 * @throws Exception
 */
public void testHttpRedirectSecurityDomain() throws Exception {
    log.info("+++ testHttpRedirectSecurityDomain");
    int port = Integer.getInteger("web.port", 8080).intValue();
    port += 1000;
    String httpNoAuth = "http://" + getServerHost() + ":" + port + "/";
    doHttpRedirect(httpNoAuth);
}

From source file:io.cloudslang.worker.management.services.OutboundBufferImpl.java

@PostConstruct
public void init() {
    maxBufferWeight = Integer.getInteger("out.buffer.max.buffer.weight", defaultBufferCapacity());
    logger.info("maxBufferWeight = " + maxBufferWeight);
}

From source file:org.apache.stratos.common.concurrent.locks.ReadWriteLock.java

public ReadWriteLock(String name) {
    this.name = name;
    this.lock = new ReentrantReadWriteLock(true);
    this.threadToLockSetMap = new ConcurrentHashMap<Long, Map<LockType, LockMetadata>>();

    readWriteLockMonitorEnabled = Boolean.getBoolean("read.write.lock.monitor.enabled");
    if (readWriteLockMonitorEnabled) {
        // Schedule read write lock monitor
        readWriteLockMonitorInterval = Integer.getInteger("read.write.lock.monitor.interval", 30000);
        threadPoolSize = Integer.getInteger(READ_WRITE_LOCK_MONITOR_THREAD_POOL_SIZE_KEY, 10);

        ScheduledExecutorService scheduledExecutorService = StratosThreadPool
                .getScheduledExecutorService(READ_WRITE_LOCK_MONITOR_THREAD_POOL, threadPoolSize);
        scheduledExecutorService.scheduleAtFixedRate(new ReadWriteLockMonitor(this),
                readWriteLockMonitorInterval, readWriteLockMonitorInterval, TimeUnit.MILLISECONDS);
        if (log.isDebugEnabled()) {
            log.debug(String.format("Lock monitor scheduled: [lock-name] %s [interval] %d seconds", name,
                    (readWriteLockMonitorInterval / 1000)));
        }//w  w  w . j  av  a 2 s .  c o  m
    }
}

From source file:org.apache.stratos.manager.statistics.publisher.DASApplicationSignUpDataPublisher.java

/**
 * Constructor for initializing the data publisher.
 */// ww w  .  j  a  v a 2s  .c  o  m
private DASApplicationSignUpDataPublisher() {
    super(getStreamDefinition(), ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
    int threadPoolSize = Integer.getInteger(StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_ID,
            StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_SIZE);
    executorService = StratosThreadPool
            .getExecutorService(StratosManagerConstants.STATS_PUBLISHER_THREAD_POOL_ID, threadPoolSize);
}

From source file:io.cloudslang.worker.management.services.InBuffer.java

@PostConstruct
private void init() {
    capacity = Integer.getInteger("worker.inbuffer.capacity", capacity);
    coolDownPollingMillis = Integer.getInteger("worker.inbuffer.coolDownPollingMillis", coolDownPollingMillis);
    logger.info("InBuffer capacity is set to :" + capacity + ", coolDownPollingMillis is set to :"
            + coolDownPollingMillis);//  w  ww.j av a 2  s .  c o  m
}

From source file:org.apache.oodt.cas.workflow.instrepo.DataSourceWorkflowInstanceRepositoryFactory.java

/**
 * <p>/*  w ww.j  a  va  2s  .  c om*/
 * Default constructor
 * </p>
 */
public DataSourceWorkflowInstanceRepositoryFactory() throws WorkflowException {
    String jdbcUrl, user, pass, driver;

    jdbcUrl = PathUtils.replaceEnvVariables(
            System.getProperty("org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.url"));
    user = PathUtils.replaceEnvVariables(
            System.getProperty("org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.user"));
    pass = PathUtils.replaceEnvVariables(
            System.getProperty("org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.pass"));
    driver = PathUtils.replaceEnvVariables(
            System.getProperty("org.apache.oodt.cas.workflow.instanceRep.datasource.jdbc.driver"));

    try {
        Class.forName(driver);
    } catch (ClassNotFoundException e) {
        throw new WorkflowException("Cannot load driver: " + driver);
    }

    GenericObjectPool connectionPool = new GenericObjectPool(null);

    dataSource = new PoolingDataSource(connectionPool);
    quoteFields = Boolean.getBoolean("org.apache.oodt.cas.workflow.instanceRep.datasource.quoteFields");
    pageSize = Integer.getInteger("org.apache.oodt.cas.workflow.instanceRep.pageSize", VAL);

}

From source file:org.jboss.test.web.test.ssl.SSLUnitTestCase.java

public void testHttpsSecurityDomain() throws Exception {
    log.info("+++ testHttps");
    int port = Integer.getInteger("secureweb.port", 8443).intValue();
    port += 1000;/*from w w  w.ja v a 2s  . co m*/
    String httpsNoAuth = "https://" + getServerHost() + ":" + port + "/";
    doHttps(httpsNoAuth);
}