goldengate.ftp.core.data.handler
Class DataNetworkHandler

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelHandler
      extended by goldengate.ftp.core.data.handler.DataNetworkHandler
All Implemented Interfaces:
org.jboss.netty.channel.ChannelDownstreamHandler, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class DataNetworkHandler
extends org.jboss.netty.channel.SimpleChannelHandler

Network handler for Data connections

Author:
Frederic Bregier

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Constructor Summary
DataNetworkHandler(FtpConfiguration configuration, DataBusinessHandler handler, boolean active)
          Constructor from DataBusinessHandler
 
Method Summary
 void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
          Run firstly executeChannelClosed.
 void channelConnected(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
          Initialize the Handler.
 void channelInterestChanged(org.jboss.netty.channel.ChannelHandlerContext arg0, org.jboss.netty.channel.ChannelStateEvent arg1)
          To enable continues of Retrieve operation (prevent OOM)
 void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
          Default exception task: close the current connection after calling exceptionLocalCaught.
 DataBusinessHandler getDataBusinessHandler()
           
 FtpSession getFtpSession()
           
 NetworkHandler getNetworkHandler()
           
 void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
          Act as needed according to the receive DataBlock message
 void setCorrectCodec()
          Set the CODEC according to the mode.
 void unlockModeCodec()
          Unlock the Mode Codec from openConnection of FtpTransferControl
 boolean writeMessage(String message)
          Write a simple message (like LIST) and wait for it
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelDisconnected, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataNetworkHandler

public DataNetworkHandler(FtpConfiguration configuration,
                          DataBusinessHandler handler,
                          boolean active)
Constructor from DataBusinessHandler

Parameters:
configuration -
handler -
active -
Method Detail

getDataBusinessHandler

public DataBusinessHandler getDataBusinessHandler()
                                           throws FtpNoConnectionException
Returns:
the dataBusinessHandler
Throws:
FtpNoConnectionException

getFtpSession

public FtpSession getFtpSession()
Returns:
the session

getNetworkHandler

public NetworkHandler getNetworkHandler()
Returns:
the NetworkHandler associated with the control connection

channelClosed

public void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
                          org.jboss.netty.channel.ChannelStateEvent e)
                   throws Exception
Run firstly executeChannelClosed.

Overrides:
channelClosed in class org.jboss.netty.channel.SimpleChannelHandler
Throws:
Exception
See Also:
SimpleChannelHandler.channelClosed(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ChannelStateEvent)

channelConnected

public void channelConnected(org.jboss.netty.channel.ChannelHandlerContext ctx,
                             org.jboss.netty.channel.ChannelStateEvent e)
Initialize the Handler.

Overrides:
channelConnected in class org.jboss.netty.channel.SimpleChannelHandler
See Also:
SimpleChannelHandler.channelConnected(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ChannelStateEvent)

setCorrectCodec

public void setCorrectCodec()
Set the CODEC according to the mode. Must be called after each call of MODE, STRU or TYPE


unlockModeCodec

public void unlockModeCodec()
Unlock the Mode Codec from openConnection of FtpTransferControl


exceptionCaught

public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.ExceptionEvent e)
Default exception task: close the current connection after calling exceptionLocalCaught.

Overrides:
exceptionCaught in class org.jboss.netty.channel.SimpleChannelHandler
See Also:
SimpleChannelHandler.exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ExceptionEvent)

channelInterestChanged

public void channelInterestChanged(org.jboss.netty.channel.ChannelHandlerContext arg0,
                                   org.jboss.netty.channel.ChannelStateEvent arg1)
To enable continues of Retrieve operation (prevent OOM)

Overrides:
channelInterestChanged in class org.jboss.netty.channel.SimpleChannelHandler
See Also:
SimpleChannelHandler.channelInterestChanged(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ChannelStateEvent)

messageReceived

public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.MessageEvent e)
Act as needed according to the receive DataBlock message

Overrides:
messageReceived in class org.jboss.netty.channel.SimpleChannelHandler
See Also:
SimpleChannelHandler.messageReceived(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.MessageEvent)

writeMessage

public boolean writeMessage(String message)
Write a simple message (like LIST) and wait for it

Parameters:
message -
Returns:
True if the message is correctly written


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