[Remoterengine-commits] r178 - in pkg: RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client RemoteREngine.examples/inst/examples/console/src RemoteREngine.examples/inst/examples/helloworld/src RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/client RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/common
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 22 13:47:59 CEST 2009
Author: ian_long
Date: 2009-09-22 13:47:58 +0200 (Tue, 22 Sep 2009)
New Revision: 178
Added:
pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/EngineNotAvailableException.java
Modified:
pkg/RemoteREngine.examples/inst/examples/console/src/RemoteRConsole.java
pkg/RemoteREngine.examples/inst/examples/helloworld/src/RemoteHelloWorld.java
pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/client/TestFactors.java
pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/common/RemoteREngineTestBase.java
pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
Log:
Added EngineNotAvailableException which is thrown by the RemoteREngine if it is unable to connect to a Remote R server during startup
Added: pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/EngineNotAvailableException.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/EngineNotAvailableException.java (rev 0)
+++ pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/EngineNotAvailableException.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -0,0 +1,30 @@
+package org.rosuda.REngine.remote.client;
+/**
+ * Exception thrown if the client is unable to connect through to a
+ * remote engine.
+ * @author $Author$
+ * @version $Rev$ as of $Date$
+ * <p>URL : $HeadURL$
+ */
+/*
+ * Copyright Stoat Software & Services 2009 <ilong at stoatsoftware.com>
+ */
+public class EngineNotAvailableException extends Exception {
+
+ /**
+ * Construct exception without a cause
+ * @param message Message about this exception
+ */
+ public EngineNotAvailableException(String message) {
+ this(message,null);
+ }
+
+ /**
+ * Construct exception with the provided cause
+ * @param message Message about this exception
+ * @param cause The lower level exception that triggered this exception
+ */
+ public EngineNotAvailableException(String message, Throwable cause) {
+ super(message,cause);
+ }
+}
Property changes on: pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/EngineNotAvailableException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author HeadURL Id
Modified: pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-22 10:57:47 UTC (rev 177)
+++ pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -113,8 +113,9 @@
* @param registryHost Name or IP Address of the host containing the RMI registry
* @param name Name of the Remote server registered within the Registry
* @param port port to use to connect to the server
+ * @throws EngineNotAvailableException Failed to connect to remote R engine
*/
- public RemoteREngine(String name, String registryHost, int port){
+ public RemoteREngine(String name, String registryHost, int port) throws EngineNotAvailableException {
if (name == null || name.length()==0) {
System.err.println("RMI Name of remote engine not defined");
}
@@ -142,10 +143,10 @@
valid = testConnection();
} catch ( NotBoundException nb) {
- System.out.println("Unable to locate " + name + " within RMI Registry");
+ throw new EngineNotAvailableException("Unable to locate " + name + " within RMI Registry on " +
+ registryHost,nb);
} catch( Exception e ){
- System.out.println( e.getClass().getName() + " creating the RemoteREngine" ) ;
- e.printStackTrace();
+ throw new EngineNotAvailableException("Unable to create RemoteREngine",e);
}
shutdownHook = new RemoteREngineShutdownHook();
@@ -187,8 +188,9 @@
* @see RemoteREngineConstants#RMIPORT for the default value
* @param name name of the remote object in the registry
* @param registryHost host name
+ * @throws EngineNotAvailableException Failed to connect to remote R engine
*/
- public RemoteREngine(String name, String registryHost ){
+ public RemoteREngine(String name, String registryHost ) throws EngineNotAvailableException {
this( name, registryHost, RemoteREngineConstants.RMIPORT ) ;
}
Modified: pkg/RemoteREngine.examples/inst/examples/console/src/RemoteRConsole.java
===================================================================
--- pkg/RemoteREngine.examples/inst/examples/console/src/RemoteRConsole.java 2009-09-22 10:57:47 UTC (rev 177)
+++ pkg/RemoteREngine.examples/inst/examples/console/src/RemoteRConsole.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -15,6 +15,7 @@
ConsoleThread console = new ConsoleThread( r ) ;
console.start( ) ;
} catch( Exception e){
+ System.err.println(e.getClass().getName() + ": " + e.getMessage());
e.printStackTrace();
}
}
Modified: pkg/RemoteREngine.examples/inst/examples/helloworld/src/RemoteHelloWorld.java
===================================================================
--- pkg/RemoteREngine.examples/inst/examples/helloworld/src/RemoteHelloWorld.java 2009-09-22 10:57:47 UTC (rev 177)
+++ pkg/RemoteREngine.examples/inst/examples/helloworld/src/RemoteHelloWorld.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -40,6 +40,7 @@
System.exit( 0 );
} catch( Exception e){
+ System.err.println(e.getClass().getName() + ": " + e.getMessage());
e.printStackTrace();
}
}
Modified: pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/client/TestFactors.java
===================================================================
--- pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/client/TestFactors.java 2009-09-22 10:57:47 UTC (rev 177)
+++ pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/client/TestFactors.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -32,6 +32,10 @@
*/
public class TestFactors extends RemoteREngineTestBase {
+ public TestFactors() throws Exception {
+ super();
+ }
+
@Test
public void testFactors() throws Exception {
System.out.println("* Test support of factors");
Modified: pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/common/RemoteREngineTestBase.java
===================================================================
--- pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/common/RemoteREngineTestBase.java 2009-09-22 10:57:47 UTC (rev 177)
+++ pkg/RemoteREngine.test/inst/java_src/src/org/rosuda/REngine/remote/common/RemoteREngineTestBase.java 2009-09-22 11:47:58 UTC (rev 178)
@@ -3,6 +3,7 @@
import java.util.Enumeration;
import java.util.Properties;
+import org.rosuda.REngine.remote.client.EngineNotAvailableException;
import org.rosuda.REngine.remote.client.RemoteREngine;
import org.testng.annotations.BeforeSuite;
@@ -28,23 +29,27 @@
* @version $Rev: 129 $ as of $Date: 2009-09-15 12:18:19 +0200 (Tue, 15 Sep 2009) $
* <p>URL : $HeadURL: svn+ssh://romain@svn.r-forge.r-project.org/svnroot/remoterengine/pkg/RemoteREngine/inst/java_src/test/org/rosuda/REngine/remote/common/RemoteREngineTestBase.java $
*/
-public class RemoteREngineTestBase {
+public abstract class RemoteREngineTestBase {
/** Instance of the Remote R Engine available for tests */
- protected static RemoteREngine r = init();
+ protected static RemoteREngine r = null;
/**
+ * Call init() to connect to an instance of the RemoteREngine
+ * @throws EngineNotAvailableException
+ */
+ protected RemoteREngineTestBase() throws EngineNotAvailableException {
+ super();
+ init();
+ }
+
+ /**
* Create a connection to a running remote server
* @return Reference to a remote engine
+ * @throws EngineNotAvailableException Failed to connect to remote R engine
*/
@BeforeSuite
- protected static RemoteREngine init(){
-/* Properties props = System.getProperties();
- for (Enumeration<?> enumerator = props.keys(); enumerator.hasMoreElements(); ) {
- String key = (String)enumerator.nextElement();
- String value = props.getProperty(key);
- System.out.println(key + " : " + value);
- }
-*/
+ protected static RemoteREngine init() throws EngineNotAvailableException {
+
RemoteREngine r = null ;
String name = "RemoteREngineTest";
int registryPort = RemoteREngineConstants.RMIPORT;
More information about the Remoterengine-commits
mailing list