|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.io.RemoteCallHandler
A remote call handler is a class that performs two functions:
If you want to change the method for receiving and sending data (i.e. not via the default stream) you must override boolean sendData(ByteArray data) and TextDecoder getData(ByteArray dest)
To close the RemoteCallHandler simply close the Stream object. If you want to close the handler without closing the stream, call the close() method.
| Field Summary | |
protected boolean |
closed
|
Handle |
handle
This can be used to monitor the progress of the RemoteCallHandler. |
protected BlockInputStream |
in
|
IOException |
ioException
If an IOException occured, it will be placed here. |
protected BlockOutputStream |
out
|
Object |
target
If this is not null then all calls with a null targetCode assumed to be to this target. |
Hashtable |
targets
This Hashtable contains the local target objects and is used by the default implementation to match a target code with the target object. |
int |
timeOut
This is the timeout in milliseconds for receiving a reply. |
| Constructor Summary | |
RemoteCallHandler()
Create a RemoteCallHandler with no stream or target object. |
|
RemoteCallHandler(InputStream in,
OutputStream out,
Object target)
|
|
RemoteCallHandler(Stream stream,
Object target)
Create a RemoteCallHandler using the specified stream and with the specified target object (i.e. |
|
| Method Summary | |
Wrapper |
call(RemoteCall call)
This calls and waits for the remote call to complete, fail or timeout. |
boolean |
call(RemoteCall rc,
String targetCode)
This dispatches the RemoteCall to the remote handler. |
Wrapper |
call(RemoteCall call,
String targetCode,
StringBuffer error)
This calls and waits for the remote call to complete, fail or timeout. |
RemoteCall |
callAndWait(RemoteCall call,
String targetCode)
This calls and waits for the remote call to complete, fail or timeout. |
protected boolean |
callReceived(ByteArray received)
|
void |
close()
Closes the RemoteCallHandler and stops its operation. |
void |
closeConnection()
Closes the RemoteCallHandler and stops its operation and closes the stream connection. |
protected ByteArray |
doInvoke(Object target,
RemoteCall rc)
|
protected Tag |
findTag(int id,
Vector where)
|
protected Object |
findTarget(String targetCode)
Override this to find a target given a text encoded targetCode. |
ByteArray |
getData(ByteArray dest)
This is responsible for receiving data - either remote calls or replies to remote calls. |
protected void |
queueSend(ByteArray toSend,
int id,
boolean isCall)
|
protected void |
queueSend(Tag toSend)
|
void |
sendData(ByteArray data)
This is responsible for sending data - either remote calls or replies to remote calls. |
void |
setEncryption(DataProcessor decryptor,
DataProcessor encryptor)
Set the encryption to use for sending and receiving calls. |
void |
setEncryption(String password)
Set the encryption to use for sending and receiving calls. |
void |
setKeys(EncryptionKey remotePublicKey,
EncryptionKey localPrivateKey)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public Handle handle
public Hashtable targets
protected BlockOutputStream out
protected BlockInputStream in
public Object target
public int timeOut
public IOException ioException
protected boolean closed
| Constructor Detail |
public RemoteCallHandler()
public RemoteCallHandler(Stream stream,
Object target)
stream - The stream for the communication between RemoteCallHandlers.target - A default object for methods to be invoked on. This can be null, in
which case you will have to add targets to the targets Hashtable.
public RemoteCallHandler(InputStream in,
OutputStream out,
Object target)
| Method Detail |
protected Object findTarget(String targetCode)
public void setEncryption(DataProcessor decryptor,
DataProcessor encryptor)
throws IOException
IOException
public void setEncryption(String password)
throws IOException
IOException
public void setKeys(EncryptionKey remotePublicKey,
EncryptionKey localPrivateKey)
throws IOException
IOException
public void sendData(ByteArray data)
throws IOException
This method may block the current mThread - the other operations of the handler operate in their own mThread threads.
IOException
public ByteArray getData(ByteArray dest)
throws IOException
This method should block the current mThread until a full TextDecoder object has been read - the other operations of the handler operate in their own mThread threads.
IOExceptionpublic void close()
public void closeConnection()
protected void queueSend(ByteArray toSend,
int id,
boolean isCall)
protected void queueSend(Tag toSend)
protected ByteArray doInvoke(Object target,
RemoteCall rc)
protected Tag findTag(int id,
Vector where)
protected boolean callReceived(ByteArray received)
public boolean call(RemoteCall rc,
String targetCode)
public RemoteCall callAndWait(RemoteCall call,
String targetCode)
public Wrapper call(RemoteCall call,
String targetCode,
StringBuffer error)
public Wrapper call(RemoteCall call)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||