All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.ui.remote.RemotePipe

java.lang.Object
   |
   +----guinea.ui.remote.RemotePipe

public class RemotePipe
extends Object
implements Runnable

Variable Index

· verbose

Constructor Index

· RemotePipe(ObjectInputStream, ObjectOutputStream)
Create a new remote pipe.
· RemotePipe(Socket)
Create a new remote pipe.

Method Index

· close()
Close the remote pipe.
· doCommand(RemoteCommand)
Do a remote command.
· getNewSerial()
Allocate a new serial number for a command.
· isPipeOpen()
Test whether the pipe is open.
· printerr(int, String)
· processCommand(RemoteCommand)
· receiveCommandReply(int)
Get a remote command reply for a command with a given serial number.
· receiveMessage()
Get an object that has been sent to this pipe.
· receiveMessageWait()
Get an object that has been sent to this pipe.
· removeProcessorCommand(String)
· run()
· sendCommand(RemoteCommand)
Send a remote command.
· sendMessage(Object)
Send an object to the pipe.
· sendReply(RemoteCommandReply)
Send a remote command reply.
· setProcessorCommand(String, ProcessRemoteCommand)
· startServer()
Start remote pipe.
· waitEnd()
Wait for the remote pipe to be closed.

Variables

· verbose
 public static final int verbose

Constructors

· RemotePipe
 public RemotePipe(Socket socket) throws IOException
Create a new remote pipe.

Parameters:
socket - the socket used to talk with remote end.
Throws: IOException
cannot create object output/input from the socket.
· RemotePipe
 public RemotePipe(ObjectInputStream revc,
                   ObjectOutputStream send)
Create a new remote pipe.

Parameters:
revc - An ObjectInputStream used to receive messages.
send - An ObjectOutputStream used to send messages.
Throws: IOException
cannot create object output/input from the socket.

Methods

· printerr
 public static final void printerr(int pri,
                                   String message)
· startServer
 public synchronized void startServer()
Start remote pipe. Creates a thread that reads messages from the pipe and dispatches commands to receivers.

· run
 public void run()
· close
 public synchronized void close() throws InterruptedException
Close the remote pipe.

Throws: InterruptedException
An exception may be thrown if waiting for the closing of the pipe was interrupted.
· waitEnd
 public synchronized void waitEnd() throws InterruptedException
Wait for the remote pipe to be closed.

Throws: InterruptedException
An exception may be thrown if waiting for the closing of the pipe was interrupted.
· isPipeOpen
 public synchronized boolean isPipeOpen()
Test whether the pipe is open.

Returns:
true if pipe is open and active.
· sendMessage
 public void sendMessage(Object message)
Send an object to the pipe.

Parameters:
message - an object to send to remote end.
· receiveMessage
 public Object receiveMessage()
Get an object that has been sent to this pipe. If no messages have been received, returns null.

Returns:
an object received by the pipe or null if no unprocessed messages have been received.
· receiveMessageWait
 public Object receiveMessageWait() throws InterruptedException
Get an object that has been sent to this pipe. This is same as receiveMessage() but waits until one message becomes available.

Returns:
an object received by the pipe.
Throws: InterruptedException
if wait was interrupted.
· receiveCommandReply
 public RemoteCommandReply receiveCommandReply(int serial)
Get a remote command reply for a command with a given serial number.

Parameters:
serial - the serial number of the command that we are waiting the reply for.
Returns:
a remote command reply for the command with the given serial number.
· getNewSerial
 public synchronized int getNewSerial()
Allocate a new serial number for a command.

Returns:
a unique command serial number for use with this pipe.
· sendCommand
 public int sendCommand(RemoteCommand c)
Send a remote command.

Parameters:
c - the remote command to send.
Returns:
the serial number of this command. If no serial number was set in the command, a new serial number is allocated and returned.
· sendReply
 public void sendReply(RemoteCommandReply c)
Send a remote command reply.

Parameters:
c - the remote command reply.
· doCommand
 public RemoteCommandReply doCommand(RemoteCommand c)
Do a remote command. Sends the command, waits for a reply for the command and returns it.

Parameters:
c - the command to send.
Returns:
a reply to the command.
· setProcessorCommand
 public synchronized void setProcessorCommand(String target,
                                              ProcessRemoteCommand p)
· removeProcessorCommand
 public synchronized ProcessRemoteCommand removeProcessorCommand(String target)
· processCommand
 public void processCommand(RemoteCommand com)

All Packages  Class Hierarchy  This Package  Previous  Next  Index