openlsd.network.server
Class LSDServerSession

java.lang.Object
  extended by openlsd.network.common.message.LSDMinimalSession
      extended by openlsd.network.server.LSDServerSession

public class LSDServerSession
extends LSDMinimalSession

Class for the session stored in server context.

Author:
Frederic Bregier LGPL

Field Summary
protected  com.twmacinta.util.MD5 md5
          The md5 associated with the server session
protected  boolean wasException
          Was this session in exception ?
protected  boolean wasIdle
          Was this session Idle ?
 
Fields inherited from class openlsd.network.common.message.LSDMinimalSession
commande, doc, fileblocksize, filesize, isClosed, legacy, object, rankblock, running, session, status, storage, unique
 
Constructor Summary
LSDServerSession(org.apache.mina.common.IoSession session)
          Create a LSDServerSession as empty session from a session
LSDServerSession(org.apache.mina.common.IoSession session, byte commande, boolean unique, long legacy, long storage, long doc, byte status, int fileblocksize, int rankblock)
          Create a LSDServerSession from args but not make it running
 
Method Summary
static LSDServerSession assign(LSDServerSession ls, org.apache.mina.common.IoSession session, byte commande, boolean unique, long legacy, long storage, long doc)
          Set a new session from previous alloacted object from params if object already exists, else same as new LSDServerSession(...)
 void clear()
          Clear the session and make it not running but do not eraze session information neither close the session.
 boolean isClosed()
          Returns True if the session is closed
 boolean sessionStart()
          Start the session
 void sessionStop()
          Stop the session.
 void sessionStopNoClose()
          Stop the session but not close the connection (client will do first).
protected  void sessionTaskClose()
          Task for ending one true session
 java.lang.String toString()
           
 
Methods inherited from class openlsd.network.common.message.LSDMinimalSession
clearObject, endedAllBlocks, endNewBlock, getObject, isRunning, sessionFinished, setObject, waitForAllBlocks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

md5

protected com.twmacinta.util.MD5 md5
The md5 associated with the server session


wasIdle

protected boolean wasIdle
Was this session Idle ?


wasException

protected boolean wasException
Was this session in exception ?

Constructor Detail

LSDServerSession

public LSDServerSession(org.apache.mina.common.IoSession session)
Create a LSDServerSession as empty session from a session

Parameters:
session -

LSDServerSession

public LSDServerSession(org.apache.mina.common.IoSession session,
                        byte commande,
                        boolean unique,
                        long legacy,
                        long storage,
                        long doc,
                        byte status,
                        int fileblocksize,
                        int rankblock)
Create a LSDServerSession from args but not make it running

Parameters:
session - the IoSession associated
commande - the commande
unique - set if this commande close the session at the end or not
legacy - the lid
storage - the sid
doc - the did
status - the current status
fileblocksize - the fileblock size
rankblock - the rank of the current block
Method Detail

sessionStop

public void sessionStop()
Stop the session.

Overrides:
sessionStop in class LSDMinimalSession

sessionStopNoClose

public void sessionStopNoClose()
Stop the session but not close the connection (client will do first).


sessionTaskClose

protected void sessionTaskClose()
Task for ending one true session


sessionStart

public boolean sessionStart()
Start the session

Overrides:
sessionStart in class LSDMinimalSession
Returns:
True if O

isClosed

public boolean isClosed()
Returns True if the session is closed

Overrides:
isClosed in class LSDMinimalSession
Returns:
if the session is closed

assign

public static LSDServerSession assign(LSDServerSession ls,
                                      org.apache.mina.common.IoSession session,
                                      byte commande,
                                      boolean unique,
                                      long legacy,
                                      long storage,
                                      long doc)
Set a new session from previous alloacted object from params if object already exists, else same as new LSDServerSession(...) except that it starts the session (sessionStart) if it is possible, if not it stops the session (sessionStop).

Parameters:
ls -
session -
commande -
unique -
legacy -
storage -
doc -
Returns:
the same object reinitialized or a new one if ls was null or null if the session is closed.

clear

public void clear()
Clear the session and make it not running but do not eraze session information neither close the session. This function make ready the object for a new action.

Overrides:
clear in class LSDMinimalSession

toString

public java.lang.String toString()
Overrides:
toString in class LSDMinimalSession
See Also:
Object.toString()