com.monica.javacom.protocol
Class MJCTelnetProtocol

java.lang.Object
  |
  +--com.monica.javacom.protocol.MJCTelnetProtocol
All Implemented Interfaces:
MJCConfigureable, MJCProtocol, MJCReadable, MJCReader, MJCWriteable, MJCWriter

public class MJCTelnetProtocol
extends java.lang.Object
implements MJCProtocol

Implements TELNET protocol functionality in the MJC layer hierarchy. See the TELNET description in RFC 854. This class does currently implement the following TELNET commands/functionality:

Writing in this class is not buffered, but reading is buffered.

configureable values


Constructor Summary
MJCTelnetProtocol()
          Contstructor
 
Method Summary
 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.
 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.
 java.lang.String getProtocolName()
          Returns the MJC name of the MJCProtocol.
 java.lang.String getProtocolVersion()
          Returns the MJC version of the MJCProtocol.
 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 send(java.lang.String s)
          Send a string through the Telnet protocol
 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 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

MJCTelnetProtocol

public MJCTelnetProtocol()
Contstructor
Method Detail

getProtocolName

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

getProtocolVersion

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

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

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

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

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

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

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

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

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

send

public void send(java.lang.String s)
Send a string through the Telnet protocol
Parameters:
String - s: the String to be sent through the Telnet protocol