Author: jcouteau Date: 2009-12-10 15:39:28 +0100 (Thu, 10 Dec 2009) New Revision: 168 Added: trunk/nb-configuration.xml trunk/nbactions.xml Modified: trunk/src/main/java/org/nuiton/j2r/REngine.java trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java trunk/src/main/java/org/nuiton/j2r/RProxy.java Log: Add a method to load data without changing the working directory Added: trunk/nb-configuration.xml =================================================================== --- trunk/nb-configuration.xml (rev 0) +++ trunk/nb-configuration.xml 2009-12-10 14:39:28 UTC (rev 168) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-shared-configuration> + <!-- +This file contains additional configuration written by modules in the NetBeans IDE. +The configuration is intended to be shared among all the users of project and +therefore it is assumed to be part of version control checkout. +Without this configuration present, some functionality in the IDE may be limited or fail altogether. +--> + <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> + <!-- +Properties that influence various parts of the IDE, especially code formatting and the like. +You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. +That way multiple projects can share the same settings (useful for formatting rules for example). +Any value defined here will override the pom.xml file value but is only applicable to the current project. +--> + <netbeans.compile.on.save>all</netbeans.compile.on.save> + </properties> +</project-shared-configuration> Added: trunk/nbactions.xml =================================================================== --- trunk/nbactions.xml (rev 0) +++ trunk/nbactions.xml 2009-12-10 14:39:28 UTC (rev 168) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actions> + <action> + <actionName>run</actionName> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> + </goals> + <properties> + <exec.classpathScope>runtime</exec.classpathScope> + <exec.args>-Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args> + <exec.executable>java</exec.executable> + </properties> + </action> + <action> + <actionName>debug</actionName> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> + </goals> + <properties> + <exec.classpathScope>runtime</exec.classpathScope> + <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args> + <jpda.listen>true</jpda.listen> + <exec.executable>java</exec.executable> + </properties> + </action> + <action> + <actionName>profile</actionName> + <goals> + <goal>process-classes</goal> + <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> + </goals> + <properties> + <exec.args>${profiler.args} -Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args> + <profiler.action>profile</profiler.action> + <exec.executable>${profiler.java}</exec.executable> + </properties> + </action> + <action> + <actionName>build</actionName> + <goals> + <goal>install</goal> + </goals> + <properties> + <java.library.path>/usr/local/lib</java.library.path> + </properties> + </action> + <action> + <actionName>test</actionName> + <goals> + <goal>test</goal> + </goals> + <properties> + <java.library.path>/usr/local/lib</java.library.path> + </properties> + </action> + </actions> Modified: trunk/src/main/java/org/nuiton/j2r/REngine.java =================================================================== --- trunk/src/main/java/org/nuiton/j2r/REngine.java 2009-12-10 14:25:47 UTC (rev 167) +++ trunk/src/main/java/org/nuiton/j2r/REngine.java 2009-12-10 14:39:28 UTC (rev 168) @@ -81,6 +81,15 @@ void loadRData(File directory) throws RException; /** + * Load filename.RData file located in current working directory + * + * @param filename + * name of the .RData file (will be followed by .RData) + * @throws RException + */ + void loadRData(String filename) throws RException; + + /** * Save the session in a .RData file in directory * * @param directory Modified: trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java =================================================================== --- trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2009-12-10 14:25:47 UTC (rev 167) +++ trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2009-12-10 14:39:28 UTC (rev 168) @@ -63,6 +63,19 @@ } /** + * Load the "fileName.RData" file located in current working directory. + * + * @param fileName name of the file to load (will load the fileName.RData + * file) + * @throws org.nuiton.j2r.RException if an error occur while loading the R + * session file. + */ + @Override + public void loadRData(String fileName) throws RException { + voidEval(String.format(RInstructions.LOAD_RDATA_FILE, fileName)); + } + + /** * Save the session in a .RData file in directory * * @param directory Modified: trunk/src/main/java/org/nuiton/j2r/RProxy.java =================================================================== --- trunk/src/main/java/org/nuiton/j2r/RProxy.java 2009-12-10 14:25:47 UTC (rev 167) +++ trunk/src/main/java/org/nuiton/j2r/RProxy.java 2009-12-10 14:39:28 UTC (rev 168) @@ -625,5 +625,14 @@ } engine.saveRData(filename); } + + @Override + public void loadRData(String filename) throws RException { + if (engine == null) { + log.fatal("The R Proxy is not initialized. An error probably " + + "occured during the initialization."); + } + engine.loadRData(filename); + } } //RProxy