openr66.protocol.test
Class TestSendThroughForward

java.lang.Object
  extended by openr66.client.AbstractTransfer
      extended by openr66.client.SendThroughClient
          extended by openr66.protocol.test.TestSendThroughForward
All Implemented Interfaces:
Runnable

public class TestSendThroughForward
extends SendThroughClient

WARNING: This class is not functional neither integrated
Test class for Send Through to another R66 Server as forward
Only a subpart of SenThroughClient is to be made since steps 1-2 and steps 7-8 are only for client, not for server. 3) Prepare the request of transfer:
R66Future futureReq = new R66Future(true);
TestSendThroughForward transaction = new TestSendThroughForward(futureReq,...);
if (! transaction.initiateRequest()) { error }

4) Once initiateRequest() gives true, you are ready to send the data in through mode using the TestRecvThroughForwardHandler:

5) Once you have finished, so this is the last block, you have to do the following:
If the last block is not empty:
DataBlock block = transaction.transformToDataBlock(data);
block.setEOF(true);
futureWrite = transaction.writeWhenPossible(block);
futureWrite.awaitUninterruptibly();

If the last block is empty, it is already handled by TestRecvThroughForwardHandler

6) If everything is in success:
transaction.finalizeRequest();

And now wait for the transfer to finish:
futureReq.awaitUninterruptibly();
R66Result result = futureReq.getResult();

Author:
Frederic Bregier

Nested Class Summary
static class TestSendThroughForward.TestRecvThroughForwardHandler
           
 
Field Summary
 goldengate.common.database.DbSession dbSession
           
 boolean foundEOF
           
 TestSendThroughForward.TestRecvThroughForwardHandler handler
           
protected  DbTaskRunner sourceRunner
           
 
Fields inherited from class openr66.client.SendThroughClient
localChannelReference, networkTransaction, taskRunner
 
Fields inherited from class openr66.client.AbstractTransfer
block, blocksize, dateFormat, fileinfo, fileInfo, filename, future, id, idt, ismd5, isMD5, localFilename, logger, nolog, remoteHost, rhost, rule, rulename, startTime, ttimestart
 
Constructor Summary
TestSendThroughForward(R66Future future, String remoteHost, String filename, String rulename, String fileinfo, boolean isMD5, int blocksize, NetworkTransaction networkTransaction, long idt, goldengate.common.database.DbSession dbSession, DbTaskRunner runner)
           
 
Method Summary
 void finalizeRequest()
          Finalize the request
 boolean initiateRequest()
          Prior to call this method, the pipeline and NetworkTransaction must have been initialized.
 void transferInError(OpenR66Exception e)
          To be used in case of error after a correct initiate of the request
 
Methods inherited from class openr66.client.SendThroughClient
run, transformToDataBlock, writeWhenPossible
 
Methods inherited from class openr66.client.AbstractTransfer
getParams, initRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

public TestSendThroughForward.TestRecvThroughForwardHandler handler

dbSession

public goldengate.common.database.DbSession dbSession

foundEOF

public volatile boolean foundEOF

sourceRunner

protected DbTaskRunner sourceRunner
Constructor Detail

TestSendThroughForward

public TestSendThroughForward(R66Future future,
                              String remoteHost,
                              String filename,
                              String rulename,
                              String fileinfo,
                              boolean isMD5,
                              int blocksize,
                              NetworkTransaction networkTransaction,
                              long idt,
                              goldengate.common.database.DbSession dbSession,
                              DbTaskRunner runner)
Parameters:
future -
remoteHost -
filename -
rulename -
fileinfo -
isMD5 -
blocksize -
networkTransaction -
idt - Id Transfer if any temptative already exists
dbSession -
runner - (recv runner)
Method Detail

initiateRequest

public boolean initiateRequest()
Description copied from class: SendThroughClient
Prior to call this method, the pipeline and NetworkTransaction must have been initialized. It is the responsibility of the caller to finish all network resources. Note that this is only the first part of the execution for this client.

Overrides:
initiateRequest in class SendThroughClient
Returns:
True if the initiate of the request is OK, else False

finalizeRequest

public void finalizeRequest()
Description copied from class: SendThroughClient
Finalize the request

Overrides:
finalizeRequest in class SendThroughClient

transferInError

public void transferInError(OpenR66Exception e)
Description copied from class: SendThroughClient
To be used in case of error after a correct initiate of the request

Overrides:
transferInError in class SendThroughClient


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.