List of usage examples for java.lang Integer getInteger
public static Integer getInteger(String nm)
From source file:com.revo.deployr.rbroker.example.data.io.auth.pooled.task.MultipleDataInMultipleDataOut.java
public MultipleDataInMultipleDataOut() { RBroker rBroker = null;/*w ww . 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. */ 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(); /* * MultipleDataInMultipleDataOut Example Note: * * The inputs sent on this example are contrived * and superfluous as the hipStar.rData binary R * object input and the hipStarUrl input perform * the exact same purpose...to load the Hip STAR * dataset into the workspace ahead of execution. * * The example is provided to simply demonstrate * the mechanism of specifying multiple inputs. */ /* * Preload from the DeployR repository the following * binary R object input file: * /testuser/example-data-io/hipStar.rData */ 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 ]."); /* * 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("[ TASK INPUT ] External data source input " + "set on task, [ PooledTaskOptions.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 [ PooledTaskOptions.routputs ]."); /* * 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); } } } }
From source file:com.revo.deployr.rbroker.example.data.io.auth.discrete.task.MultipleDataInMultipleDataOut.java
public MultipleDataInMultipleDataOut() { RBroker rBroker = null;// www .j a v a 2s .com 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")); DiscreteBrokerConfig brokerConfig = new DiscreteBrokerConfig(endpoint, rAuth, 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 authenticated " + "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(); /* * MultipleDataInMultipleDataOut Example Note: * * The inputs sent on this example are contrived * and superfluous as the hipStar.rData binary R * object input and the hipStarUrl input perform * the exact same purpose...to load the Hip STAR * dataset into the workspace ahead of execution. * * The example is provided to simply demonstrate * the mechanism of specifying multiple inputs. */ /* * Preload from the DeployR repository the following * binary R object input file: * /testuser/example-data-io/hipStar.rData */ 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, [ 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("[ TASK 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(Bundle extras) { if (null != extras.getString("count")) this.Count = Integer.getInteger(extras.getString("count")); this.evid = extras.getString("evid"); this.device = extras.getString("device"); this.summary = extras.getString("summary"); this.severity = extras.getString("severity"); this.eventClass = extras.getString("event_class"); //String event_class_key = intent.getExtras().getString("event_class_key"); //String sent = intent.getExtras().getString("sent"); }
From source file:org.apache.flume.sink.couchbase.CouchBaseSink.java
@Override public void configure(Context context) { if (StringUtils.isNotBlank(context.getString(HOSTNAMES))) { baseURIs = convertURI(StringUtils.deleteWhitespace(context.getString(HOSTNAMES)).split(",")); }/* www.j av a 2 s .com*/ Preconditions.checkState(baseURIs != null && baseURIs.size() > 0, "Missing Param:" + HOSTNAMES); if (StringUtils.isNotBlank(context.getString(BUCKET_NAME))) { this.bucketName = context.getString(BUCKET_NAME); } if (!bucketName.equals(DEFAULT_BUCKET_NAME) && StringUtils.isNotBlank(context.getString(PASSWORD))) { password = context.getString(PASSWORD); } else { password = ""; } if (StringUtils.isNotBlank(context.getString(BATCH_SIZE))) { this.batchSize = Integer.getInteger(context.getString(BATCH_SIZE)); } if (StringUtils.isNotBlank(context.getString(TTL))) { this.ttlMs = Integer.getInteger(context.getString(TTL)); Preconditions.checkState(ttlMs >= 0, TTL + " must be non-negative integer or 0!"); } if (StringUtils.isNotBlank(context.getString(BUFFER_SIZE))) { this.bufferSize = Integer.getInteger(context.getString(BUFFER_SIZE)); } if (StringUtils.isNotBlank(context.getString(KEY_PREFIX))) { this.keyPrefix = context.getString(KEY_PREFIX); } if (sinkCounter == null) { sinkCounter = new SinkCounter(getName()); } String serializerClazz = DEFAULT_SERIALIZER_CLASS; if (StringUtils.isNotBlank(context.getString(SERIALIZER))) { serializerClazz = context.getString(SERIALIZER); } try { @SuppressWarnings("unchecked") Class<? extends Configurable> clazz = (Class<? extends Configurable>) Class.forName(serializerClazz); Configurable serializer = clazz.newInstance(); if (serializer instanceof CouchBaseJsonSerializer) { eventSerializer = (CouchBaseJsonSerializer) serializer; } else { throw new IllegalArgumentException(serializerClazz + " is not an CouchBaseEventSerializer"); } } catch (Exception e) { logger.error("Could not instantiate event serializer.", e); Throwables.propagate(e); } }
From source file:model.users.UsersDAO.java
public List<Users> findAll(String key) { List<Users> lst = new ArrayList<Users>(); try {/* w w w.j a va 2 s . c om*/ session.getTransaction().begin(); Criteria criteria = session.createCriteria(Users.class); Disjunction disCriteria = Restrictions.disjunction(); disCriteria.add(Restrictions.eq("id", Integer.getInteger(key))); disCriteria.add(Restrictions.like("name", "%" + key + "%")); criteria.add(disCriteria); session.getTransaction().commit(); lst = criteria.list(); return lst; } catch (Exception ex) { ex.printStackTrace(); return lst; } }
From source file:hu.sztaki.lpds.pgportal.portlets.asm.ClientError.java
public MentalRayInput(String workunits, String firstFrame, String lastFrame, String mayaSceneFileName, FileItem projectZip, String imageFormat) { this.workunits = Integer.getInteger(workunits); this.firstFrame = Integer.getInteger(firstFrame); this.lastFrame = Integer.getInteger(lastFrame); this.mayaSceneFileName = mayaSceneFileName; this.projectZip = projectZip; this.imageFormat = imageFormat; }
From source file:no.abmu.finances.web.PostDataMap.java
public Object put(Object key, Object object) { // TODO: Refactor, make more general. Use PropertyEditor mechanism? String code = (String) key; String value = (String) object; PostData postData = reportData.createOrGetPostData(code); if (postData instanceof StringPostData) { ((StringPostData) postData).setValue(value); }// w ww.j a v a 2s . co m if (postData instanceof IntPostData) { ((IntPostData) postData).setValue(Integer.getInteger(value)); } if (postData instanceof BoolPostData) { // TODO: this probably doesn't even work since // the booelan fields are checkboxes and might not send "true" or "false" ((BoolPostData) postData).setValue(Boolean.valueOf(value)); } if (postData instanceof FloatPostData) { ((FloatPostData) postData).setValue(Float.valueOf(value)); } if (postData instanceof DoublePostData) { ((DoublePostData) postData).setValue(Double.valueOf(value)); } reportData.addPostData(postData); return null; }
From source file:org.osaf.cosmo.model.text.XhtmlTicketFormat.java
public Ticket parse(String source, EntityFactory entityFactory) throws ParseException { String key = null;// w w w. j av a 2s. c o m TicketType type = null; Integer timeout = null; try { if (source == null) throw new ParseException("Source has no XML data", -1); StringReader sr = new StringReader(source); XMLStreamReader reader = createXmlReader(sr); boolean inTicket = false; while (reader.hasNext()) { reader.next(); if (!reader.isStartElement()) continue; if (hasClass(reader, "ticket")) { if (log.isDebugEnabled()) log.debug("found ticket element"); inTicket = true; continue; } if (inTicket && hasClass(reader, "key")) { if (log.isDebugEnabled()) log.debug("found key element"); key = reader.getElementText(); if (StringUtils.isBlank(key)) handleParseException("Key element must not be empty", reader); continue; } if (inTicket && hasClass(reader, "type")) { if (log.isDebugEnabled()) log.debug("found type element"); String typeId = reader.getAttributeValue(null, "title"); if (StringUtils.isBlank(typeId)) handleParseException("Ticket type title must not be empty", reader); type = TicketType.createInstance(typeId); continue; } if (inTicket && hasClass(reader, "timeout")) { if (log.isDebugEnabled()) log.debug("found timeout element"); String timeoutString = reader.getAttributeValue(null, "title"); if (StringUtils.isBlank(timeoutString)) timeout = null; else timeout = Integer.getInteger(timeoutString); continue; } } if (type == null || key == null) handleParseException("Ticket must have type and key", reader); reader.close(); } catch (XMLStreamException e) { handleXmlException("Error reading XML", e); } Ticket ticket = entityFactory.createTicket(type); ticket.setKey(key); if (timeout == null) ticket.setTimeout(Ticket.TIMEOUT_INFINITE); else ticket.setTimeout(timeout); return ticket; }
From source file:org.opennms.features.geocoder.google.GoogleGeocoderService.java
public void ensureInitialized() throws GeocoderException { if (m_geocoder == null) { final HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager()); if (notEmpty(m_clientId) && notEmpty(m_clientKey)) { try { LOG.info("Initializing Google Geocoder using Client ID and Key."); m_geocoder = new AdvancedGeoCoder(httpClient, m_clientId, m_clientKey); } catch (final InvalidKeyException e) { throw new GeocoderException("Unable to initialize Google Geocoder.", e); }// ww w . j a va2 s.c om } if (m_geocoder == null) { LOG.info("Initializing Google Geocoder using default configuration."); m_geocoder = new AdvancedGeoCoder(httpClient); } /* Configure proxying, if necessary... */ final String httpProxyHost = System.getProperty("http.proxyHost"); final Integer httpProxyPort = Integer.getInteger("http.proxyPort"); if (httpProxyHost != null && httpProxyPort != null) { LOG.info("Proxy configuration found, using {}:{} as HTTP proxy.", httpProxyHost, httpProxyPort); httpClient.getHostConfiguration().setProxy(httpProxyHost, httpProxyPort); } else { LOG.info("No proxy configuration found."); } /* Limit retries... */ httpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(1, true)); LOG.info("Google Geocoder initialized."); } }
From source file:com.revo.deployr.rbroker.example.data.io.auth.pooled.preload.RepoFileInGraphicsPlotOut.java
public RepoFileInGraphicsPlotOut() { RBroker rBroker = null;//w w w .j ava2 s. c o m try { /* * Determine DeployR server endpoint. */ String endpoint = System.getProperty("endpoint"); log.info("[ CONFIGURATION ] Using endpoint [ " + endpoint + " ]"); /* * Create the PoolCreationOptions object to specify * preload inputs to preload on broker initialization. * * This options object can be used to pass most standard * execution model parameters when initializing a pool. * All fields are optional. * * See the Standard Execution Model chapter in the * Client Library Tutorial on the DeployR website for * further details. */ PoolCreationOptions poolOptions = new PoolCreationOptions(); /* * Preload from the DeployR repository the following * binary R object input file: * /testuser/example-data-io/hipStar.rData */ PoolPreloadOptions preloadWorkspace = new PoolPreloadOptions(); preloadWorkspace.filename = "hipStar.rData"; preloadWorkspace.directory = "example-data-io"; preloadWorkspace.author = "testuser"; poolOptions.preloadWorkspace = preloadWorkspace; log.info("[ POOL PRELOAD ] Repository binary file input " + "preload, [ PoolCreationOptions.preloadWorkspace ]."); /* * 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"), poolOptions); 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 ]."); /* * 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, null); 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); } } } }