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) 

Source Link

Document

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

Usage

From source file:com.cerebro.gorgone.commons.SendConfEmail.java

public SendConfEmail(String address, String confCode) {

    logger.info("Invio della mail di conferma");
    // Leggo i parametri di invio
    Properties props = new Properties();
    InputStream config = VaadinServlet.getCurrent().getServletContext()
            .getResourceAsStream("/WEB-INF/config.properties");
    if (config != null) {
        try {/*from   w w  w . java2 s. c om*/
            logger.info("Carico il file .properties");
            props.load(config);
        } catch (Exception ex) {
            logger.error("Errore nel caricamento del file .properties: " + ex.getMessage());
        }
    }
    smtp_host = props.getProperty(ConfigProperties.SMTP_HOST);
    smtp_port = Integer.getInteger(props.getProperty(ConfigProperties.SMTP_PORT));
    smtp_user = props.getProperty(ConfigProperties.SMTP_USER);
    smtp_pwd = props.getProperty(ConfigProperties.SMTP_PWD);
    smtp_security = Boolean.parseBoolean(ConfigProperties.SMTP_SECURITY);
    // Creo la mail
    HtmlEmail email = new HtmlEmail();
    try {
        email.setHostName(smtp_host);
        email.setSmtpPort(smtp_port);
        email.setSSLOnConnect(smtp_security);
        email.setAuthentication(smtp_user, smtp_pwd);
        email.setFrom("gioco@gioco.com", "Gioco");
        email.setSubject("Conferma il tuo indirizzo email " + confCode);
        email.addTo(address);
        email.setMsg("Messaggio della mail");
        email.send();
        logger.info("Email inviata");
    } catch (EmailException ex) {
        logger.error("Errore nell'invio della mail");
        logger.error(ex.getMessage());
    }
}

From source file:fi.csc.emrex.smp.model.Person.java

public void setGender(String gender) {
    Integer temp = Integer.getInteger(gender);
    if (temp == null) {
        this.gender = 9;
    } else {//from w  w w  .  java  2  s  . c  om
        this.gender = temp;
    }
}

From source file:com.rabidgremlin.legalbeagle.util.HttpHelper.java

public HttpHelper() throws Exception {
    JAXBContext jc = JAXBContext.newInstance("com.rabidgremlin.legalbeagle.xmlbindings");
    u = jc.createUnmarshaller();/*from  w w  w.  j  a  v a2s.c o m*/

    // -Dhttp.proxyHost=prox -Dhttp.proxyPort=1234
    // TODO: better error handling here
    if (System.getProperty("http.proxyHost") != null) {
        proxy = new HttpHost(System.getProperty("http.proxyHost"), Integer.getInteger("http.proxyPort"));
    }

}

From source file:org.apache.sling.karaf.tests.configuration.SlingLaunchpadOakTarConfiguration.java

@Configuration
public Option[] configuration() throws Exception {
    final int httpPort = Integer.getInteger("http.port");
    return OptionUtils.combine(baseConfiguration(), cleanCaches(true),
            editConfigurationFilePut("etc/org.ops4j.pax.logging.cfg", "log4j.rootLogger",
                    "ERROR, out, sift, osgi:*"),
            // configurations for tests
            editConfigurationFilePut("etc/custom.properties", "sling.run.modes", "oak_tar"),
            editConfigurationFilePut("etc/users.properties", "admin", "admin,_g_:admingroup"), // Slings default admin credentials used in tests
            editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port",
                    Integer.toString(httpPort)),
            editConfigurationFilePut("etc/integrationTestsConfig.cfg", "message",
                    "This test config should be loaded at startup"),
            editConfigurationFilePut("etc/org.apache.sling.servlets.resolver.SlingServletResolver.cfg",
                    "servletresolver.cacheSize", "0"),
            // TODO PAXWEB-935 editConfigurationFilePut("etc/org.apache.sling.jcr.webdav.impl.servlets.SimpleWebDavServlet.cfg", "dav.root", "/dav"),
            editConfigurationFilePut("etc/org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet.cfg",
                    "alias", "/server"),
            editConfigurationFilePut(//from   w w w  . ja  va2  s. co  m
                    "etc/org.apache.sling.resourceresolver.impl.observation.OsgiObservationBridge.cfg",
                    "enabled", "true"),
            editConfigurationFilePut("etc/org.apache.sling.jcr.repoinit.impl.RepositoryInitializer.cfg",
                    "references", "raw:classpath://repoinit/repoinit.txt"),
            addSlingFeatures("sling-launchpad-oak-tar", "sling-launchpad-content", "sling-auth-form",
                    "sling-auth-openid", "sling-auth-selector", "sling-scripting-groovy",
                    "sling-scripting-javascript", "sling-scripting-jsp", "sling-installer-provider-jcr",
                    "sling-jcr-jackrabbit-security", "sling-jcr-repoinit"),
            // bundle for test (contains repoinit.txt)
            testBundle(),
            // misc (legacy, snapshots, ...) stuff
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.servlets.compat")
                    .versionAsInProject(),
            // Pax Url TODO: feature?
            mavenBundle().groupId("org.ops4j.pax.url").artifactId("pax-url-commons").version("2.4.7"),
            mavenBundle().groupId("org.ops4j.pax.url").artifactId("pax-url-classpath").version("2.4.7"),
            mavenBundle().groupId("org.ops4j.base").artifactId("ops4j-base-lang").version("1.5.0"),
            mavenBundle().groupId("org.ops4j.base").artifactId("ops4j-base-util-property").version("1.5.0"),
            mavenBundle().groupId("org.ops4j.pax.swissbox").artifactId("pax-swissbox-property")
                    .version("1.8.2"),
            // test support
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.junit.core")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.junit.remote")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.junit.scriptable")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.launchpad.test-services")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.launchpad.test-fragment")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.testing.tools")
                    .versionAsInProject(),
            mavenBundle().groupId("org.apache.httpcomponents").artifactId("httpcore-osgi").versionAsInProject(),
            mavenBundle().groupId("org.apache.httpcomponents").artifactId("httpclient-osgi")
                    .versionAsInProject(),
            // TODO PAXWEB-935
            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.jcr.webdav")
                    .version("2.2.2"));
}

From source file:com.revo.deployr.rbroker.example.data.io.anon.discrete.task.RepoFileInGraphicsPlotOut.java

public RepoFileInGraphicsPlotOut() {

    RBroker rBroker = null;//from   ww  w. j ava  2 s.  c  o m

    try {

        /*
         * Determine DeployR server endpoint.
         */
        String endpoint = System.getProperty("endpoint");
        log.info("[ CONFIGURATION  ] Using endpoint [ " + endpoint + " ]");

        /*
         * Build configuration to initialize RBroker instance.
         */
        DiscreteBrokerConfig brokerConfig = new DiscreteBrokerConfig(endpoint, null,
                Integer.getInteger("example-max-concurrency"));

        log.info("[ CONFIGURATION  ] Using broker config " + "[ DiscreteBrokerConfig ]");

        /*
         * Establish RBroker connection to DeployR server.
         */
        rBroker = RBrokerFactory.discreteTaskBroker(brokerConfig);

        /*
         * Register asynchronous listeners for task and
         * broker runtime events.
         */
        rBroker.addTaskListener(this);
        rBroker.addBrokerListener(this);

        log.info("[   CONNECTION   ] Established anonymous " + "discrete broker [ RBroker ].");

        /*
         * Create the DiscreteTaskOptions object
         * to specify data inputs and output to the task.
         *
         * This options object can be used to pass standard
         * execution model parameters on execution calls. All
         * fields are optional.
         *
         * See the Standard Execution Model chapter in the
         * Client Library Tutorial on the DeployR website for
         * further details.
         */
        DiscreteTaskOptions options = new DiscreteTaskOptions();

        /* 
         * Preload from the DeployR repository the following
         * data input file:
         * /testuser/example-data-io/hipStar.dat
         */
        TaskPreloadOptions preloadWorkspace = new TaskPreloadOptions();
        preloadWorkspace.filename = "hipStar.rData";
        preloadWorkspace.directory = "example-data-io";
        preloadWorkspace.author = "testuser";
        options.preloadWorkspace = preloadWorkspace;

        log.info("[   DATA INPUT   ] Repository binary file input "
                + "set on task, [ DiscreteTaskOptions.preloadWorkspace ].");

        /*
         * Declare task for execution on broker based on
         * repository-managed R script:
         * /testuser/example-data-io/dataIO.R
         */
        RTask rTask = RTaskFactory.discreteTask("dataIO.R", "example-data-io", "testuser", null, options);

        rBroker.submit(rTask);

        log.info("[   EXECUTION    ] Discrete task " + "submitted to broker [ RTask ].");

        /*
         * Simple block on main thread of this sample application
         * until example RTask execution completes.
         */
        latch.await();

    } catch (Exception ex) {
        log.warn("Unexpected error: ex=" + ex);
    } finally {
        /*
         * Clean-up after example completes.
         */
        if (rBroker != null) {
            try {
                rBroker.shutdown();
            } catch (Exception bex) {
                log.warn("RBroker.shutdown ex=" + bex);
            }
        }
    }

}

From source file:com.revo.deployr.rbroker.example.data.io.anon.discrete.task.ExternalDataInDataFileOut.java

public ExternalDataInDataFileOut() {

    RBroker rBroker = null;// ww  w  . j  a v a  2  s  . co  m

    try {

        /*
         * Determine DeployR server endpoint.
         */
        String endpoint = System.getProperty("endpoint");
        log.info("[ CONFIGURATION  ] Using endpoint [ " + endpoint + " ]");

        /*
         * Build configuration to initialize RBroker instance.
         */
        DiscreteBrokerConfig brokerConfig = new DiscreteBrokerConfig(endpoint, null,
                Integer.getInteger("example-max-concurrency"));

        log.info("[ CONFIGURATION  ] Using broker config " + "[ DiscreteBrokerConfig ]");

        /*
         * Establish RBroker connection to DeployR server.
         */
        rBroker = RBrokerFactory.discreteTaskBroker(brokerConfig);

        /*
         * Register asynchronous listeners for task and
         * broker runtime events.
         */
        rBroker.addTaskListener(this);
        rBroker.addBrokerListener(this);

        log.info("[   CONNECTION   ] Established anonymous " + "discrete broker [ RBroker ].");

        /*
         * Create the DiscreteTaskOptions object
         * to specify data inputs and output to the task.
         *
         * This options object can be used to pass standard
         * execution model parameters on execution calls. All
         * fields are optional.
         *
         * See the Standard Execution Model chapter in the
         * Client Library Tutorial on the DeployR website for
         * further details.
         */
        DiscreteTaskOptions options = new DiscreteTaskOptions();

        /* 
         * Load an R object literal "hipStarUrl" into the
         * workspace prior to task execution.
         *
         * The R script checks for the existence of "hipStarUrl"
         * in the workspace and if present uses the URL path
         * to load the Hipparcos star dataset from the DAT file
         * at that location.
         */
        RData hipStarUrl = RDataFactory.createString("hipStarUrl", HIP_DAT_URL);
        List<RData> rinputs = Arrays.asList(hipStarUrl);
        options.rinputs = rinputs;

        log.info("[   DATA INPUT   ] External data source input "
                + "set on task, [ DiscreteTaskOptions.rinputs ].");

        /*
         * Declare task for execution on broker based on
         * repository-managed R script:
         * /testuser/example-data-io/dataIO.R
         */
        RTask rTask = RTaskFactory.discreteTask("dataIO.R", "example-data-io", "testuser", null, options);

        rBroker.submit(rTask);

        log.info("[   EXECUTION    ] Discrete task " + "submitted to broker [ RTask ].");

        /*
         * Simple block on main thread of this sample application
         * until example RTask execution completes.
         */
        latch.await();

    } catch (Exception ex) {
        log.warn("Unexpected error: ex=" + ex);
    } finally {
        /*
         * Clean-up after example completes.
         */
        if (rBroker != null) {
            try {
                rBroker.shutdown();
            } catch (Exception bex) {
                log.warn("RBroker.shutdown ex=" + bex);
            }
        }
    }

}

From source file:com.revo.deployr.rbroker.example.data.io.anon.discrete.task.EncodedDataInBinaryFileOut.java

public EncodedDataInBinaryFileOut() {

    RBroker rBroker = null;/*from w  ww  . j a  v a2s. com*/

    try {

        /*
         * Determine DeployR server endpoint.
         */
        String endpoint = System.getProperty("endpoint");
        log.info("[ CONFIGURATION  ] Using endpoint [ " + endpoint + " ]");

        /*
         * Build configuration to initialize RBroker instance.
         */
        DiscreteBrokerConfig brokerConfig = new DiscreteBrokerConfig(endpoint, null,
                Integer.getInteger("example-max-concurrency"));

        log.info("[ CONFIGURATION  ] Using broker config " + "[ DiscreteBrokerConfig ]");

        /*
         * Establish RBroker connection to DeployR server.
         */
        rBroker = RBrokerFactory.discreteTaskBroker(brokerConfig);

        /*
         * Register asynchronous listeners for task and
         * broker runtime events.
         */
        rBroker.addTaskListener(this);
        rBroker.addBrokerListener(this);

        log.info("[   CONNECTION   ] Established anonymous " + "discrete broker [ RBroker ].");

        /*
         * Create the DiscreteTaskOptions object
         * to specify data inputs and output to the task.
         *
         * This options object can be used to pass standard
         * execution model parameters on execution calls. All
         * fields are optional.
         *
         * See the Standard Execution Model chapter in the
         * Client Library Tutorial on the DeployR website for
         * further details.
         */
        DiscreteTaskOptions options = new DiscreteTaskOptions();

        /* 
         * Simulate application generated data. This data
         * is first encoded using the RDataFactory before
         * being passed as an input on the execution.
         *
         * This encoded R input is automatically converted
         * into a workspace object before script execution.
         */
        RData generatedData = DeployRUtil.simulateGeneratedData(log);
        if (generatedData != null) {
            List<RData> rinputs = Arrays.asList(generatedData);
            options.rinputs = rinputs;
        }

        log.info("[   DATA INPUT   ] DeployR-encoded R input "
                + "set on task, [ DiscreteTaskOptions.rinputs ].");

        /*
         * Declare task for execution on broker based on
         * repository-managed R script:
         * /testuser/example-data-io/dataIO.R
         */
        RTask rTask = RTaskFactory.discreteTask("dataIO.R", "example-data-io", "testuser", null, options);

        rBroker.submit(rTask);

        log.info("[   EXECUTION    ] Discrete task " + "submitted to broker [ RTask ].");

        /*
         * Simple block on main thread of this sample application
         * until example RTask execution completes.
         */
        latch.await();

    } catch (Exception ex) {
        log.warn("Unexpected error: ex=" + ex);
    } finally {
        /*
         * Clean-up after example completes.
         */
        if (rBroker != null) {
            try {
                rBroker.shutdown();
            } catch (Exception bex) {
                log.warn("RBroker.shutdown ex=" + bex);
            }
        }
    }

}

From source file:com.revo.deployr.rbroker.example.data.io.anon.discrete.task.RepoFileInEncodedDataOut.java

public RepoFileInEncodedDataOut() {

    RBroker rBroker = null;/*from  w  ww  .  java2 s  . c  o  m*/

    try {

        /*
         * Determine DeployR server endpoint.
         */
        String endpoint = System.getProperty("endpoint");
        log.info("[ CONFIGURATION  ] Using endpoint [ " + endpoint + " ]");

        /*
         * Build configuration to initialize RBroker instance.
         */
        DiscreteBrokerConfig brokerConfig = new DiscreteBrokerConfig(endpoint, null,
                Integer.getInteger("example-max-concurrency"));

        log.info("[ CONFIGURATION  ] Using broker config " + "[ DiscreteBrokerConfig ]");

        /*
         * Establish RBroker connection to DeployR server.
         */
        rBroker = RBrokerFactory.discreteTaskBroker(brokerConfig);

        /*
         * Register asynchronous listeners for task and
         * broker runtime events.
         */
        rBroker.addTaskListener(this);
        rBroker.addBrokerListener(this);

        log.info("[   CONNECTION   ] Established anonymous " + "discrete broker [ RBroker ].");

        /*
         * Create the DiscreteTaskOptions object
         * to specify data inputs and output to the task.
         *
         * This options object can be used to pass standard
         * execution model parameters on execution calls. All
         * fields are optional.
         *
         * See the Standard Execution Model chapter in the
         * Client Library Tutorial on the DeployR website for
         * further details.
         */
        DiscreteTaskOptions options = new DiscreteTaskOptions();

        /* 
         * Preload from the DeployR repository the following
         * binary R object input file:
         * /testuser/example-data-io/hipStar.rData
         *
         * As this is an anonymous operation "hipStar.rData"
         * must have it's repository-managed access controls
         * set to "public".
         */
        TaskPreloadOptions preloadWorkspace = new TaskPreloadOptions();
        preloadWorkspace.filename = "hipStar.rData";
        preloadWorkspace.directory = "example-data-io";
        preloadWorkspace.author = "testuser";
        options.preloadWorkspace = preloadWorkspace;

        log.info("[   DATA INPUT   ] Repository binary file input "
                + "set on task, [ DiscreteTaskOptions.preloadWorkspace ].");

        /* 
         * Load an R object literal "hipStarUrl" into the
         * workspace prior to task execution.
         *
         * The R script checks for the existence of "hipStarUrl"
         * in the workspace and if present uses the URL path
         * to load the Hipparcos star dataset from the DAT file
         * at that location.
         */
        RData hipStarUrl = RDataFactory.createString("hipStarUrl", HIP_DAT_URL);
        List<RData> rinputs = Arrays.asList(hipStarUrl);
        options.rinputs = rinputs;

        log.info("[   DATA INPUT   ] External data source input "
                + "set on task, [ DiscreteTaskOptions.rinputs ].");

        /*
         * Request the retrieval of the "hip" data.frame and
         * two vector objects from the workspace following the
         * task execution. The corresponding R objects are named
         * as follows:
         * 'hip', hipDim', 'hipNames'.
         */
        options.routputs = Arrays.asList("hip", "hipDim", "hipNames");

        log.info("[  TASK OPTION   ] DeployR-encoded R object request "
                + "set on task [ DiscreteTaskOptions.routputs ].");

        /*
         * Declare task for execution on broker based on
         * repository-managed R script:
         * /testuser/example-data-io/dataIO.R
         */
        RTask rTask = RTaskFactory.discreteTask("dataIO.R", "example-data-io", "testuser", null, options);

        rBroker.submit(rTask);

        log.info("[   EXECUTION    ] Discrete task " + "submitted to broker [ RTask ].");

        /*
         * Simple block on main thread of this sample application
         * until example RTask execution completes.
         */
        latch.await();

    } catch (Exception ex) {
        log.warn("Unexpected error: ex=" + ex);
    } finally {
        /*
         * Clean-up after example completes.
         */
        if (rBroker != null) {
            try {
                rBroker.shutdown();
            } catch (Exception bex) {
                log.warn("RBroker.shutdown ex=" + bex);
            }
        }
    }

}

From source file:net.networksaremadeofstring.rhybudd.ZenossEvent.java

public ZenossEvent(Intent intent) {
    this.Count = Integer.getInteger(intent.getExtras().getString("count"));
    this.evid = intent.getExtras().getString("evid");
    this.device = intent.getExtras().getString("device");
    this.summary = intent.getExtras().getString("summary");
    this.severity = intent.getExtras().getString("severity");
    this.eventClass = intent.getExtras().getString("event_class");
    //String event_class_key = intent.getExtras().getString("event_class_key");
    //String sent = intent.getExtras().getString("sent");
}

From source file:com.revo.deployr.rbroker.example.data.io.auth.pooled.task.RepoFileInGraphicsPlotOut.java

public RepoFileInGraphicsPlotOut() {

    RBroker rBroker = null;/*from  w  ww  .java 2s .co  m*/

    try {

        /*
         * Determine DeployR server endpoint.
         */
        String endpoint = System.getProperty("endpoint");
        log.info("[ CONFIGURATION  ] Using endpoint [ " + endpoint + " ]");

        /*
         * Build configuration to initialize RBroker instance.
         */
        RAuthentication rAuth = new RBasicAuthentication(System.getProperty("username"),
                System.getProperty("password"));
        PooledBrokerConfig brokerConfig = new PooledBrokerConfig(endpoint, rAuth,
                Integer.getInteger("example-max-concurrency"));

        log.info("[ CONFIGURATION  ] Using broker config " + "[ PooledBrokerConfig ]");

        /*
         * Establish RBroker connection to DeployR server.
         */
        rBroker = RBrokerFactory.pooledTaskBroker(brokerConfig);

        /*
         * Register asynchronous listeners for task and
         * broker runtime events.
         */
        rBroker.addTaskListener(this);
        rBroker.addBrokerListener(this);

        log.info("[   CONNECTION   ] Established authenticated " + "pooled broker [ RBroker ].");

        /*
         * Create the PooledTaskOptions object
         * to specify data inputs and output to the task.
         *
         * This options object can be used to pass standard
         * execution model parameters on execution calls. All
         * fields are optional.
         *
         * See the Standard Execution Model chapter in the
         * Client Library Tutorial on the DeployR website for
         * further details.
         */
        PooledTaskOptions options = new PooledTaskOptions();

        /* 
         * Preload from the DeployR repository the following
         * data input file:
         * /testuser/example-data-io/hipStar.dat
         */
        TaskPreloadOptions preloadWorkspace = new TaskPreloadOptions();
        preloadWorkspace.filename = "hipStar.rData";
        preloadWorkspace.directory = "example-data-io";
        preloadWorkspace.author = "testuser";
        options.preloadWorkspace = preloadWorkspace;

        log.info("[   TASK INPUT   ] Repository binary file input "
                + "set on task, [ PooledTaskOptions.preloadWorkspace ].");

        /*
         * Declare task for execution on broker based on
         * repository-managed R script:
         * /testuser/example-data-io/dataIO.R
         */
        RTask rTask = RTaskFactory.pooledTask("dataIO.R", "example-data-io", "testuser", null, options);

        rBroker.submit(rTask);

        log.info("[   EXECUTION    ] Pooled task " + "submitted to broker [ RTask ].");

        /*
         * Simple block on main thread of this sample application
         * until example RTask execution completes.
         */
        latch.await();

    } catch (Exception ex) {
        log.warn("Unexpected error: ex=" + ex);
    } finally {
        /*
         * Clean-up after example completes.
         */
        if (rBroker != null) {
            try {
                rBroker.shutdown();
            } catch (Exception bex) {
                log.warn("RBroker.shutdown ex=" + bex);
            }
        }
    }

}