|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limitless.nmc.Client.MuckConnection
public class MuckConnection
This class handles the networking for an NMC (or FB/TinyMUCK) based MUCK. In particular, it knows how to manage the OUTPUTPREFIX and OUTPUTSUFFIX commands, and the login protocols.
| Nested Class Summary | |
|---|---|
static class |
MuckConnection.Factory
This factory creates MuckConnections on demand given only a MuLoginDescription. |
private static class |
MuckConnection.Marker
|
private static class |
MuckConnection.TestListener
|
| Field Summary | |
|---|---|
private boolean |
connectionDone
if this is false, sends will fail. |
private MuckConnection.Marker |
EmptyMarker
|
private GeneralEventSource |
eventSource
|
private NMCStringDataSource |
fromMuck
|
private boolean |
hasLoggedInAtLeastOnce
|
private NMCStringDataSource.Factory |
inputFactory
|
(package private) static org.apache.log4j.Logger |
logger
Log4J Logger |
private MuLoginDescription |
loginDetails
|
private MuLogin |
loginObject
|
private java.util.LinkedList |
markers
|
private NMCStringDataDestination.Factory |
outputFactory
|
private java.net.Socket |
rawConnection
|
private boolean |
shutdownHasCompleted
|
private boolean |
shutdownRequested
|
private NMCStringDataDestination |
toMuck
|
private UriIdentifier |
uri
|
| Constructor Summary | |
|---|---|
MuckConnection(MuLoginDescription loginDescription)
|
|
| Method Summary | |
|---|---|
private void |
addMarker(MuckConnection.Marker marker)
|
void |
addMuLineListener(MuLineEvent.Listener aListener)
|
private void |
connect()
This tries to connect, and updates flags on success/failure since it's used in the asynch parts. |
private void |
connectionLost()
This is reached when the connection that _was_ established is lost. |
private void |
discardMarker()
|
boolean |
equals(java.lang.Object o)
Two MuckConnections are equal if their cached addresses are equal and their loginDetails are equal. |
private MuckConnection.Marker |
getMarker()
|
UriIdentifier |
getMuURI()
Call this to get a URI for this MU, without any of the username/password details (which allows this to be safely called by an object that has no "need to know" of any security data). |
int |
hashCode()
Defer hashCode calculation to the login details. |
boolean |
isConnected()
Call this to determine if the connection will send more messages in the future. |
boolean |
isShutdownDone()
Call this to test if the object's background threading has finished. |
boolean |
isValid()
Call this to check if the connection attempt has ever succeeded. |
static void |
main(java.lang.String[] args)
|
private void |
notifyConnection()
|
private void |
notifyDroppedMarkers()
|
void |
removeMuLineListener(MuLineEvent.Listener aListener)
|
void |
run()
|
private void |
sendDataWithMarkers(java.lang.String command)
|
boolean |
sendTextToMu(java.lang.String dataToSend)
Call this to send a command into the MUCK. |
void |
shutdown()
Call this when done with this connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.log4j.Logger logger
private boolean connectionDone
private boolean shutdownRequested
private boolean shutdownHasCompleted
private java.net.Socket rawConnection
private MuLogin loginObject
private MuLoginDescription loginDetails
private GeneralEventSource eventSource
private boolean hasLoggedInAtLeastOnce
private UriIdentifier uri
private NMCStringDataSource.Factory inputFactory
private NMCStringDataDestination.Factory outputFactory
private NMCStringDataSource fromMuck
private NMCStringDataDestination toMuck
private java.util.LinkedList markers
private MuckConnection.Marker EmptyMarker
| Constructor Detail |
|---|
public MuckConnection(MuLoginDescription loginDescription)
throws java.net.UnknownHostException
java.net.UnknownHostException| Method Detail |
|---|
public void shutdown()
shutdown in interface MuLineEvent.Sourcepublic boolean isShutdownDone()
isShutdownDone in interface MuLineEvent.Sourcepublic boolean isConnected()
isConnected in interface MuLineEvent.Sourcepublic boolean isValid()
isValid in interface MuLineEvent.Source
public UriIdentifier getMuURI()
throws java.net.MalformedURLException
getMuURI in interface MuLineEvent.Sourcejava.net.MalformedURLExceptionpublic boolean sendTextToMu(java.lang.String dataToSend)
sendTextToMu in interface MuLineEvent.Sourceprivate void connectionLost()
private void connect()
private void notifyDroppedMarkers()
private void notifyConnection()
private void sendDataWithMarkers(java.lang.String command)
throws NMCException
NMCExceptionpublic void run()
run in interface java.lang.Runnableprivate MuckConnection.Marker getMarker()
private void discardMarker()
private void addMarker(MuckConnection.Marker marker)
public void addMuLineListener(MuLineEvent.Listener aListener)
addMuLineListener in interface MuLineEvent.Sourcepublic void removeMuLineListener(MuLineEvent.Listener aListener)
removeMuLineListener in interface MuLineEvent.Sourcepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||