openlsd.multiple.ophandler.extension
Class LSDPoolClientPut

java.lang.Object
  extended by openlsd.network.client.common.LSDClientCommon
      extended by openlsd.network.client.put.LSDClientPut
          extended by openlsd.multiple.ophandler.extension.LSDPoolClientPut

public class LSDPoolClientPut
extends LSDClientPut

Class of a connection in Pool mode Put

Author:
Frederic BREGIER LGPL 2007

Field Summary
 boolean isForward
          Is in Forward mode (Get->Put)
 
Fields inherited from class openlsd.network.client.put.LSDClientPut
md5, size
 
Fields inherited from class openlsd.network.client.common.LSDClientCommon
clientCompressed, connector, executorChainService, hostname, idip, ls, lscsh, poolConnection, serverCompressed, serverPort, session
 
Constructor Summary
LSDPoolClientPut(LSDClientPutSessionHandler lscshext, java.lang.String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, LSDPoolConnection poolConnection)
           
LSDPoolClientPut(LSDClientPutSessionHandler lscshext, java.lang.String Hostname, int ServerPort, boolean immediate, LSDPoolConnection poolConnection)
           
LSDPoolClientPut(java.lang.String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, LSDPoolConnection poolConnection)
           
LSDPoolClientPut(java.lang.String Hostname, int ServerPort, boolean immediate, LSDPoolConnection poolConnection)
           
 
Method Summary
 void close()
          Will close the current session and finalize the Client.
protected  LSDClientCommonSessionHandler createSessionHandler()
          Create a SessionHandler.
 int finalizeForward()
          Ask to finalize to put one file identified by the triple legacy, storage and document.
 int prepareForward(boolean unique, long legacy, long storage, long document)
          Ask to prepare to put one file identified by the triple legacy, storage and document.
 int prepareNoAckForward(boolean unique, long legacy, long storage, long document)
          Ask to prepare to put one file identified by the triple legacy, storage and document.
 boolean writeForward(byte[] bytes)
          WriteForward of one block from a sequence such as Get->Forward.
 
Methods inherited from class openlsd.network.client.put.LSDClientPut
putDataFromObject, putFile, putNoAckDataFromObject
 
Methods inherited from class openlsd.network.client.common.LSDClientCommon
clear, clearObject, connect, connectionJoin, endClient, endClient, executorsClose, getObject, getStatus, initClient, initShared, isConnected, isSessionOK, lock, realClose, sessionReconnect, setObject, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isForward

public boolean isForward
Is in Forward mode (Get->Put)

Constructor Detail

LSDPoolClientPut

public LSDPoolClientPut(LSDClientPutSessionHandler lscshext,
                        java.lang.String Hostname,
                        int ServerPort,
                        boolean immediate,
                        LSDPoolConnection poolConnection)
Parameters:
lscshext -
Hostname -
ServerPort -
immediate -
poolConnection -

LSDPoolClientPut

public LSDPoolClientPut(java.lang.String Hostname,
                        int ServerPort,
                        boolean immediate,
                        LSDPoolConnection poolConnection)
Parameters:
Hostname -
ServerPort -
immediate -
poolConnection -

LSDPoolClientPut

public LSDPoolClientPut(LSDClientPutSessionHandler lscshext,
                        java.lang.String Hostname,
                        int ServerPort,
                        boolean ServerCompressed,
                        boolean ClientCompressed,
                        boolean immediate,
                        LSDPoolConnection poolConnection)
Parameters:
lscshext -
Hostname -
ServerPort -
ServerCompressed -
ClientCompressed -
immediate -
poolConnection -

LSDPoolClientPut

public LSDPoolClientPut(java.lang.String Hostname,
                        int ServerPort,
                        boolean ServerCompressed,
                        boolean ClientCompressed,
                        boolean immediate,
                        LSDPoolConnection poolConnection)
Parameters:
Hostname -
ServerPort -
ServerCompressed -
ClientCompressed -
immediate -
poolConnection -
Method Detail

createSessionHandler

protected LSDClientCommonSessionHandler createSessionHandler()
Create a SessionHandler. This function is rewritten to extend the original.

Overrides:
createSessionHandler in class LSDClientPut
Returns:
a new SessionHandler

close

public void close()
Will close the current session and finalize the Client. Reconnection is still possible.

Overrides:
close in class LSDClientCommon

prepareForward

public int prepareForward(boolean unique,
                          long legacy,
                          long storage,
                          long document)
Ask to prepare to put one file identified by the triple legacy, storage and document. Will put the result from the object of Get which implies an extend of LSDClientPutSessionHandler with a new implementation of messageNewBlock. The boolean unique set if the get should close the connection after the full send (true), or not (false). This function uses acknowledge of each block..

Parameters:
unique -
legacy -
storage -
document -
Returns:
the status (>=0) for OK, (<0) for KO

prepareNoAckForward

public int prepareNoAckForward(boolean unique,
                               long legacy,
                               long storage,
                               long document)
Ask to prepare to put one file identified by the triple legacy, storage and document. Will put the result from the object of Get which implies an extend of LSDClientPutSessionHandler with a new implementation of messageNewBlock. The boolean unique set if the get should close the connection after the full send (true), or not (false). This function uses no acknowledge for each block (quicker).

Parameters:
unique -
legacy -
storage -
document -
Returns:
the status (>=0) for OK, (<0) for KO

finalizeForward

public int finalizeForward()
Ask to finalize to put one file identified by the triple legacy, storage and document. Will end when the put of object of Get is complete. At the end, object contains the MD5 in String and the file size.

Returns:
the status (>=0) for OK, (<0) for KO

writeForward

public boolean writeForward(byte[] bytes)
WriteForward of one block from a sequence such as Get->Forward.

Parameters:
bytes -
Returns:
True if this write is OK, else False.