CTL
Class Remote

java.lang.Object
  extended by CTL.Remote

public class Remote
extends java.lang.Object

Static methods for remote communication based on the CTL protocol


Field Summary
static int C
          Constants for different languages
static int CPP
           
static int CTRL
          Control message
static int DAT
          Send data directly
static int DBG
          Debug Info
static int EOC
          End of communication
static int ERR
          Error
static int FORTRAN
           
static int JAVA
           
static java.lang.String magic
          Magic string to check for correct byte order and filtering when using the pipe transport mechanism
static int magic2
           
static int OPER
          Operation
static int RMI
          Remote method invocation
static int SSH
          SSH connect
private static int tag
          Start tag for user defined message types
static int UNDEF
          Undefined
 
Constructor Summary
Remote()
           
 
Method Summary
private static void __answer(Communicator comm, Header head, long objID, Except ex, IStream2 args, boolean keep_args)
          Remote answer function
private static void __call(Communicator comm, Header head, long objID, FID fid, IStream2 args, rPointer objID2, boolean keep_args)
          Remote call function
static void answer(Communicator comm, Header head, long objID, Except ex, IStream2 args)
          Answer wrapper for logging, etc.
static void call(Communicator comm, Header head, long objID, FID fid, IStream2 args, rPointer objID2)
          Call wrapper for logging, etc.
static java.lang.String parseMType(int mtype)
          Convert a numerical message type to string
static java.lang.Object readDAT(Communicator comm, java.lang.String type)
          Read a DAT message
static GroupInfo readHS(Communicator comm)
          Read handshake
static void writeDAT(Communicator comm, java.lang.Object data)
          Write a DAT message
static void writeDAT(Communicator comm, java.lang.Object data, IPaddr host, int port)
           
static void writeDBG(Communicator comm, byte[] data)
          Write a message to the debug socket of a communicator.
static void writeHS(GroupInfo grp, Communicator comm)
          Write handshake
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

magic

public static final java.lang.String magic
Magic string to check for correct byte order and filtering when using the pipe transport mechanism

See Also:
Constant Field Values

magic2

public static final int magic2
See Also:
Constant Field Values

EOC

public static final int EOC
End of communication

See Also:
Constant Field Values

DAT

public static final int DAT
Send data directly

See Also:
Constant Field Values

OPER

public static final int OPER
Operation

See Also:
Constant Field Values

RMI

public static final int RMI
Remote method invocation

See Also:
Constant Field Values

CTRL

public static final int CTRL
Control message

See Also:
Constant Field Values

ERR

public static final int ERR
Error

See Also:
Constant Field Values

SSH

public static final int SSH
SSH connect

See Also:
Constant Field Values

DBG

public static final int DBG
Debug Info

See Also:
Constant Field Values

UNDEF

public static final int UNDEF
Undefined

See Also:
Constant Field Values

C

public static final int C
Constants for different languages

See Also:
Constant Field Values

CPP

public static final int CPP
See Also:
Constant Field Values

FORTRAN

public static final int FORTRAN
See Also:
Constant Field Values

JAVA

public static final int JAVA
See Also:
Constant Field Values

tag

private static int tag
Start tag for user defined message types

Constructor Detail

Remote

public Remote()
Method Detail

parseMType

public static java.lang.String parseMType(int mtype)
Convert a numerical message type to string

Parameters:
mtype - Message type
Returns:
String

readDAT

public static java.lang.Object readDAT(Communicator comm,
                                       java.lang.String type)
                                throws java.io.IOException,
                                       java.lang.IllegalAccessException,
                                       java.lang.reflect.InvocationTargetException,
                                       java.lang.ClassNotFoundException,
                                       java.lang.InstantiationException,
                                       CTLException
Read a DAT message

Parameters:
comm - Communicator to use
type - Type to read
Returns:
Read value
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
CTLException

writeDAT

public static void writeDAT(Communicator comm,
                            java.lang.Object data)
                     throws java.io.IOException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            java.lang.ClassNotFoundException,
                            java.lang.InstantiationException,
                            CTLException
Write a DAT message

Parameters:
comm - Communicator to use
data - Value to send
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
CTLException

writeDAT

public static void writeDAT(Communicator comm,
                            java.lang.Object data,
                            IPaddr host,
                            int port)
                     throws java.io.IOException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException,
                            java.lang.ClassNotFoundException,
                            java.lang.InstantiationException,
                            CTLException
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
CTLException

writeHS

public static void writeHS(GroupInfo grp,
                           Communicator comm)
                    throws java.io.IOException,
                           java.lang.IllegalAccessException,
                           java.lang.reflect.InvocationTargetException,
                           java.lang.ClassNotFoundException,
                           java.lang.InstantiationException,
                           CTLException
Write handshake

Parameters:
grp - Group information
comm - Communicator to use
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
CTLException

writeDBG

public static void writeDBG(Communicator comm,
                            byte[] data)
Write a message to the debug socket of a communicator. This only works for TCPCommunicators, because only those support debug-mode.

Parameters:
comm - Some TCPCommunicator
data - The data to write

readHS

public static GroupInfo readHS(Communicator comm)
                        throws java.io.IOException,
                               java.lang.IllegalAccessException,
                               java.lang.reflect.InvocationTargetException,
                               java.lang.ClassNotFoundException,
                               java.lang.InstantiationException,
                               CTLException
Read handshake

Parameters:
comm - Communicator to use
Returns:
Group information
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
CTLException

__call

private static void __call(Communicator comm,
                           Header head,
                           long objID,
                           FID fid,
                           IStream2 args,
                           rPointer objID2,
                           boolean keep_args)
                    throws java.io.IOException,
                           java.lang.IllegalAccessException,
                           java.lang.reflect.InvocationTargetException,
                           CTLException
Remote call function

Parameters:
comm - Communicator to use
head - Header
objID - ObjectID
fid - FunctionID
args - IStream2 which stores the arguments
keep_args - Whether or not to keep the args in the IStream2 for successive function calls
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

call

public static void call(Communicator comm,
                        Header head,
                        long objID,
                        FID fid,
                        IStream2 args,
                        rPointer objID2)
                 throws java.io.IOException,
                        java.lang.IllegalAccessException,
                        java.lang.reflect.InvocationTargetException,
                        CTLException
Call wrapper for logging, etc.

Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

answer

public static void answer(Communicator comm,
                          Header head,
                          long objID,
                          Except ex,
                          IStream2 args)
                   throws java.io.IOException,
                          java.lang.IllegalAccessException,
                          java.lang.reflect.InvocationTargetException,
                          CTLException
Answer wrapper for logging, etc.

Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

__answer

private static void __answer(Communicator comm,
                             Header head,
                             long objID,
                             Except ex,
                             IStream2 args,
                             boolean keep_args)
                      throws java.io.IOException,
                             java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException,
                             CTLException
Remote answer function

Parameters:
comm - Communicator to use
head - Header
objID - ObjectID
ex - Exception
args - IStream2 which stores the arguments
keep_args - Whether or not to keep the arguments in the IStream2 for successive calls
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException