com.monica.javacom.manager
Class MJCManager

java.lang.Object
  |
  +--com.monica.javacom.manager.MJCManager
All Implemented Interfaces:
MJCCloser, MJCConfigureable, MJCReadable, MJCReader, MJCWriteable, MJCWriter, java.lang.Runnable

public class MJCManager
extends java.lang.Object
implements MJCReader, MJCReadable, MJCWriteable, MJCWriter, MJCConfigureable, java.lang.Runnable, MJCCloser

Middle level layer responsible for the MJC connection between the client and server side.


Constructor Summary
MJCManager()
          Default constructor.
 
Method Summary
 void closeApplication()
          This method closes the client side application.
 void connectionClosedEvent(MJCReadable readable)
          Indicates that the source connection of the specified MJCReadable has been closed.
 void errorEvent(java.lang.String errorDescription, MJCReadable readable)
          Indicates that there was an error in the source connection of the specified MJCReadable.
 void flush()
          Flushes the contents of the write buffer to bottom layers.
 int getAvailable()
          Returns the number of bytes that are available for read out from this MJCReadable.
 java.lang.String getCloserName()
          Returns the MJC name of the MJCCloser.
 java.lang.String getCloserVersion()
          Returns the MJC version of the MJCCloser.
 MJCConfiguration getConfiguration()
          Returns the MJCConfiguration with which this object is customized.
 java.lang.String getInput()
          Returns the contents of the read buffer from this MJCReadable.
 java.lang.String getLastWriteableError()
          Returns the error message of the last occured error.
 MJCReadable getReadable()
          Returns the MJCReadable from which data will be read.
 java.lang.String getReadableName()
          Returns the MJC name of the MJCReadable.
 java.lang.String getReadableVersion()
          Returns the MJC version of the MJCReadable.
 MJCReader getReader()
          Returns the MJCReader to which readEvents will be sent.
 java.lang.String getReaderName()
          Returns the MJC name of the MJCReader.
 java.lang.String getReaderVersion()
          Returns the MJC version of the MJCReader.
 MJCWriteable getWriteable()
          Returns the MJCWriteable to which this MCJWriter will write.
 java.lang.String getWriteableName()
          Returns the MJC name of the MJCWriteable.
 java.lang.String getWriteableVersion()
          Returns the MJC version of the MJCWriteable.
 java.lang.String getWriterName()
          Returns the MJC name of the MJCWriter.
 java.lang.String getWriterVersion()
          Returns the MJC version of the MJCWriter.
 boolean isReadableConnected()
          Returns wether the MJCReadable is still connected to its source.
 boolean isWriteableConnected()
          Returns wether the MJCWriteable is connected to its target.
 void readEvent(MJCReadable readable)
          Indicates that there is data available from the specified MJCReadable.
 void run()
          Entry point for the reader thread.
 void setConfiguration(MJCConfiguration configuration)
          Sets the MJCConfiguration for this object.
 void setReadable(MJCReadable readable)
          Sets the MJCReadable from which data has to be read.
 void setReader(MJCReader reader)
          Sets the MJCReader to which the readEvents have to be sent.
 void setReconfigureable(MJCConfigureable[] r)
           
 void setTransport(MJCTransport transport)
          Sets the MJCTransport object which is responsible for the data connection between the client and the server side.
 void setWindow(MJCWindow window)
          Sets the MJCWindow that represents the user interface of the client side.
 void setWriteable(MJCWriteable writeable)
          Sets the MJCWriteable to which this MJCWriter will write.
 boolean write(char c)
          Writes one single char.
 boolean write(char[] c)
          Writes a char array.
 boolean write(java.lang.String s)
          Writes a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCManager

public MJCManager()
Default constructor.
Method Detail

setTransport

public void setTransport(MJCTransport transport)
Sets the MJCTransport object which is responsible for the data connection between the client and the server side.
Specified by:
setTransport in interface MJCCloser
Parameters:
MJCTransport - transport: the MJCTransport that is responsible for the data connection between the client and the server side

getWriterName

public java.lang.String getWriterName()
Returns the MJC name of the MJCWriter.
Specified by:
getWriterName in interface MJCWriter
Returns:
String: the MJC name of the MJCWriter

getWriterVersion

public java.lang.String getWriterVersion()
Returns the MJC version of the MJCWriter.
Specified by:
getWriterVersion in interface MJCWriter
Returns:
String: the MJC version of the MJCWriter

setWriteable

public void setWriteable(MJCWriteable writeable)
Sets the MJCWriteable to which this MJCWriter will write.
Specified by:
setWriteable in interface MJCWriter
Parameters:
MJCWriteable - writeable: the MJCWriteable to which this MJCWriter will write

getWriteable

public MJCWriteable getWriteable()
Returns the MJCWriteable to which this MCJWriter will write.
Specified by:
getWriteable in interface MJCWriter
Returns:
MJCWriteable: the MJCWriteable to which this MJCWriter will write

setConfiguration

public void setConfiguration(MJCConfiguration configuration)
Sets the MJCConfiguration for this object.
Specified by:
setConfiguration in interface MJCConfigureable
Parameters:
MJCConfiguration - configuration: the MJCConfiguration object for the customization

getConfiguration

public MJCConfiguration getConfiguration()
Returns the MJCConfiguration with which this object is customized.
Specified by:
getConfiguration in interface MJCConfigureable
Returns:
MJCConfiguration: the MJCConfiguration with which this object is customized

getReadableName

public java.lang.String getReadableName()
Returns the MJC name of the MJCReadable.
Specified by:
getReadableName in interface MJCReadable
Returns:
String: the MJC name of the MJCReadable

getReadableVersion

public java.lang.String getReadableVersion()
Returns the MJC version of the MJCReadable.
Specified by:
getReadableVersion in interface MJCReadable
Returns:
String: the MJC version of the MJCReadable

isReadableConnected

public boolean isReadableConnected()
Returns wether the MJCReadable is still connected to its source.
Specified by:
isReadableConnected in interface MJCReadable
Returns:
boolean: wether the MJCReadable is still connected to its source

getAvailable

public int getAvailable()
Returns the number of bytes that are available for read out from this MJCReadable.
Specified by:
getAvailable in interface MJCReadable
Returns:
int: the number of bytes available for read out

getInput

public java.lang.String getInput()
Returns the contents of the read buffer from this MJCReadable.
Specified by:
getInput in interface MJCReadable
Returns:
String: the contents of the read buffer

setReader

public void setReader(MJCReader reader)
Sets the MJCReader to which the readEvents have to be sent.
Specified by:
setReader in interface MJCReadable
Parameters:
MJCReader - reader: the MJCReader to which the readEvents have to be sent

getReader

public MJCReader getReader()
Returns the MJCReader to which readEvents will be sent.
Specified by:
getReader in interface MJCReadable
Returns:
MJCReader: the MJCReader to which readEvents will be sent

setReadable

public void setReadable(MJCReadable readable)
Sets the MJCReadable from which data has to be read.
Specified by:
setReadable in interface MJCReader
Parameters:
MJCReadable - readable: the MJCReadable from which data has to be read

getReadable

public MJCReadable getReadable()
Returns the MJCReadable from which data will be read.
Specified by:
getReadable in interface MJCReader
Returns:
MJCReadable: the MJCReadable from which data will be read

run

public void run()
Entry point for the reader thread.
Specified by:
run in interface java.lang.Runnable

getReaderName

public java.lang.String getReaderName()
Returns the MJC name of the MJCReader.
Specified by:
getReaderName in interface MJCReader
Returns:
String: the MJC name of the MJCReader

getReaderVersion

public java.lang.String getReaderVersion()
Returns the MJC version of the MJCReader.
Specified by:
getReaderVersion in interface MJCReader
Returns:
String: the MJC version of the MJCReader

readEvent

public void readEvent(MJCReadable readable)
Indicates that there is data available from the specified MJCReadable.
Specified by:
readEvent in interface MJCReader
Parameters:
MJCReadable - readable: there is data available from the readable

connectionClosedEvent

public void connectionClosedEvent(MJCReadable readable)
Indicates that the source connection of the specified MJCReadable has been closed.
Specified by:
connectionClosedEvent in interface MJCReader
Parameters:
MJCReadable - readable: the MJCReadable whose source connection has been closed

errorEvent

public void errorEvent(java.lang.String errorDescription,
                       MJCReadable readable)
Indicates that there was an error in the source connection of the specified MJCReadable.
Specified by:
errorEvent in interface MJCReader
Parameters:
String - errorDescription: the error message
MJCReadable - readable: the MJCReadable where the error occured

getWriteableName

public java.lang.String getWriteableName()
Returns the MJC name of the MJCWriteable.
Specified by:
getWriteableName in interface MJCWriteable
Returns:
String: the MJC name of the MJCWriteable

getWriteableVersion

public java.lang.String getWriteableVersion()
Returns the MJC version of the MJCWriteable.
Specified by:
getWriteableVersion in interface MJCWriteable
Returns:
String: the MJC version of the MJCWriteable

write

public boolean write(char c)
Writes one single char. Writing is synchronous and can be buffered.
Specified by:
write in interface MJCWriteable
Parameters:
char - c: the char to be written
Returns:
boolean: wether the writing has been successful

write

public boolean write(java.lang.String s)
Writes a String. Writing is synchronous and can be buffered.
Specified by:
write in interface MJCWriteable
Parameters:
String - s: the String to be written
Returns:
boolean: wether the writing has been successful

write

public boolean write(char[] c)
Writes a char array. Writing is synchronous and can be buffered.
Specified by:
write in interface MJCWriteable
Parameters:
char[] - c: the char array to be written
Returns:
boolean: wether the writing has been successful

flush

public void flush()
Flushes the contents of the write buffer to bottom layers.
Specified by:
flush in interface MJCWriteable

getLastWriteableError

public java.lang.String getLastWriteableError()
Returns the error message of the last occured error. After returning it, the error message will be deleted and cannot be queried again.
Specified by:
getLastWriteableError in interface MJCWriteable
Returns:
String: the last error message

isWriteableConnected

public boolean isWriteableConnected()
Returns wether the MJCWriteable is connected to its target.
Specified by:
isWriteableConnected in interface MJCWriteable
Returns:
boolean: wether the MJCWriteable is connected to its target

getCloserName

public java.lang.String getCloserName()
Returns the MJC name of the MJCCloser.
Specified by:
getCloserName in interface MJCCloser
Returns:
String: the MJC name of the MJCCloser

getCloserVersion

public java.lang.String getCloserVersion()
Returns the MJC version of the MJCCloser.
Specified by:
getCloserVersion in interface MJCCloser
Returns:
String: the MJC version of the MJCCloser

closeApplication

public void closeApplication()
This method closes the client side application.
Specified by:
closeApplication in interface MJCCloser

setWindow

public void setWindow(MJCWindow window)
Sets the MJCWindow that represents the user interface of the client side.
Specified by:
setWindow in interface MJCCloser
Parameters:
MJCWindow - window: the MJCWindow that represents the user interface of the client side

setReconfigureable

public void setReconfigureable(MJCConfigureable[] r)