com.fuse.net
Class FUSEClientConnection

java.lang.Object
  extended by java.lang.Thread
      extended by com.fuse.net.FUSEClientConnection
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
FUSELightConnection

public class FUSEClientConnection
extends java.lang.Thread

Handles the data connection between client and fuseserver for an user. NOTE: From FUSE Light lots of functionality of this class has been removed and moved to com.fuse.projects.fuse_light.net.FUSELightConnection


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  Access accessLogEntry
           
protected  java.net.Socket client
           
protected  java.lang.String clientIp
           
protected  boolean dead
           
protected  long dieTime
           
protected  FUSEConnectionManager fcm
           
protected  boolean gotOk
           
protected  int id
           
protected  java.io.DataInputStream in
           
protected  long lastMessage
           
protected  java.lang.String myKey
           
protected static int n
           
protected  java.io.PrintWriter out
           
protected  FUSEUser user
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FUSEClientConnection(FUSEConnectionManager fcm)
           
 
Method Summary
protected  void generateError(int errorCode, java.lang.String message)
           
protected  void generateOk()
           
 java.lang.String getClientIp()
          Returns the ip of this connection as String
 int getId()
           
protected  long getLastConnectionTime()
          Called by connectionManager to check whether the connection should be timeouted
 FUSEUser getUser()
          Returns the user of this connectino
 java.lang.String getUserInfoString()
          Construct fuse-protocol representation of the user to send to the client
 void handleClientMessage(java.lang.String msg)
           
 void processFuseMessage(java.lang.String type, java.lang.String data)
          Processes and sends a fuse message to the client: # @type \r data\r##
protected  boolean projectSpecificCommand(java.lang.String command, java.lang.String msg)
          Override this if you want to handle some different "non-action" messages in your project.
 void release()
          Kills this connection (throws user out)
protected  void releaseConnection()
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id

client

protected java.net.Socket client

myKey

protected java.lang.String myKey

dead

protected boolean dead

accessLogEntry

protected Access accessLogEntry

in

protected java.io.DataInputStream in

out

protected java.io.PrintWriter out

fcm

protected FUSEConnectionManager fcm

lastMessage

protected long lastMessage

dieTime

protected long dieTime

user

protected FUSEUser user

clientIp

protected java.lang.String clientIp

gotOk

protected boolean gotOk

n

protected static int n
Constructor Detail

FUSEClientConnection

public FUSEClientConnection(FUSEConnectionManager fcm)
Method Detail

getId

public int getId()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getLastConnectionTime

protected long getLastConnectionTime()
Called by connectionManager to check whether the connection should be timeouted


getClientIp

public java.lang.String getClientIp()
Returns the ip of this connection as String


release

public void release()
Kills this connection (throws user out)


releaseConnection

protected void releaseConnection()

processFuseMessage

public void processFuseMessage(java.lang.String type,
                               java.lang.String data)
Processes and sends a fuse message to the client: # @type \r data\r##


handleClientMessage

public void handleClientMessage(java.lang.String msg)

projectSpecificCommand

protected boolean projectSpecificCommand(java.lang.String command,
                                         java.lang.String msg)
                                  throws java.lang.Exception
Override this if you want to handle some different "non-action" messages in your project. Return true if you did handle the message, false otherwise

Throws:
java.lang.Exception

getUser

public FUSEUser getUser()
Returns the user of this connectino


getUserInfoString

public java.lang.String getUserInfoString()
Construct fuse-protocol representation of the user to send to the client


generateOk

protected void generateOk()

generateError

protected void generateError(int errorCode,
                             java.lang.String message)