org.limitless.nmc.Client
Class MuConnector

java.lang.Object
  extended by org.limitless.util.GeneralAnnotation
      extended by org.limitless.nmc.Client.MuConnector
All Implemented Interfaces:
java.util.EventListener, MessageEvent.Source, MuLineEvent.Listener, Annotation

public class MuConnector
extends GeneralAnnotation
implements MessageEvent.Source, MuLineEvent.Listener

This class provides an event-source and sink for MU connections. It is used to hide details of any _particular_ flavor of text-based VR system. It feeds us MessageEvents, which include responses to commands as well as unsolicited IO.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.limitless.util.Annotation
Annotation.AnnotationNotFoundException
 
Field Summary
private  java.util.LinkedList assemblyBuffer
           
private  GeneralEventSource eventSource
           
(package private)  MuLineEvent.Source muConnection
           
 
Constructor Summary
MuConnector(MuLineEvent.Source source)
           
 
Method Summary
 void addMessageListener(MessageEvent.Listener aListener)
           
private  void deliverDiscardedMessage(MessageEvent event)
          This fulfills the "Deliver Discarded Message" contract.
private  void deliverMessage(MessageEvent messageIn)
          This fulfills the "Deliver message to each listener" contract.
private  void deliverStatusMessage(MessageEvent event)
           
 boolean equals(java.lang.Object o)
           
 UriIdentifier getMuURI()
           
 int hashCode()
           
 void processConnect(MuLineEvent theEvent)
          This is called when a connection is established to a MU
 void processDisconnect(MuLineEvent theEvent)
          This is called when a connection is lost to the MU
 void processLoginFails(MuLineEvent theEvent)
          This event occurs when a login fails
 void processPrefixLine(MuLineEvent theEvent)
          This is a prefix line from the MU
 void processReset(MuLineEvent theEvent)
          This is a command that was requested but not sent and therefore will never have data returned from it.
 void processShutdownOfSource(MuLineEvent theEvent)
          This happens when a shutdown() occurs and no further messages will follow.
 void processSuffixLine(MuLineEvent theEvent)
          This is a suffix line from the MU.
 void processTextLine(MuLineEvent theEvent)
          This is given a line of text from the MU that is not a suffix or prefix.
 void removeMessageListener(MessageEvent.Listener aListener)
           
 boolean sendRequestToMU(java.lang.String request)
          This sends a single command to a MU and returns false if the command couldn't be delivered.
 void shutdown()
           
 
Methods inherited from class org.limitless.util.GeneralAnnotation
getAnnotation, removeAnnotation, setAnnotation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.limitless.util.Annotation
getAnnotation, removeAnnotation, setAnnotation
 

Field Detail

muConnection

MuLineEvent.Source muConnection

assemblyBuffer

private java.util.LinkedList assemblyBuffer

eventSource

private GeneralEventSource eventSource
Constructor Detail

MuConnector

public MuConnector(MuLineEvent.Source source)
Method Detail

shutdown

public void shutdown()
Specified by:
shutdown in interface MessageEvent.Source

processLoginFails

public void processLoginFails(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This event occurs when a login fails

Specified by:
processLoginFails in interface MuLineEvent.Listener

processShutdownOfSource

public void processShutdownOfSource(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This happens when a shutdown() occurs and no further messages will follow. This is always the LAST message.

Specified by:
processShutdownOfSource in interface MuLineEvent.Listener

processTextLine

public void processTextLine(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This is given a line of text from the MU that is not a suffix or prefix.

Specified by:
processTextLine in interface MuLineEvent.Listener

processConnect

public void processConnect(MuLineEvent theEvent)
This is called when a connection is established to a MU

Specified by:
processConnect in interface MuLineEvent.Listener

processDisconnect

public void processDisconnect(MuLineEvent theEvent)
This is called when a connection is lost to the MU

Specified by:
processDisconnect in interface MuLineEvent.Listener

processPrefixLine

public void processPrefixLine(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This is a prefix line from the MU

Specified by:
processPrefixLine in interface MuLineEvent.Listener

processSuffixLine

public void processSuffixLine(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This is a suffix line from the MU.

Specified by:
processSuffixLine in interface MuLineEvent.Listener

processReset

public void processReset(MuLineEvent theEvent)
Description copied from interface: MuLineEvent.Listener
This is a command that was requested but not sent and therefore will never have data returned from it. This is caused primarily by a lost MU connection

Specified by:
processReset in interface MuLineEvent.Listener

sendRequestToMU

public boolean sendRequestToMU(java.lang.String request)
Description copied from interface: MessageEvent.Source
This sends a single command to a MU and returns false if the command couldn't be delivered.

Specified by:
sendRequestToMU in interface MessageEvent.Source

addMessageListener

public void addMessageListener(MessageEvent.Listener aListener)
Specified by:
addMessageListener in interface MessageEvent.Source

removeMessageListener

public void removeMessageListener(MessageEvent.Listener aListener)
Specified by:
removeMessageListener in interface MessageEvent.Source

getMuURI

public UriIdentifier getMuURI()
                       throws java.net.MalformedURLException
Specified by:
getMuURI in interface MessageEvent.Source
Throws:
java.net.MalformedURLException

deliverMessage

private void deliverMessage(MessageEvent messageIn)
This fulfills the "Deliver message to each listener" contract.


deliverDiscardedMessage

private void deliverDiscardedMessage(MessageEvent event)
This fulfills the "Deliver Discarded Message" contract.


deliverStatusMessage

private void deliverStatusMessage(MessageEvent event)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 1995, 2004 Limitless Knowledge Association, All Rights Reserved.