goldengate.ftp.core.config
Class FtpConfiguration

java.lang.Object
  extended by goldengate.ftp.core.config.FtpConfiguration
Direct Known Subclasses:
FileBasedConfiguration

public abstract class FtpConfiguration
extends Object

Abstract class for configuration

Author:
Frederic Bregier

Field Summary
 int BLOCKSIZE
          Size by default of block size for receive/sending files.
 Class<? extends BusinessHandler> businessHandler
          Which class will be used for BusinessHandler
 int CLIENT_THREAD
          Default number of threads in pool for Client part.
 Class<? extends DataBusinessHandler> dataBusinessHandler
          Which class will be used for DataBusinessHandler
static long DEFAULT_GLOBAL_LIMIT
          Default global limit 512Mbit
static long DEFAULT_SESSION_LIMIT
          Default session limit 64Mbit, so up to 8 full simultaneous clients
protected  long delayLimit
          Delay in ms between two checks
 boolean deleteOnAbort
          Should the file be deleted when the transfer is aborted on STOR like commands
 Class<?> fromClass
          Which class owns this configuration
 boolean isShutdown
          True if the service is going to shutdown
 long maxGlobalMemory
          Max global memory limit: default is 4GB
 int SERVER_THREAD
          Default number of threads in pool for Server.
protected  long serverChannelReadLimit
          Limit in Read byte/s to apply by session to the FTP Server
protected  long serverChannelWriteLimit
          Limit in Write byte/s to apply by session to the FTP Server
protected  long serverGlobalReadLimit
          Limit in Read byte/s to apply globally to the FTP Server
protected  long serverGlobalWriteLimit
          Limit in Write byte/s to apply globally to the FTP Server
 long TIMEOUTCON
          Nb of milliseconds after connection is in timeout
static boolean USEJDK6
          True if use of JDK6 or upper, False if JDK5.
 
Constructor Summary
FtpConfiguration(Class<?> classtype, Class<? extends BusinessHandler> businessHandler, Class<? extends DataBusinessHandler> dataBusinessHandler, goldengate.common.file.FileParameterInterface fileParameter)
          Simple constructor
 
Method Summary
 void bindLock()
          In bind/unbind operation, lock
 void bindUnlock()
          In bind/unbind operation, unlock
 void changeNetworkLimit(long writeLimit, long readLimit)
          Reset the global monitor for bandwidth limitation and change future channel monitors with values divided by 10 (channel = global / 10)
 boolean checkPassword(String password)
          Check the password for Shutdown
 void computeNbThreads()
          Compute number of threads for both client and server from the real number of available processors (double + 1) if the value is less than 64 threads.
 void delFtpSession(InetAddress ipOnly, InetSocketAddress fullIp)
          Remove the FtpSession
 String getBaseDirectory()
           
 Class<? extends DataBusinessHandler> getDataBusinessHandler()
           
 long getDelayLimit()
           
 goldengate.common.file.FileParameterInterface getFileParameter()
           
 File getFileProperty(String key)
           
 FtpInternalConfiguration getFtpInternalConfiguration()
           
 FtpSession getFtpSession(org.jboss.netty.channel.Channel channel, boolean active)
          Return and remove the FtpSession
 int getIntProperty(String key)
           
 Lock getLock()
           
abstract  int getNextRangePort()
          Return the next available port for passive connections.
 Object getProperty(String key)
           
 String getServerAddress()
           
 long getServerChannelReadLimit()
           
 long getServerChannelWriteLimit()
           
 long getServerGlobalReadLimit()
           
 long getServerGlobalWriteLimit()
           
 int getServerPort()
           
 String getStringProperty(String key)
           
 String getUniqueExtension()
           
 boolean hasFtpSession(InetAddress ipOnly, InetSocketAddress fullIp)
          Test if the couple of addresses is already in the context
abstract  void inShutdownProcess()
          Shutdown process is on going
 void releaseResources()
          To use if any external resources are to be released when shutting down
 void serverStartup()
          Init internal configuration
 void setBaseDirectory(String dir)
           
 void setFileProperty(String key, File f)
           
 void setIntProperty(String key, int i)
           
 void setNewFtpSession(InetAddress ipOnly, InetSocketAddress fullIp, FtpSession session)
          Add a session from a couple of addresses
 void setPassword(String password)
           
 void setProperty(String key, Object o)
           
 void setServerAddress(String address)
           
 void setServerPort(int port)
           
 void setStringProperty(String key, String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USEJDK6

public static final boolean USEJDK6
True if use of JDK6 or upper, False if JDK5.

See Also:
Constant Field Values

DEFAULT_SESSION_LIMIT

public static long DEFAULT_SESSION_LIMIT
Default session limit 64Mbit, so up to 8 full simultaneous clients


DEFAULT_GLOBAL_LIMIT

public static long DEFAULT_GLOBAL_LIMIT
Default global limit 512Mbit


isShutdown

public volatile boolean isShutdown
True if the service is going to shutdown


SERVER_THREAD

public int SERVER_THREAD
Default number of threads in pool for Server. The default value is for client for Executor in the Pipeline for Business logic. Server will change this value on startup if not set.


CLIENT_THREAD

public int CLIENT_THREAD
Default number of threads in pool for Client part.


fromClass

public Class<?> fromClass
Which class owns this configuration


dataBusinessHandler

public Class<? extends DataBusinessHandler> dataBusinessHandler
Which class will be used for DataBusinessHandler


businessHandler

public Class<? extends BusinessHandler> businessHandler
Which class will be used for BusinessHandler


TIMEOUTCON

public long TIMEOUTCON
Nb of milliseconds after connection is in timeout


BLOCKSIZE

public int BLOCKSIZE
Size by default of block size for receive/sending files. Should be a multiple of 8192 (maximum = 64K due to block limitation to 2 bytes)


serverGlobalWriteLimit

protected long serverGlobalWriteLimit
Limit in Write byte/s to apply globally to the FTP Server


serverGlobalReadLimit

protected long serverGlobalReadLimit
Limit in Read byte/s to apply globally to the FTP Server


serverChannelWriteLimit

protected long serverChannelWriteLimit
Limit in Write byte/s to apply by session to the FTP Server


serverChannelReadLimit

protected long serverChannelReadLimit
Limit in Read byte/s to apply by session to the FTP Server


delayLimit

protected long delayLimit
Delay in ms between two checks


deleteOnAbort

public boolean deleteOnAbort
Should the file be deleted when the transfer is aborted on STOR like commands


maxGlobalMemory

public long maxGlobalMemory
Max global memory limit: default is 4GB

Constructor Detail

FtpConfiguration

public FtpConfiguration(Class<?> classtype,
                        Class<? extends BusinessHandler> businessHandler,
                        Class<? extends DataBusinessHandler> dataBusinessHandler,
                        goldengate.common.file.FileParameterInterface fileParameter)
Simple constructor

Parameters:
classtype - Owner
businessHandler - class that will be used for BusinessHandler
dataBusinessHandler - class that will be used for DataBusinessHandler
fileParameter - the FileParameterInterface to used
Method Detail

getStringProperty

public String getStringProperty(String key)
                         throws FtpUnknownFieldException
Parameters:
key -
Returns:
The String property associated to the key
Throws:
FtpUnknownFieldException

getIntProperty

public int getIntProperty(String key)
                   throws FtpUnknownFieldException
Parameters:
key -
Returns:
The Integer property associated to the key
Throws:
FtpUnknownFieldException

getFileProperty

public File getFileProperty(String key)
                     throws FtpUnknownFieldException
Parameters:
key -
Returns:
The File associated to the key
Throws:
FtpUnknownFieldException

getProperty

public Object getProperty(String key)
                   throws FtpUnknownFieldException
Parameters:
key -
Returns:
The Object property associated to the key
Throws:
FtpUnknownFieldException

getServerPort

public int getServerPort()
Returns:
the TCP Port to listen in the Ftp Server

getServerAddress

public String getServerAddress()
Returns:
the Address of the Ftp Server if any (may be null)

getServerGlobalWriteLimit

public long getServerGlobalWriteLimit()
Returns:
the limit in Write byte/s to apply globally to the Ftp Server

getServerChannelWriteLimit

public long getServerChannelWriteLimit()
Returns:
the limit in Write byte/s to apply for each session to the Ftp Server

getServerGlobalReadLimit

public long getServerGlobalReadLimit()
Returns:
the limit in Read byte/s to apply globally to the Ftp Server

getServerChannelReadLimit

public long getServerChannelReadLimit()
Returns:
the limit in Read byte/s to apply for each session to the Ftp Server

getDelayLimit

public long getDelayLimit()
Returns:
the delayLimit to apply between two check

checkPassword

public boolean checkPassword(String password)
Check the password for Shutdown

Parameters:
password -
Returns:
True if the password is OK

getNextRangePort

public abstract int getNextRangePort()
Return the next available port for passive connections.

Returns:
the next available Port for Passive connections

getBaseDirectory

public String getBaseDirectory()
Returns:
the Base Directory of this Ftp Server

setStringProperty

public void setStringProperty(String key,
                              String s)
Parameters:
key -
s -

setIntProperty

public void setIntProperty(String key,
                           int i)
Parameters:
key -
i -

setFileProperty

public void setFileProperty(String key,
                            File f)
Parameters:
key -
f -

setProperty

public void setProperty(String key,
                        Object o)
Parameters:
key -
o -

setServerPort

public void setServerPort(int port)
Parameters:
port - the new port

setServerAddress

public void setServerAddress(String address)
Parameters:
address - the address to use while answering for address

setBaseDirectory

public void setBaseDirectory(String dir)
Parameters:
dir - the new base directory

setPassword

public void setPassword(String password)
Parameters:
password - the new password for shutdown

getDataBusinessHandler

public Class<? extends DataBusinessHandler> getDataBusinessHandler()
Returns:
the dataBusinessHandler

serverStartup

public void serverStartup()
Init internal configuration


changeNetworkLimit

public void changeNetworkLimit(long writeLimit,
                               long readLimit)
Reset the global monitor for bandwidth limitation and change future channel monitors with values divided by 10 (channel = global / 10)

Parameters:
writeLimit -
readLimit -

computeNbThreads

public void computeNbThreads()
Compute number of threads for both client and server from the real number of available processors (double + 1) if the value is less than 64 threads.


getLock

public Lock getLock()
Returns:
the lock on configuration

bindLock

public void bindLock()
In bind/unbind operation, lock


bindUnlock

public void bindUnlock()
In bind/unbind operation, unlock


getFtpInternalConfiguration

public FtpInternalConfiguration getFtpInternalConfiguration()
Returns:
the FtpInternalConfiguration

setNewFtpSession

public void setNewFtpSession(InetAddress ipOnly,
                             InetSocketAddress fullIp,
                             FtpSession session)
Add a session from a couple of addresses

Parameters:
ipOnly -
fullIp -
session -

getFtpSession

public FtpSession getFtpSession(org.jboss.netty.channel.Channel channel,
                                boolean active)
Return and remove the FtpSession

Parameters:
channel -
active -
Returns:
the FtpSession if it exists associated to this channel

delFtpSession

public void delFtpSession(InetAddress ipOnly,
                          InetSocketAddress fullIp)
Remove the FtpSession

Parameters:
ipOnly -
fullIp -

hasFtpSession

public boolean hasFtpSession(InetAddress ipOnly,
                             InetSocketAddress fullIp)
Test if the couple of addresses is already in the context

Parameters:
ipOnly -
fullIp -
Returns:
True if the couple is present

getFileParameter

public goldengate.common.file.FileParameterInterface getFileParameter()
Returns:
the fileParameter

getUniqueExtension

public String getUniqueExtension()

releaseResources

public void releaseResources()
To use if any external resources are to be released when shutting down


inShutdownProcess

public abstract void inShutdownProcess()
Shutdown process is on going



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