openr66.context
Class R66Session

java.lang.Object
  extended by openr66.context.R66Session
All Implemented Interfaces:
goldengate.common.file.SessionInterface

public class R66Session
extends Object
implements goldengate.common.file.SessionInterface

The global object session in OpenR66, a session by local channel

Author:
frederic bregier

Constructor Summary
R66Session()
          Create the session
 
Method Summary
 void clear()
           
 R66Auth getAuth()
           
 int getBlockSize()
           
 R66BusinessInterface getBusinessObject()
           
 R66Dir getDir()
           
 boolean getExtendedProtocol()
           
 R66File getFile()
           
 goldengate.common.file.filesystembased.FilesystemBasedFileParameterImpl getFileParameter()
           
 SocketAddress getLocalAddress()
           
 LocalChannelReference getLocalChannelReference()
           
 SocketAddress getRemoteAddress()
           
 R66Restart getRestart()
           
 DbTaskRunner getRunner()
           
 String getUniqueExtension()
           
 boolean isAuthenticated()
           
 boolean isReady()
           
 void newState(R66FiniteDualStates desiredstate)
          Propose a new State
 void renameReceiverFile(String newFilename)
          Rename the current receive file from the very beginning since the sender has a post action that changes its name
 void setBadRunner(DbTaskRunner runner, ErrorCode code)
          To be used when a request comes with a bad code so it cannot be set normally
 void setBlockSize(int blocksize)
           
 void setBusinessObject(R66BusinessInterface businessObject)
           
 void setFileAfterPreRunner(boolean createFile)
          Set the File from the runner once PRE operation are done
 void setFileBeforePreRunner()
          Set the File from the runner before PRE operation are done
 void setFinalizeTransfer(boolean status, R66Result finalValue)
          Finalize the transfer step by running the error or post operation according to the status.
 void setLocalChannelReference(LocalChannelReference localChannelReference)
           
 void setNoSessionRunner(DbTaskRunner runner, LocalChannelReference localChannelReference)
          To be called in case of No Session not from a valid LocalChannelHandler
 void setReady(boolean isReady)
           
 void setRunner(DbTaskRunner runner)
          Set the runner, START from the PreTask if necessary, and prepare the file
 void setStatus(int stat)
          Debugging purpose
 String toString()
           
 void tryFinalizeRequest(R66Result errorValue)
          Try to finalize the request if possible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

R66Session

public R66Session()
Create the session

Method Detail

getExtendedProtocol

public boolean getExtendedProtocol()
Returns:
extendedProtocol

getBusinessObject

public R66BusinessInterface getBusinessObject()
Returns:
the businessObject

setBusinessObject

public void setBusinessObject(R66BusinessInterface businessObject)
Parameters:
businessObject - the businessObject to set

newState

public void newState(R66FiniteDualStates desiredstate)
Propose a new State

Parameters:
desiredstate -
Throws:
goldengate.common.exception.IllegalFiniteStateException - if the new status if not ok

setStatus

public void setStatus(int stat)
Debugging purpose

Parameters:
stat -

clear

public void clear()
Specified by:
clear in interface goldengate.common.file.SessionInterface

getAuth

public R66Auth getAuth()
Specified by:
getAuth in interface goldengate.common.file.SessionInterface

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface goldengate.common.file.SessionInterface

setBlockSize

public void setBlockSize(int blocksize)
Parameters:
blocksize - the blocksize to set

getDir

public R66Dir getDir()
Specified by:
getDir in interface goldengate.common.file.SessionInterface

getFileParameter

public goldengate.common.file.filesystembased.FilesystemBasedFileParameterImpl getFileParameter()
Specified by:
getFileParameter in interface goldengate.common.file.SessionInterface

getRestart

public R66Restart getRestart()
Specified by:
getRestart in interface goldengate.common.file.SessionInterface

isAuthenticated

public boolean isAuthenticated()
Returns:
True if the connection is currently authenticated

isReady

public boolean isReady()
Returns:
True if the Channel is ready to accept transfer

setReady

public void setReady(boolean isReady)
Parameters:
isReady - the isReady for transfer to set

getRunner

public DbTaskRunner getRunner()
Returns:
the runner

setLocalChannelReference

public void setLocalChannelReference(LocalChannelReference localChannelReference)
Parameters:
localChannelReference - the localChannelReference to set

getRemoteAddress

public SocketAddress getRemoteAddress()
Returns:
the remote SocketAddress

getLocalAddress

public SocketAddress getLocalAddress()
Returns:
the local SocketAddress

getLocalChannelReference

public LocalChannelReference getLocalChannelReference()
Returns:
the localChannelReference

setNoSessionRunner

public void setNoSessionRunner(DbTaskRunner runner,
                               LocalChannelReference localChannelReference)
To be called in case of No Session not from a valid LocalChannelHandler

Parameters:
runner -
localChannelReference -

setFileBeforePreRunner

public void setFileBeforePreRunner()
                            throws OpenR66RunnerErrorException
Set the File from the runner before PRE operation are done

Throws:
OpenR66RunnerErrorException

setFileAfterPreRunner

public void setFileAfterPreRunner(boolean createFile)
                           throws OpenR66RunnerErrorException
Set the File from the runner once PRE operation are done

Parameters:
createFile - When True, the file can be newly created if needed. If False, no new file will be created, thus having an Exception.
Throws:
OpenR66RunnerErrorException

setBadRunner

public void setBadRunner(DbTaskRunner runner,
                         ErrorCode code)
To be used when a request comes with a bad code so it cannot be set normally

Parameters:
runner -
code -

setRunner

public void setRunner(DbTaskRunner runner)
               throws OpenR66RunnerErrorException
Set the runner, START from the PreTask if necessary, and prepare the file

Parameters:
runner - the runner to set
Throws:
OpenR66RunnerErrorException

renameReceiverFile

public void renameReceiverFile(String newFilename)
                        throws OpenR66RunnerErrorException
Rename the current receive file from the very beginning since the sender has a post action that changes its name

Parameters:
newFilename -
Throws:
OpenR66RunnerErrorException

setFinalizeTransfer

public void setFinalizeTransfer(boolean status,
                                R66Result finalValue)
                         throws OpenR66RunnerErrorException,
                                OpenR66ProtocolSystemException
Finalize the transfer step by running the error or post operation according to the status.

Parameters:
status -
finalValue -
Throws:
OpenR66RunnerErrorException
OpenR66ProtocolSystemException

tryFinalizeRequest

public void tryFinalizeRequest(R66Result errorValue)
                        throws OpenR66RunnerErrorException,
                               OpenR66ProtocolSystemException
Try to finalize the request if possible

Parameters:
errorValue -
Throws:
OpenR66RunnerErrorException
OpenR66ProtocolSystemException

getFile

public R66File getFile()
Returns:
the file

toString

public String toString()
Overrides:
toString in class Object

getUniqueExtension

public String getUniqueExtension()
Specified by:
getUniqueExtension in interface goldengate.common.file.SessionInterface


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