[Remoterengine-commits] r120 - in pkg/RemoteREngine: R inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks inst/java_src/src/server/org/rosuda/REngine/remote/server
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 8 15:57:28 CEST 2009
Author: romain
Date: 2009-09-08 15:57:27 +0200 (Tue, 08 Sep 2009)
New Revision: 120
Added:
pkg/RemoteREngine/R/callback.R
pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/ObjectCallback.java
pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/SignedCallback.java
Modified:
pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java
Log:
start to work on signed callbacks
Added: pkg/RemoteREngine/R/callback.R
===================================================================
--- pkg/RemoteREngine/R/callback.R (rev 0)
+++ pkg/RemoteREngine/R/callback.R 2009-09-08 13:57:27 UTC (rev 120)
@@ -0,0 +1,16 @@
+callback <- function( signature = "", object = NULL ){
+
+ if( !is.character( signature ) ){
+ stop( "'signature' should be a character vector" )
+ }
+ signature <- signature[1]
+
+ cb <- if( is.null( object ) ){
+ .jnew( "org/rosuda/REngine/remote/common/callbacks", signature )
+ } else {
+ # TODO: bring "object" into java
+ warning( "ObjectCallback not yet supported" )
+ }
+ # TODO: send the callback
+
+}
Added: pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/ObjectCallback.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/ObjectCallback.java (rev 0)
+++ pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/ObjectCallback.java 2009-09-08 13:57:27 UTC (rev 120)
@@ -0,0 +1,44 @@
+package org.rosuda.REngine.remote.common.callbacks;
+
+import org.rosuda.REngine.REXP;
+
+/**
+ * Signed callback that carries an R object
+ *
+ * @author Romain Francois <francoisromain at free.fr>
+ *
+ */
+public class ObjectCallback extends SignedCallback {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * R object associated with the callback
+ */
+ protected REXP object ;
+
+ /**
+ * Constructor
+ * @param signature callback signature
+ * @param object R object
+ */
+ public ObjectCallback( String signature, REXP object){
+ super( signature ) ;
+ this.object = object ;
+ }
+
+ /**
+ * Constructor using empty signature
+ * @param object R object
+ */
+ public ObjectCallback( REXP object){
+ this( "", object ) ;
+ }
+
+ /**
+ * @return The R object associated with the callback
+ */
+ public REXP getObject(){
+ return object ;
+ }
+}
Added: pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/SignedCallback.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/SignedCallback.java (rev 0)
+++ pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/callbacks/SignedCallback.java 2009-09-08 13:57:27 UTC (rev 120)
@@ -0,0 +1,34 @@
+package org.rosuda.REngine.remote.common.callbacks;
+
+/**
+ * Signed callback
+ *
+ * @author Romain Francois <francoisromain at free.fr>
+ *
+ */
+public class SignedCallback extends RCallbackNoResponse {
+
+ /**
+ * The callback signature
+ */
+ protected String signature ;
+
+ /**
+ * Builds a signed callback
+ *
+ * @param signature callback signature
+ */
+ public SignedCallback( String signature){
+ this.signature = signature ;
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @return the signature of the callback
+ */
+ public String getSignature(){
+ return signature ;
+ }
+
+}
Modified: pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java 2009-09-08 12:58:38 UTC (rev 119)
+++ pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java 2009-09-08 13:57:27 UTC (rev 120)
@@ -475,12 +475,6 @@
callbackSender.addToQueue( callback ) ;
}
- public void sendCallbackToOtherListeners(ReadConsoleCallback callback,
- CommandSender sender) {
-
- }
-
-
/**
* start the console thread
*/
More information about the Remoterengine-commits
mailing list