openlsd.network.client.put
Class LSDClientPutSessionHandler

java.lang.Object
  extended by org.apache.mina.common.IoHandlerAdapter
      extended by openlsd.network.client.common.LSDClientCommonSessionHandler
          extended by openlsd.network.client.put.LSDClientPutSessionHandler
All Implemented Interfaces:
org.apache.mina.common.IoHandler
Direct Known Subclasses:
LSDPoolClientPutSessionHandler

public class LSDClientPutSessionHandler
extends LSDClientCommonSessionHandler

This LSDClientPutSessionHandler is the main class for the client part (put). This class can be extended to adjust specific needs for application interface (messageNewBlock).

Author:
Frederic Bregier LGPL

Constructor Summary
LSDClientPutSessionHandler()
           
 
Method Summary
protected  boolean messageClear(org.apache.mina.common.IoSession session, java.lang.Object arg1)
          Clear the message sent from memory.
protected  byte[] messageNewBlock(org.apache.mina.common.IoSession session, LSDClientSession ls)
          This function by default gets the next block of bytes from the array of byte or from the FileChannel.
protected  void messagePut(org.apache.mina.common.IoSession session, LSDMsgAnswear lma)
          This function is protected and call the public function messageNewBlock. messageNewBlock can be extended so that it can be associated with the application logic.
protected  void messageRun(org.apache.mina.common.IoSession session, LSDMsgAnswear lma)
          When a message is received, call the messagePut according to the kind of message.
 
Methods inherited from class openlsd.network.client.common.LSDClientCommonSessionHandler
exceptionCaught, messageReceived, messageSent, sessionClosed, sessionFinished, sessionIdle
 
Methods inherited from class org.apache.mina.common.IoHandlerAdapter
sessionCreated, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSDClientPutSessionHandler

public LSDClientPutSessionHandler()
Method Detail

messageRun

protected void messageRun(org.apache.mina.common.IoSession session,
                          LSDMsgAnswear lma)
When a message is received, call the messagePut according to the kind of message.

Specified by:
messageRun in class LSDClientCommonSessionHandler
lma - Message from server
See Also:
LSDClientCommonSessionHandler.messageRun(org.apache.mina.common.IoSession, openlsd.network.common.message.LSDMsgAnswear)

messagePut

protected void messagePut(org.apache.mina.common.IoSession session,
                          LSDMsgAnswear lma)
This function is protected and call the public function messageNewBlock. messageNewBlock can be extended so that it can be associated with the application logic. This function calls the messageNewBlock to send the next block. If the call is in NoAck mode, then it sends all blocks in sequence without waiting the answear from the server, except the last message. If this is the last message, release the global lock of this data access.

Parameters:
session -
lma -

messageNewBlock

protected byte[] messageNewBlock(org.apache.mina.common.IoSession session,
                                 LSDClientSession ls)
This function by default gets the next block of bytes from the array of byte or from the FileChannel. This function should be extended if the application needs to make something by block (example http put).

Parameters:
session -
ls -
Returns:
the array of byte of the block

messageClear

protected boolean messageClear(org.apache.mina.common.IoSession session,
                               java.lang.Object arg1)
Clear the message sent from memory.

Specified by:
messageClear in class LSDClientCommonSessionHandler
Returns:
True if the message is correctly found, else False.
See Also:
LSDClientCommonSessionHandler.messageClear(org.apache.mina.common.IoSession, java.lang.Object)