All Packages Class Hierarchy This Package Previous Next Index
Class connection.ConnectionManager
java.lang.Object
|
+----connection.ConnectionManager
- public class ConnectionManager
- extends Object
ConnectionManager
is a class for delivering messages (reading,
writing, and handling). It is composed of a MessageHandler
,
a MessageReader
, and a MessageWriter
.
- Version:
- 0.30, 1998/04/01
- Author:
- FRED development team, Antti Viljamaa
- See Also:
- MessageHandler, MessageReader, MessageWriter
-
exceptionObservers
- The objetcs that are notified upon an exception during a read or a write.
-
messageHandler
- The handler for incoming messages.
-
messagePrintingEnabled
- Determies whether to print debug info to System.out.
-
messageReader
- The message reader.
-
messageWriter
- The message writer.
-
ConnectionManager(InputStream, OutputStream)
- Constructs a connection manager and initilises it with a message reader
attached to the given input stream and a message writer attached to the
given output stream.
-
ConnectionManager(InputStream, OutputStream, MessageHandler)
- Constructs a connection manager and initilises it with a message reader
attached to the given input stream, a message writer attached to the
given output stream, and a message handler.
-
getExceptionObservers()
- Returns the exception observers.
-
getMessageHandler()
- Returns the message handler.
-
getMessageReader()
- Returns the message reader.
-
getMessageWriter()
- Returns the message writer.
-
isMessagePrintingEnabled()
- Determines if message printing is enabled.
-
notifyAllExceptionObservers(Exception)
- Notifies all registered exception observers.
-
receiveMessage()
- Blocks for receiving a new message, and once it arrives, asks the handler
to handle it.
-
registerExceptionObserver(ExceptionObserver)
- Registeres a new exception observer.
-
sendMessage(Message)
- Sends the given message.
-
setMessageHandler(MessageHandler)
- Sets the message handler.
-
setMessagePrintingEnabled(boolean)
- Sets the flag that determines if message printing is enabled.
-
setMessageReader(MessageReader)
- Sets the message reader.
-
setMessageWriter(MessageWriter)
- Sets the message writer.
exceptionObservers
private Vector exceptionObservers
- The objetcs that are notified upon an exception during a read or a write.
messageReader
private MessageReader messageReader
- The message reader.
messageWriter
private MessageWriter messageWriter
- The message writer.
messageHandler
private MessageHandler messageHandler
- The handler for incoming messages.
messagePrintingEnabled
private boolean messagePrintingEnabled
- Determies whether to print debug info to System.out.
ConnectionManager
public ConnectionManager(InputStream inputStream,
OutputStream outputStream)
- Constructs a connection manager and initilises it with a message reader
attached to the given input stream and a message writer attached to the
given output stream. No message handler is created.
- Parameters:
- inputStream - The input stream that is connected to this
connection manager.
- outputStream - The output stream that is connected to this
connection manager.
ConnectionManager
public ConnectionManager(InputStream inputStream,
OutputStream outputStream,
MessageHandler messageHandler)
- Constructs a connection manager and initilises it with a message reader
attached to the given input stream, a message writer attached to the
given output stream, and a message handler.
- Parameters:
- inputStream - The input stream that is connected to this
connection manager.
- outputStream - The output stream that is connected to this
connection manager.
- messageHandler - The root handler for messages.
sendMessage
public void sendMessage(Message m)
- Sends the given message. If an exception occurs during the receive,
notifies all exception observers.
- Parameters:
- m - The message that is sent.
receiveMessage
public boolean receiveMessage()
- Blocks for receiving a new message, and once it arrives, asks the handler
to handle it. If an exception occurs during the receive, notifies all
exception observers.
- Returns:
- boolean if the message was handled, otherwise.
getMessageHandler
public MessageHandler getMessageHandler()
- Returns the message handler.
getMessageReader
public MessageReader getMessageReader()
- Returns the message reader.
getMessageWriter
public MessageWriter getMessageWriter()
- Returns the message writer.
setMessageReader
public void setMessageReader(MessageReader mr)
- Sets the message reader.
setMessageWriter
public void setMessageWriter(MessageWriter mw)
- Sets the message writer.
setMessageHandler
public void setMessageHandler(MessageHandler mh)
- Sets the message handler.
registerExceptionObserver
public void registerExceptionObserver(ExceptionObserver observer)
- Registeres a new exception observer. Exception observers are notified if
an exception occurs when sending or receiving messages.
notifyAllExceptionObservers
protected void notifyAllExceptionObservers(Exception exception)
- Notifies all registered exception observers.
getExceptionObservers
public Vector getExceptionObservers()
- Returns the exception observers.
isMessagePrintingEnabled
public boolean isMessagePrintingEnabled()
- Determines if message printing is enabled.
setMessagePrintingEnabled
public void setMessagePrintingEnabled(boolean flag)
- Sets the flag that determines if message printing is enabled.
All Packages Class Hierarchy This Package Previous Next Index