List of usage examples for java.lang Integer getInteger
public static Integer getInteger(String nm, Integer val)
From source file:de.ingrid.interfaces.csw.admin.IndexDriver.java
/** * @param args//from w w w .j a va2 s. com * @throws Exception */ public static void main(String[] args) throws Exception { if (!System.getProperties().containsKey("jetty.webapp")) log.warn("Property 'jetty.webapp' not defined! Using default webapp directory, which is '" + DEFAULT_WEBAPP_DIR + "'."); if (!System.getProperties().containsKey("jetty.port")) log.warn("Property 'jetty.port' not defined! Using default port, which is '" + DEFAULT_JETTY_PORT + "'."); WebAppContext webAppContext = new WebAppContext(System.getProperty("jetty.webapp", DEFAULT_WEBAPP_DIR), "/"); Server server = new Server(Integer.getInteger("jetty.port", DEFAULT_JETTY_PORT)); // fix slow startup time on virtual machine env. HashSessionIdManager hsim = new HashSessionIdManager(); hsim.setRandom(new Random()); server.setSessionIdManager(hsim); server.setHandler(webAppContext); server.start(); WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext( webAppContext.getServletContext(), "org.springframework.web.servlet.FrameworkServlet.CONTEXT.springapp"); IndexRunnable r = (IndexRunnable) wac.getBean("indexRunnable"); r.run(); System.out.println("Try to stopping the iPlug..."); server.stop(); System.out.println("iPlug is stopped."); }
From source file:org.wso2.integration.tooling.service.workspace.app.WorkspaceServiceRunner.java
public static void main(String[] args) { boolean isCloudMode = false; // configure possible command line options Options options = new Options(); Option cloudModeOption = new Option(Constants.CLOUD_MODE_INDICATOR_ARG, Constants.CLOUD_MODE_INDICATOR_ARG_DESC); options.addOption(cloudModeOption);/*from ww w . j a v a2 s . c o m*/ // read console args and process options CommandLineParser parser = new DefaultParser(); HelpFormatter formatter = new HelpFormatter(); CommandLine commandLine; try { commandLine = parser.parse(options, args); isCloudMode = commandLine.hasOption(Constants.CLOUD_MODE_INDICATOR_ARG); logger.debug(isCloudMode ? "Cloud mode enabled." : "Running in local mode."); } catch (ParseException e) { // not a blocker logger.warn("Exception while parsing console arguments.", e); formatter.printHelp("workspace-service", options); } Injector injector = Guice.createInjector(new WorkspaceServiceModule(isCloudMode)); new MicroservicesRunner(Integer.getInteger("http.port", 8289)) .deploy(injector.getInstance(WorkspaceService.class)).start(); String contextRoot = System.getProperty("web.context"); int port = Integer.getInteger("http.editor.port", 8288); if (contextRoot == null) { contextRoot = "web"; } FileServer fileServer = new FileServer(); fileServer.setContextRoot(contextRoot); new MicroservicesRunner(port).deploy(fileServer).start(); if (!isCloudMode) { logger.info("Ballerina Editor URL: http://localhost:" + port); } }
From source file:org.atomserver.utils.jetty.StandAloneAtomServer.java
public static void main(String[] args) throws Exception { // the System Property "atomserver.home" defines the home directory for the standalone app String atomserverHome = System.getProperty("atomserver.home"); if (StringUtils.isEmpty(atomserverHome)) { log.error("The variable \"atomserver.home\" must be defined"); System.exit(-1);/*from ww w.j a va 2 s . co m*/ } File atomserverHomeDir = new File(atomserverHome); if (!atomserverHomeDir.exists() && !atomserverHomeDir.isDirectory()) { log.error("The variable \"atomserver.home\" (" + atomserverHome + ") must point to a directory that exists"); } // instantiate the Jetty Server Server server = new Server(); // create a new connector on the declared port, and set it onto the server log.debug("atomserver.port = " + System.getProperty("atomserver.port")); Connector connector = new SelectChannelConnector(); connector.setPort(Integer.getInteger("atomserver.port", DEFAULT_PORT)); server.setConnectors(new Connector[] { connector }); // create a ClassLoader that points at the conf directories log.debug("atomserver.conf.dir = " + System.getProperty("atomserver.conf.dir")); log.debug("atomserver.ops.conf.dir = " + System.getProperty("atomserver.ops.conf.dir")); ClassLoader classLoader = new ConfigurationAwareClassLoader(StandAloneAtomServer.class.getClassLoader()); // load the version from the version.properties file Properties versionProps = new Properties(); versionProps.load(classLoader.getResourceAsStream(DEFAULT_VERSIONS_FILE)); String version = versionProps.getProperty("atomserver.version"); // create a new webapp, rooted at webapps/atomserver-${version}, with the configured // context name String servletContextName = System.getProperty("atomserver.servlet.context"); log.debug("atomserver.servlet.context = " + servletContextName); WebAppContext webapp = new WebAppContext(atomserverHome + "/webapps/atomserver-" + version, "/" + servletContextName); // set the webapp's ClassLoader to be the one that loaded THIS class. the REASON that // this needs to be set is so that when we extract the web application context below we can // cast it to WebApplicationContext here webapp.setClassLoader(StandAloneAtomServer.class.getClassLoader()); // set the Jetty server's webapp and start it server.setHandler(webapp); server.start(); // if the seed system property was set, use the DBSeeder to populate the server String seedDB = System.getProperty("seed.database.with.pets"); log.debug("seed.database.with.pets = " + seedDB); if (!StringUtils.isEmpty(seedDB)) { if (Boolean.valueOf(seedDB)) { Thread.sleep(2000); WebApplicationContext webappContext = WebApplicationContextUtils .getWebApplicationContext(webapp.getServletContext()); DBSeeder.getInstance(webappContext).seedPets(); } } server.join(); }
From source file:Main.java
final public static int encodeHexStrToInt(String color) { return Integer.getInteger(color, 0); }
From source file:Main.java
public static ScheduledExecutorService createStatisticsExecutor() { return Executors.newScheduledThreadPool(Integer.getInteger(ORG_EHCACHE_STATISTICS_EXECUTOR_POOL_SIZE, 1), new ThreadFactory() { private AtomicInteger cnt = new AtomicInteger(0); @Override/*from www . j a v a 2s . co m*/ public Thread newThread(Runnable r) { Thread t = new Thread(r, "Statistics Thread-" + cnt.incrementAndGet()); t.setDaemon(true); return t; } }); }
From source file:Main.java
/** * Gets an integer property as a privileged action. * * @param property_name the integer property name * @param default_val the default value to use if the property is not defined * * @return the property value/*from w w w . j a v a2 s . co m*/ */ public static Integer getPrivilegedInteger(final String property_name, final int default_val) { return AccessController.doPrivileged(new PrivilegedAction<Integer>() { public Integer run() { return Integer.getInteger(property_name, default_val); } }); }
From source file:org.apache.archiva.web.test.tools.WebdriverUtility.java
public static WebDriver newWebDriver() { String seleniumBrowser = System.getProperty("selenium.browser"); String seleniumHost = System.getProperty("seleniumHost", "localhost"); int seleniumPort = Integer.getInteger("seleniumPort", 4444); boolean seleniumRemote = Boolean.parseBoolean(System.getProperty("seleniumRemote", "false")); return newWebDriver(seleniumBrowser, seleniumHost, seleniumPort, seleniumRemote); }
From source file:com.redapesolutions.syncnow.SyncNow.java
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { int resId = cordova.getActivity().getResources().getIdentifier(mLicenseKey, "string", cordova.getActivity().getPackageName()); int mNumIdentifierBitsId = cordova.getActivity().getResources().getIdentifier(mNumIdentifierBitsKey, "string", cordova.getActivity().getPackageName()); int mNumTimeStampBitsId = cordova.getActivity().getResources().getIdentifier(mNumTimeStampBitsKey, "string", cordova.getActivity().getPackageName()); int mTimeStampLoopId = cordova.getActivity().getResources().getIdentifier(mTimeStampLoopKey, "string", cordova.getActivity().getPackageName()); String license = cordova.getActivity().getString(resId); int mNumIdentifierBits = Integer.getInteger(cordova.getActivity().getString(mNumIdentifierBitsId), 4); int mNumTimeStampBits = Integer.getInteger(cordova.getActivity().getString(mNumTimeStampBitsId), 4); boolean mTimeStampLoop = Boolean.getBoolean(cordova.getActivity().getString(mTimeStampLoopId)); syncNow = new SyncNowPlugin(license, mNumIdentifierBits, mNumTimeStampBits, mTimeStampLoop); super.initialize(cordova, webView); }
From source file:net.ushkinaz.storm8.http.HttpClientProvider.java
@Override public HttpClient get() { HttpClient httpClient = new HttpClient(); if (System.getProperty(HTTP_PROXY_HOST) != null) { httpClient.getHostConfiguration().setProxy(System.getProperty(HTTP_PROXY_HOST), Integer.getInteger(HTTP_PROXY_PORT, 3128)); }/* w w w .j a v a 2 s . c o m*/ return httpClient; }
From source file:org.apache.cassandra.auth.PasswordAuthenticator.java
static int getGensaltLogRounds() { int rounds = Integer.getInteger(GENSALT_LOG2_ROUNDS_PROPERTY, 10); if (rounds < 4 || rounds > 31) throw new RuntimeException(new ConfigurationException( String.format("Bad value for system property -D%s. " + "Please use a value 4 and 31", GENSALT_LOG2_ROUNDS_PROPERTY))); return rounds; }