goldengate.ftp.core.control
Class NetworkHandler

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

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

Main Network Handler (Control part) implementing RFC 959, 775, 2389, 2428, 3659 and supports XCRC and XMD5 commands.

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
NetworkHandler(FtpSession session)
          Constructor from session
 
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)
          Initialiaze the Handler.
 void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
          Default exception task: close the current connection after calling exceptionLocalCaught and writing if possible the current replyCode.
 BusinessHandler getBusinessHandler()
           
 org.jboss.netty.channel.Channel getControlChannel()
           
 FtpSession getFtpSession()
           
 void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
          Simply call messageRun with the received message
 org.jboss.netty.channel.ChannelFuture writeIntermediateAnswer()
          Write an intermediate Answer from Business before last answer also set by the Business
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelDisconnected, channelInterestChanged, 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

NetworkHandler

public NetworkHandler(FtpSession session)
Constructor from session

Parameters:
session -
Method Detail

getBusinessHandler

public BusinessHandler getBusinessHandler()
Returns:
the businessHandler

getFtpSession

public FtpSession getFtpSession()
Returns:
the session

getControlChannel

public org.jboss.netty.channel.Channel getControlChannel()
Returns:
the Control Channel

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)
Initialiaze 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)

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 and writing if possible the current replyCode.

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

messageReceived

public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.MessageEvent e)
Simply call messageRun with the received message

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

writeIntermediateAnswer

public org.jboss.netty.channel.ChannelFuture writeIntermediateAnswer()
Write an intermediate Answer from Business before last answer also set by the Business

Returns:
the ChannelFuture associated with the write


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