List of usage examples for java.lang System getProperty
public static String getProperty(String key)
From source file:PassEnv.java
public static void main(String[] args) throws java.io.IOException { System.out.println(System.getProperty("java.class.path")); ProcessBuilder pb = new ProcessBuilder("java", "Env", "DRAGONBALLS"); Map<String, String> env = pb.environment(); env.put("DRAGONBALLS", "7"); pb.start();//w w w . j av a 2 s .c o m }
From source file:com.revo.deployr.client.example.data.io.auth.stateful.exec.ExternalDataInDataFileOut.java
public static void main(String args[]) throws Exception { RClient rClient = null;//from w w w . jav a2 s.c o m RProject rProject = null; try { /* * Determine DeployR server endpoint. */ String endpoint = System.getProperty("endpoint"); log.info("[ CONFIGURATION ] Using endpoint=" + endpoint); /* * Establish RClient connection to DeployR server. * * An RClient connection is the mandatory starting * point for any application using the client library. */ rClient = RClientFactory.createClient(endpoint); log.info("[ CONNECTION ] Established anonymous " + "connection [ RClient ]."); /* * Build a basic authentication token. */ RAuthentication rAuth = new RBasicAuthentication(System.getProperty("username"), System.getProperty("password")); /* * Establish an authenticated handle with the DeployR * server, rUser. Following this call the rClient * connection is operating as an authenticated connection * and all calls on rClient inherit the access permissions * of the authenticated user, rUser. */ RUser rUser = rClient.login(rAuth); log.info("[ AUTHENTICATION ] Upgraded to authenticated " + "connection [ RUser ]."); /* * Create a temporary project (R session). * * Optionally: * ProjectCreationOptions options = * new ProjectCreationOptions(); * * Populate options as needed, then: * * rProject = rUser.createProject(options); */ rProject = rUser.createProject(); log.info("[ GO STATEFUL ] Created stateful temporary " + "R session [ RProject ]."); /* * Create a ProjectExecutionOptions instance * to specify data inputs and output to the * execution of the repository-managed R script. * * 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. */ ProjectExecutionOptions options = new ProjectExecutionOptions(); /* * Load an R object literal "hipStarUrl" into the * workspace prior to script 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 execution, [ ProjectExecutionOptions.rinputs ]."); /* * Execute a public analytics Web service as an authenticated * user based on a repository-managed R script: * /testuser/example-data-io/dataIO.R */ RProjectExecution exec = rProject.executeScript("dataIO.R", "example-data-io", "testuser", null, options); log.info("[ EXECUTION ] Stateful R script " + "execution completed [ RProjectExecution ]."); /* * Retrieve the working directory file (artifact) called * hip.csv that was generated by the execution. * * Outputs generated by an execution can be used in any * number of ways by client applications, including: * * 1. Use output data to perform further calculations. * 2. Display output data to an end-user. * 3. Write output data to a database. * 4. Pass output data along to another Web service. * 5. etc. */ List<RProjectFile> wdFiles = exec.about().artifacts; for (RProjectFile wdFile : wdFiles) { if (wdFile.about().filename.equals("hip.csv")) { log.info("[ DATA OUTPUT ] Retrieved working directory " + "file output " + wdFile.about().filename + " [ RProjectFile ]."); InputStream fis = null; try { fis = wdFile.download(); } catch (Exception ex) { log.warn("Working directory data file download " + ex); } finally { IOUtils.closeQuietly(fis); } } } } catch (Exception ex) { log.warn("Unexpected runtime exception=" + ex); } finally { try { if (rProject != null) { /* * Close rProject before application exits. */ rProject.close(); } } catch (Exception fex) { } try { if (rClient != null) { /* * Release rClient connection before application exits. */ rClient.release(); } } catch (Exception fex) { } } }
From source file:at.co.malli.relpm.RelPM.java
/** * @param args the command line arguments */// w ww . ja v a2 s .c o m public static void main(String[] args) { //<editor-fold defaultstate="collapsed" desc=" Create config & log directory "> String userHome = System.getProperty("user.home"); File relPm = new File(userHome + "/.RelPM"); if (!relPm.exists()) { boolean worked = relPm.mkdir(); if (!worked) { ExceptionDisplayer.showErrorMessage(new Exception("Could not create directory " + relPm.getAbsolutePath() + " to store user-settings and logs")); System.exit(-1); } } File userConfig = new File(relPm.getAbsolutePath() + "/RelPM-userconfig.xml"); //should be created... if (!userConfig.exists()) { try { URL resource = RelPM.class.getResource("/at/co/malli/relpm/RelPM-defaults.xml"); FileUtils.copyURLToFile(resource, userConfig); } catch (IOException ex) { ExceptionDisplayer.showErrorMessage(new Exception("Could not copy default config. Reason:\n" + ex.getClass().getName() + ": " + ex.getMessage())); System.exit(-1); } } if (!userConfig.canWrite() || !userConfig.canRead()) { ExceptionDisplayer.showErrorMessage(new Exception( "Can not read or write " + userConfig.getAbsolutePath() + "to store user-settings")); System.exit(-1); } if (System.getProperty("os.name").toLowerCase().contains("win")) { Path relPmPath = Paths.get(relPm.toURI()); try { Files.setAttribute(relPmPath, "dos:hidden", true); } catch (IOException ex) { ExceptionDisplayer.showErrorMessage(new Exception("Could not set " + relPm.getAbsolutePath() + " hidden. " + "Reason:\n" + ex.getClass().getName() + ": " + ex.getMessage())); System.exit(-1); } } //</editor-fold> logger.trace("Environment setup sucessfull"); //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code "> try { String wantedLookAndFeel = SettingsProvider.getInstance().getString("gui.lookAndFeel"); UIManager.LookAndFeelInfo[] installed = UIManager.getInstalledLookAndFeels(); boolean found = false; for (UIManager.LookAndFeelInfo info : installed) { if (info.getClassName().equals(wantedLookAndFeel)) found = true; } if (found) UIManager.setLookAndFeel(wantedLookAndFeel); else UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (InstantiationException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (IllegalAccessException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } //</editor-fold> //<editor-fold defaultstate="collapsed" desc=" Add GUI start to awt EventQue "> java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainGUI().setVisible(true); } }); //</editor-fold> }
From source file:com.revo.deployr.client.example.data.io.auth.stateful.exec.LocalDataInEncodedDataOut.java
public static void main(String args[]) throws Exception { RClient rClient = null;//from w w w . j a v a 2s . c o m RProject rProject = null; try { /* * Determine DeployR server endpoint. */ String endpoint = System.getProperty("endpoint"); log.info("[ CONFIGURATION ] Using endpoint=" + endpoint); /* * Establish RClient connection to DeployR server. * * An RClient connection is the mandatory starting * point for any application using the client library. */ rClient = RClientFactory.createClient(endpoint); log.info("[ CONNECTION ] Established anonymous " + "connection [ RClient ]."); /* * Build a basic authentication token. */ RAuthentication rAuth = new RBasicAuthentication(System.getProperty("username"), System.getProperty("password")); /* * Establish an authenticated handle with the DeployR * server, rUser. Following this call the rClient * connection is operating as an authenticated connection * and all calls on rClient inherit the access permissions * of the authenticated user, rUser. */ RUser rUser = rClient.login(rAuth); log.info("[ AUTHENTICATION ] Upgraded to authenticated " + "connection [ RUser ]."); /* * Create a temporary project (R session). * * Optionally: * ProjectCreationOptions options = * new ProjectCreationOptions(); * * Populate options as needed, then: * * rProject = rUser.createProject(options); */ rProject = rUser.createProject(); log.info("[ GO STATEFUL ] Created stateful temporary " + "R session [ RProject ]."); /* * Upload a data file from local disk to the working * directory of your temporary project (R session.) */ File upFile = new File("analytics/hipStar.dat"); InputStream is = new FileInputStream(upFile); DirectoryUploadOptions upOpts = new DirectoryUploadOptions(); upOpts.filename = "hipStar.dat"; upOpts.overwrite = true; RProjectFile projFile = rProject.uploadFile(is, upOpts); log.info("[ DATA UPLOAD ] Uploaded data file input " + "to working directory, [ RProjectFile ]."); /* * Create a ProjectExecutionOptions instance * to specify data inputs and output to the * execution of the repository-managed R script. * * 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. */ ProjectExecutionOptions options = new ProjectExecutionOptions(); /* * Request the retrieval of the "hip" data.frame and * two vector objects from the workspace following the * execution. The corresponding R objects are named as * follows: * 'hip', hipDim', 'hipNames'. */ options.routputs = Arrays.asList("hip", "hipDim", "hipNames"); log.info("[ EXEC OPTION ] DeployR-encoded R object request " + "set on execution [ ProjectExecutionOptions.routputs ]."); /* * Execute a public analytics Web service as an authenticated * user based on a repository-managed R script: * /testuser/example-data-io/dataIO.R */ RProjectExecution exec = rProject.executeScript("dataIO.R", "example-data-io", "testuser", null, options); log.info("[ EXECUTION ] Stateful R script " + "execution completed [ RProjectExecution ]."); /* * Retrieve the requested R object data encodings from * the results of the script execution. * * See the R Object Data Decoding chapter in the * Client Library Tutorial on the DeployR website for * further details. */ List<RData> objects = exec.about().workspaceObjects; for (RData rData : objects) { if (rData instanceof RDataFrame) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RDataFrame ]."); List<RData> hipSubsetVal = ((RDataFrame) rData).getValue(); } else if (rData instanceof RNumericVector) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RNumericVector ]."); List<Double> hipDimVal = ((RNumericVector) rData).getValue(); log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object " + rData.getName() + " value=" + hipDimVal); } else if (rData instanceof RStringVector) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RStringVector ]."); List<String> hipNamesVal = ((RStringVector) rData).getValue(); log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object " + rData.getName() + " value=" + hipNamesVal); } else { log.info("Unexpected DeployR-encoded R object returned, " + "object name=" + rData.getName() + ", encoding=" + rData.getClass()); } } } catch (Exception ex) { log.warn("Unexpected runtime exception=" + ex); } finally { try { if (rProject != null) { /* * Close rProject before application exits. */ rProject.close(); } } catch (Exception fex) { } try { if (rClient != null) { /* * Release rClient connection before application exits. */ rClient.release(); } } catch (Exception fex) { } } }
From source file:au.edu.uws.eresearch.cr8it.Main.java
/** * Load the Spring Integration Application Context * * @param args - command line arguments//from ww w. j ava2 s .co m */ public static void main(final String... args) { String contextFilePath = "spring-integration-context.xml"; String configFilePath = "config/config-file.groovy"; String environment = System.getProperty("environment"); if (LOGGER.isInfoEnabled()) { LOGGER.info("\n=========================================================" + "\n " + "\n Welcome to C8it Integration! " + "\n " + "\n For more information please visit: " + "\n http://www.springsource.org/spring-integration " + "\n " + "\n========================================================="); } ConfigObject config = Config.getConfig(environment, configFilePath); Map configMap = config.flatten(); System.setProperty("environment", environment); System.setProperty("cr8it.client.config.file", (String) configMap.get("file.runtimePath")); //final AbstractApplicationContext context = //new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); String absContextPath = "config/integration/" + contextFilePath; File contextFile = new File(absContextPath); final AbstractApplicationContext context; if (!contextFile.exists()) { absContextPath = "classpath:" + absContextPath; context = new ClassPathXmlApplicationContext(absContextPath); } else { absContextPath = "file:" + absContextPath; context = new FileSystemXmlApplicationContext(absContextPath); } context.registerShutdownHook(); SpringIntegrationUtils.displayDirectories(context); final Scanner scanner = new Scanner(System.in); if (LOGGER.isInfoEnabled()) { LOGGER.info("\n=========================================================" + "\n " + "\n Please press 'q + Enter' to quit the application. " + "\n " + "\n========================================================="); } while (!scanner.hasNext("q")) { //Do nothing unless user presses 'q' to quit. } if (LOGGER.isInfoEnabled()) { LOGGER.info("Exiting application...bye."); } System.exit(0); }
From source file:com.fusesource.examples.activemq.SimpleSubscriber.java
public static void main(String args[]) { Connection connection = null; try {// w w w .ja v a 2 s .c om // JNDI lookup of JMS Connection Factory and JMS Destination Context context = new InitialContext(); ConnectionFactory factory = (ConnectionFactory) context.lookup(CONNECTION_FACTORY_NAME); connection = factory.createConnection(); connection.setClientID("ApplicationA"); connection.start(); Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE); String topicName = System.getProperty("topic"); Topic topic = session.createTopic(topicName); MessageConsumer consumer = session.createConsumer(topic); LOG.info("Start consuming messages from " + topicName + " with " + MESSAGE_TIMEOUT_MILLISECONDS + "ms timeout"); // Synchronous message consumer int i = 1; while (true) { Message message = consumer.receive(MESSAGE_TIMEOUT_MILLISECONDS); if (message != null) { if (message instanceof TextMessage) { String text = ((TextMessage) message).getText(); LOG.info("Got " + (i++) + ". message: " + text); } } else { break; } } consumer.close(); session.close(); } catch (Throwable t) { LOG.error(t); } finally { // Cleanup code // In general, you should always close producers, consumers, // sessions, and connections in reverse order of creation. // For this simple example, a JMS connection.close will // clean up all other resources. if (connection != null) { try { connection.close(); } catch (JMSException e) { LOG.error(e); } } } }
From source file:com.wso2.rfid.Main.java
public static void main(String[] args) throws IOException { Properties configs = new Properties(); configs.load(/* w ww.j a va 2s. co m*/ new FileInputStream(System.getProperty("rpi.agent.home") + File.separator + "config.properties")); Server server = new Server(InetSocketAddress.createUnresolved("127.0.0.1", 8084)); ServletHandler handler = new ServletHandler(); server.setHandler(handler); handler.addServletWithMapping(RFIDReaderServlet.class, "/rfid"); String controlCenterURL = configs.getProperty("control.center.url"); System.out.println("Using RPi Control Center: " + controlCenterURL); String tokenEndpoint = configs.getProperty("token.endpoint"); System.out.println("Using token endpoint: " + tokenEndpoint); APICall.setTokenEndpoint(tokenEndpoint); String primaryNwInterface = configs.getProperty("primary.nw.interface"); String userRegEndpoint = configs.getProperty("user.registration.endpoint"); System.out.println("Using user registration endpoint: " + userRegEndpoint); APICall.setUserRegistrationEndpoint(userRegEndpoint); scheduler.scheduleWithFixedDelay(new MonitoringTask(controlCenterURL, primaryNwInterface), 0, 10, TimeUnit.SECONDS); try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } }
From source file:csv.parser.CSVParser.java
@SuppressWarnings("resource") public static void main(String[] args) throws Exception { String file_to_parse;/*from ww w . j a v a 2s.co m*/ String[] val_array; file_to_parse = "./input/E-library-data-3.csv"; //Build reader instance //Read CSV file CSVReader reader = new CSVReader(new FileReader(file_to_parse), ';', '"', 1); //Read all rows at once List<String[]> allRows = reader.readAll(); // Read CSV line by line and use the string array as you want for (String[] row : allRows) { for (int i = 0; i < row.length; i++) { //Removing all newlines, tabs and '&' characters(invalid XML character) row[i] = row[i].replaceAll("(\\r|\\n|\\r\\n)+", " "); row[i] = row[i].replaceAll(System.getProperty("line.separator"), "; "); row[i] = row[i].replaceAll("&", "and"); } System.out.println(Arrays.toString(row)); } //Get the input fields List<String[]> map = getMap(); String[] field; //Numbering for folders, folderNum is incremented for each new file long folderNum; folderNum = 0; for (String[] row : allRows) { //Creating new folder File file1 = new File("./output//newdir//folder" + folderNum + ""); file1.mkdirs(); //Creating content file PrintWriter writer_content = new PrintWriter("./output//newdir//folder" + folderNum + "//contents", "UTF-16"); //Creating metadata_lrmi.xml PrintWriter writer_lrmi = new PrintWriter( "./output//newdir//folder" + folderNum + "//metadata_lrmi.xml", "UTF-16"); //Creating content.xml PrintWriter writer = new PrintWriter("./output//newdir//folder" + folderNum + "//content.xml", "UTF-16"); writer.println("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"no\"?>"); writer.println("<dublin_core schema=\"dc\">"); writer_lrmi.println("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"no\"?>"); writer_lrmi.println("<dublin_core shema=\"lrmi\">"); for (int i = 0; i < row.length; i++) { //After snooping data, we have to change these setting for each new csv file, as the data fileds are many times mismatched //These if-else statements take care of mismatched steps. if (i == 43) { continue; } else if (i == 43) { field = map.get(42); } else if (i == 44) { field = map.get(43); } else if (i == 45 || i == 46) { continue; } else { field = map.get(i); } //Separate multiple values val_array = parseVal(row[i]); // if (val_array.length == 0) { // continue; // } PrintWriter useWriter = writer; if (field[0].equals("lrmi")) { useWriter = writer_lrmi; } switch (field.length) { case 2: writeXML(useWriter, field[1], "", val_array); break; case 3: writeXML(useWriter, field[1], field[2], val_array); break; default: } } folderNum++; writer.println("</dublin_core>"); writer_lrmi.println("</dublin_core>"); writer.close(); writer_lrmi.close(); writer_content.close(); } }
From source file:com.revo.deployr.client.example.data.io.auth.discrete.exec.MultipleDataInMultipleDataOut.java
public static void main(String args[]) throws Exception { RClient rClient = null;/* w w w. ja v a 2 s . c om*/ try { /* * Determine DeployR server endpoint. */ String endpoint = System.getProperty("endpoint"); log.info("[ CONFIGURATION ] Using endpoint=" + endpoint); /* * Establish RClient connection to DeployR server. * * An RClient connection is the mandatory starting * point for any application using the client library. */ rClient = RClientFactory.createClient(endpoint); log.info("[ CONNECTION ] Established anonymous " + "connection [ RClient ]."); /* * Build a basic authentication token. */ RAuthentication rAuth = new RBasicAuthentication(System.getProperty("username"), System.getProperty("password")); /* * Establish an authenticated handle with the DeployR * server, rUser. Following this call the rClient * connection is operating as an authenticated connection * and all calls on rClient inherit the access permissions * of the authenticated user, rUser. */ RUser rUser = rClient.login(rAuth); log.info("[ AUTHENTICATION ] Upgraded to authenticated " + "connection [ RUser ]."); /* * Create the AnonymousProjectExecutionOptions object * to specify data inputs and output to the script. * * 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. */ AnonymousProjectExecutionOptions options = new AnonymousProjectExecutionOptions(); /* * 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 */ ProjectPreloadOptions preloadWorkspace = new ProjectPreloadOptions(); 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 execution, [ ProjectExecutionOptions.preloadWorkspace ]."); /* * Load an R object literal "hipStarUrl" into the * workspace prior to script 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 execution, [ ProjectPreloadOptions.rinputs ]."); /* * Request the retrieval of the "hip" data.frame and * two vector objects from the workspace following the * execution. The corresponding R objects are named as * follows: * 'hip', hipDim', 'hipNames'. */ options.routputs = Arrays.asList("hip", "hipDim", "hipNames"); log.info("[ EXEC OPTION ] DeployR-encoded R object request " + "set on execution [ ProjectExecutionOptions.routputs ]."); /* * Execute an analytics Web service as an authenticated * user based on a repository-managed R script: * /testuser/example-data-io/dataIO.R */ RScriptExecution exec = rClient.executeScript("dataIO.R", "example-data-io", "testuser", null, options); log.info("[ EXECUTION ] Discrete R script " + "execution completed [ RScriptExecution ]."); /* * Retrieve multiple outputs following the execution: * * 1. R console output. * 2. R console output. * 3. R console output. * 4. R console output. * 5. R console output. */ String console = exec.about().console; log.info("[ DATA OUTPUT ] Retrieved R console " + "output [ String ]."); /* * Retrieve the requested R object data encodings from * the workspace follwing the script execution. * * See the R Object Data Decoding chapter in the * Client Library Tutorial on the DeployR website for * further details. */ List<RData> objects = exec.about().workspaceObjects; for (RData rData : objects) { if (rData instanceof RDataFrame) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RDataFrame ]."); List<RData> hipSubsetVal = ((RDataFrame) rData).getValue(); } else if (rData instanceof RNumericVector) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RNumericVector ]."); List<Double> hipDimVal = ((RNumericVector) rData).getValue(); log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object " + rData.getName() + " value=" + hipDimVal); } else if (rData instanceof RStringVector) { log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object output " + rData.getName() + " [ RStringVector ]."); List<String> hipNamesVal = ((RStringVector) rData).getValue(); log.info("[ DATA OUTPUT ] Retrieved DeployR-encoded R " + "object " + rData.getName() + " value=" + hipNamesVal); } else { log.info("Unexpected DeployR-encoded R object returned, " + "object name=" + rData.getName() + ", encoding=" + rData.getClass()); } } /* * Retrieve the working directory files (artifact) * was generated by the execution. */ List<RProjectFile> wdFiles = exec.about().artifacts; for (RProjectFile wdFile : wdFiles) { log.info("[ DATA OUTPUT ] Retrieved working directory " + "file output " + wdFile.about().filename + " [ RProjectFile ]."); InputStream fis = null; try { fis = wdFile.download(); } catch (Exception ex) { log.warn("Working directory binary file " + ex); } finally { IOUtils.closeQuietly(fis); } } /* * Retrieve R graphics device plots (results) called * unnamedplot*.png that was generated by the execution. */ List<RProjectResult> results = exec.about().results; for (RProjectResult result : results) { log.info("[ DATA OUTPUT ] Retrieved graphics device " + "plot output " + result.about().filename + " [ RProjectResult ]."); InputStream fis = null; try { fis = result.download(); } catch (Exception ex) { log.warn("Graphics device plot " + ex); } finally { IOUtils.closeQuietly(fis); } } } catch (Exception ex) { log.warn("Unexpected runtime exception=" + ex); } finally { try { if (rClient != null) { /* * Release rClient connection before application exits. */ rClient.release(); } } catch (Exception fex) { } } }
From source file:org.hbird.business.core.Starter.java
/** * The main method/*ww w . j a v a2 s . c o m*/ * * @param args Arguments are NOT used * @throws Exception */ public static void main(String[] args) throws Exception { /* Configure log4j to allow dynamic changes to the log4j file. */ String log4jFile = System.getProperty("log4j.configuration"); if (log4jFile != null) { org.apache.log4j.PropertyConfigurator.configureAndWatch(log4jFile, 5000); } Starter starter = new Starter(); starter.boot(); }