S-PLUS Connect/Java v1.0

com.insightful.splus
Class SplusSessionImpl

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bycom.insightful.splus.SplusSessionImpl
All Implemented Interfaces:
Remote, Serializable, SplusSession

public class SplusSessionImpl
extends UnicastRemoteObject
implements SplusSession

Basic implementation of SplusSession for UNIX/Linux. Communicates with the S-PLUS engine via FIFO's.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SplusSessionImpl()
           
SplusSessionImpl(String[] args)
           
SplusSessionImpl(String[] args, boolean doSSL)
           
 
Method Summary
static void clientShutdown()
           
 SplusDataResult evalDataQuery(String cmd)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, boolean pingEngine, boolean parseTest)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, boolean Output, boolean Result, boolean Errors, boolean Warnings, boolean Expr)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, boolean Output, boolean Result, boolean Errors, boolean Warnings, boolean Expr, boolean pingEngine, boolean parseTest)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, boolean Output, boolean Result, boolean Errors, boolean Warnings, boolean Expr, int timeout)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, boolean Output, boolean Result, boolean Errors, boolean Warnings, boolean Expr, int timeout, boolean pingEngine, boolean parseTest)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, int timeout)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
 SplusDataResult evalDataQuery(String cmd, int timeout, boolean pingEngine, boolean parseTest)
          Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.
protected  void finalize()
           
 char[] getCertAccess()
          Method allowing clients to get the password to a certificate file on the server.
 String getCertFilename()
          Method allowing clients to get a path to a certificate file on the server.
static ClientObjectFactory getClientObjectFactory()
           
 ClientUtilities getClientUtilities()
          Create and return a new server-side ClientUtilitiesImpl.
 FileInputStreamProxy getFileInputStream(String filename)
          Get a FileInputStream from the server JVM.
 FileOutputStreamProxy getFileOutputStream(String filename)
          Get a FileOutputStream from the server JVM.
static SplusSession getRemoteSession(boolean useDialog, ClientObjectFactory objFact, String[] clArgs)
          Login to a remote session object.
 void init(String[] args)
           
 void Interrupt()
          Send an interrupt signal (SIGINT) to the S-PLUS engine.
 boolean isRemote()
          Test whether the session is remote.
protected static SplusSession loginWithSystemProperties(String[] clArgs)
          If system properties are set with the login information, use that information to log in.
 void pollOutput(SplusOutputHandler handler)
           
 String readSplusErr()
          Read any pending standard error text from the S-PLUS engine.
 String readSplusOut()
          Read any pending standard output from the S-PLUS engine.
 void sessionExit()
          Shut down the session.
 void sessionExit(boolean killClient)
          Shut down the session.
 void setClientObjectFactory(ClientObjectFactory factory)
          Set a ClientObjectFactory that the server can use to perform operations in the client JVM.
 void startPollOutput(SplusOutputHandler handler)
          Register an SplusOutputHandler to be notified when output is available.
 void writeSplusData(String str)
          Write text to the data channel.
 void writeSplusIn(String str)
          Write text to the S-PLUS engine's standard input.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplusSessionImpl

public SplusSessionImpl(String[] args,
                        boolean doSSL)
                 throws RemoteException

SplusSessionImpl

public SplusSessionImpl(String[] args)
                 throws RemoteException

SplusSessionImpl

public SplusSessionImpl()
                 throws RemoteException
Method Detail

init

public void init(String[] args)
          throws RemoteException
Throws:
RemoteException

writeSplusIn

public void writeSplusIn(String str)
                  throws RemoteException
Description copied from interface: SplusSession
Write text to the S-PLUS engine's standard input.

Specified by:
writeSplusIn in interface SplusSession
Throws:
RemoteException

writeSplusData

public void writeSplusData(String str)
                    throws RemoteException
Description copied from interface: SplusSession
Write text to the data channel. This is a connection between Java and the S-PLUS engine used by evalDataQuery(). This method is available for use in debugging. Use writeSplusIn() to send a command over standard input, or evalDataQuery() to evaluate an expression through the data channel.

Specified by:
writeSplusData in interface SplusSession
Throws:
RemoteException

readSplusOut

public String readSplusOut()
                    throws RemoteException
Description copied from interface: SplusSession
Read any pending standard output from the S-PLUS engine.

Specified by:
readSplusOut in interface SplusSession
Throws:
RemoteException

readSplusErr

public String readSplusErr()
                    throws RemoteException
Description copied from interface: SplusSession
Read any pending standard error text from the S-PLUS engine.

Specified by:
readSplusErr in interface SplusSession
Throws:
RemoteException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     boolean Output,
                                     boolean Result,
                                     boolean Errors,
                                     boolean Warnings,
                                     boolean Expr,
                                     int timeout,
                                     boolean pingEngine,
                                     boolean parseTest)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

This version of the method has boolean flags to indicate which elements to include in the SplusDataResult. Set specific flags to false to avoid shipping over unnecessary information.

Additional flags are available to defeat the checking for engine availability and command completeness. This is generally unsafe. If, however, one is certain that the command is correct and the engine is not busy with a previous command or with requests from some other thread, it will speed up the method call by about 150 ms.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
Output - Include output in the SplusDataResult.
Result - Include data in the SplusDataResult.
Errors - Include errors in the SplusDataResult.
Warnings - Include warnings in the SplusDataResult.
Expr - Include the expression (cmd) reformatted to match the width of the output.
timeout - Seconds to wait before generating an Engine Busy error.
pingEngine - Perform a check to see if the S-PLUS engine is responsive.
parseTest - Perform a check to see if the command parses before attempting to evaluate it.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     int timeout)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
timeout - Seconds to wait before generating an Engine Busy error.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     boolean pingEngine,
                                     boolean parseTest)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

Additional flags are available to avert the checking for engine availability and command completeness. This is generally unsafe. If, however, one is certain that the command is correct and the engine is not busy with a previous command or with requests from some other thread, it will speed up the method call by about 150 ms.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
pingEngine - Perform a check to see if the S-PLUS engine is responsive.
parseTest - Perform a check to see if the command parses before attempting to evaluate it.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     int timeout,
                                     boolean pingEngine,
                                     boolean parseTest)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

Additional flags are available to avert the checking for engine availability and command completeness. This is generally unsafe. If, however, one is certain that the command is correct and the engine is not busy with a previous command or with requests from some other thread, it will speed up the method call by about 150 ms.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
timeout - Seconds to wait before generating an Engine Busy error.
pingEngine - Perform a check to see if the S-PLUS engine is responsive.
parseTest - Perform a check to see if the command parses before attempting to evaluate it.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     boolean Output,
                                     boolean Result,
                                     boolean Errors,
                                     boolean Warnings,
                                     boolean Expr)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

This version of the method has boolean flags to indicate which elements to include in the SplusDataResult. Set specific flags to false to avoid shipping over unnecessary information.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
Output - Include output in the SplusDataResult.
Result - Include data in the SplusDataResult.
Errors - Include errors in the SplusDataResult.
Warnings - Include warnings in the SplusDataResult.
Expr - Include the expression (cmd) reformatted to match the width of the output.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     boolean Output,
                                     boolean Result,
                                     boolean Errors,
                                     boolean Warnings,
                                     boolean Expr,
                                     int timeout)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

This version of the method has boolean flags to indicate which elements to include in the SplusDataResult. Set specific flags to false to avoid shipping over unnecessary information.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
Output - Include output in the SplusDataResult.
Result - Include data in the SplusDataResult.
Errors - Include errors in the SplusDataResult.
Warnings - Include warnings in the SplusDataResult.
Expr - Include the expression (cmd) reformatted to match the width of the output.
timeout - Seconds to wait before generating an Engine Busy error.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

evalDataQuery

public SplusDataResult evalDataQuery(String cmd,
                                     boolean Output,
                                     boolean Result,
                                     boolean Errors,
                                     boolean Warnings,
                                     boolean Expr,
                                     boolean pingEngine,
                                     boolean parseTest)
                              throws RemoteException,
                                     SplusEngineBusyException,
                                     SplusIncompleteExpressionException
Description copied from interface: SplusSession
Evaluate an S-PLUS expression in the S-PLUS engine and retrieve the result as an SplusDataResult.

This version of the method has boolean flags to indicate which elements to include in the SplusDataResult. Set specific flags to false to avoid shipping over unnecessary information.

Additional flags are available to defeat the checking for engine availability and command completeness. This is generally unsafe. If, however, one is certain that the command is correct and the engine is not busy with a previous command or with requests from some other thread, it will speed up the method call by about 150 ms.

Specified by:
evalDataQuery in interface SplusSession
Parameters:
cmd - Expression to evaluate.
Output - Include output in the SplusDataResult.
Result - Include data in the SplusDataResult.
Errors - Include errors in the SplusDataResult.
Warnings - Include warnings in the SplusDataResult.
Expr - Include the expression (cmd) reformatted to match the width of the output.
pingEngine - Perform a check to see if the S-PLUS engine is responsive.
parseTest - Perform a check to see if the command parses before attempting to evaluate it.
Throws:
RemoteException
SplusEngineBusyException
SplusIncompleteExpressionException

Interrupt

public void Interrupt()
               throws RemoteException
Description copied from interface: SplusSession
Send an interrupt signal (SIGINT) to the S-PLUS engine.

Specified by:
Interrupt in interface SplusSession
Throws:
RemoteException

setClientObjectFactory

public void setClientObjectFactory(ClientObjectFactory factory)
                            throws RemoteException
Description copied from interface: SplusSession
Set a ClientObjectFactory that the server can use to perform operations in the client JVM.

Specified by:
setClientObjectFactory in interface SplusSession
Throws:
RemoteException

getClientObjectFactory

public static ClientObjectFactory getClientObjectFactory()

getFileInputStream

public FileInputStreamProxy getFileInputStream(String filename)
                                        throws FileNotFoundException,
                                               RemoteException
Description copied from interface: SplusSession
Get a FileInputStream from the server JVM.

Specified by:
getFileInputStream in interface SplusSession
Throws:
FileNotFoundException
RemoteException

getFileOutputStream

public FileOutputStreamProxy getFileOutputStream(String filename)
                                          throws FileNotFoundException,
                                                 RemoteException
Description copied from interface: SplusSession
Get a FileOutputStream from the server JVM.

Specified by:
getFileOutputStream in interface SplusSession
Throws:
FileNotFoundException
RemoteException

startPollOutput

public void startPollOutput(SplusOutputHandler handler)
Description copied from interface: SplusSession
Register an SplusOutputHandler to be notified when output is available. If an output handler is registered, text will automatically be written to the output handler as it is generated. Alternately, text will be buffered until it is retrieved via calls to readSplusOut() and readSplusErr().

Specified by:
startPollOutput in interface SplusSession

pollOutput

public void pollOutput(SplusOutputHandler handler)

isRemote

public boolean isRemote()
Description copied from interface: SplusSession
Test whether the session is remote. This is true in client/server mode.

Specified by:
isRemote in interface SplusSession

sessionExit

public void sessionExit(boolean killClient)
Description copied from interface: SplusSession
Shut down the session. Call this with killClient set to true to shut down the session from a client. Call this with killClient set to false to shut down both the session and the related client from the server.

Specified by:
sessionExit in interface SplusSession
Parameters:
killClient - true to tell the client to shut itself down.

sessionExit

public void sessionExit()
Description copied from interface: SplusSession
Shut down the session. As part of shutdown, the session will tell the client to shut itself down.

Specified by:
sessionExit in interface SplusSession

finalize

protected void finalize()
                 throws Throwable
Throws:
Throwable

clientShutdown

public static void clientShutdown()

getRemoteSession

public static SplusSession getRemoteSession(boolean useDialog,
                                            ClientObjectFactory objFact,
                                            String[] clArgs)
Login to a remote session object.


loginWithSystemProperties

protected static SplusSession loginWithSystemProperties(String[] clArgs)
If system properties are set with the login information, use that information to log in. Return null if the system properties are not set or if the login fails.


getCertFilename

public String getCertFilename()
                       throws RemoteException
Description copied from interface: SplusSession
Method allowing clients to get a path to a certificate file on the server. This allows the client to use the same SSL encryption credentials as the server when instancing client-side remote objects.

Specified by:
getCertFilename in interface SplusSession
Throws:
RemoteException

getCertAccess

public char[] getCertAccess()
                     throws RemoteException
Description copied from interface: SplusSession
Method allowing clients to get the password to a certificate file on the server. This allows the client to use the same SSL encryption credentials as the server when instancing client-side remote objects.

Specified by:
getCertAccess in interface SplusSession
Throws:
RemoteException

getClientUtilities

public ClientUtilities getClientUtilities()
                                   throws RemoteException
Create and return a new server-side ClientUtilitiesImpl.

Specified by:
getClientUtilities in interface SplusSession
Throws:
RemoteException

S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.