Generic Bundle: Configuring
From CFTP
This explains configuration for the latest Version 1.25
The server is configured in the file conf/beans.xml located in your server's home directory. This is the Spring Framework XML file which defines all the objects ColoradoFTP server requires. Since this is the Spring Framework file you may add or replace any object easily provided you are familiar with the Spring Framework.
Below I explain the properties of all configurable objects included into the Generic Bundle. Edit the file conf/beans.xml in your favourite text editor.
Control Connector
Class name GenericControlConnector
<bean id="controlConnector" class="com.coldcore.coloradoftp.connection.impl.GenericControlConnector"/>
Properties you may apply:
port
Port number to listen to for incoming control connections. By default it is set to 21.
sleep
Time the thread must sleep after accepting a new connection in milliseconds. By default it is set to 100.
Control and Data Connection
Class names GenericControlConnection and GenericDataConnection
<bean id="controlConnection" class="com.coldcore.coloradoftp.connection.impl.GenericControlConnection"... <constructor-arg index="0" value="8192"/> </bean>
<bean id="dataConnection" class="com.coldcore.coloradoftp.connection.impl.GenericDataConnection"... <constructor-arg index="0" value="8192"/> </bean>
Properties you may apply:
constructor
Buffer size in bytes. This buffer is used to send and receive data, the bigger the buffer the faster it goes. Recommended value is 8192 – that is 8 KB.
sleep
Time the thread must sleep while waiting for any condition to occur in milliseconds. By default it is set to 100.
dataConnectionCallback
You can set an object which will be executed upon uploads/downloads allowing you to operate on files.
Data Connection Initiator
Class name GenericDataConnectionInitiator
<bean id="dataConnectionInitiator" class="com.coldcore.coloradoftp.connection.impl.GenericDataConnectionInitiator"...
Properties you may apply:
sleep
Time the thread must sleep while waiting for any condition to occur in milliseconds. By default it is set to 100.
Data Port Listener
Class name GenericDataPortListener
<bean id="dataPortListener" class="com.coldcore.coloradoftp.connection.impl.GenericDataPortListener"...
Properties you may apply:
port
Port number to listen on for incoming data connections.
sleep
Time the thread must sleep after accepting a new connection in milliseconds. By default it is set to 100.
Data Port Listener Set
Class name GenericDataPortListenerSet
<bean id="dataPortListenerSet"
class="com.coldcore.coloradoftp.connection.impl.GenericDataPortListenerSet">
<constructor-arg index="0">
<bean class="com.coldcore.coloradoftp.connection.impl.DataPortListenerSequence">
<constructor-arg index="0" value="6001"/>
<constructor-arg index="1" value="6010"/>
</bean>
</constructor-arg>
</bean>
Properties you may apply:
constructor
Takes set of data port listeners to operate upon.
Class name DataPortListenerSequence
This is a helper class that extends a HashSet and populates it with Data Port Listener objects. It takes range of ports into the constructor and creates Data Port Listener on every port. In the below example the following ports will be used for incoming data connections: 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009 and 6010
<bean id="dataPortListenerSet"
class="com.coldcore.coloradoftp.connection.impl.GenericDataPortListenerSet">
<constructor-arg index="0">
<bean class="com.coldcore.coloradoftp.connection.impl.DataPortListenerSequence">
<constructor-arg index="0" value="6001"/>
<constructor-arg index="1" value="6010"/>
</bean>
</constructor-arg>
</bean>
Data Filter Factory
Class name GenericDataFilterFactory
What is a Data Filter? FTP server applies Data Filters to its Data Connections to modify the transferred data on the fly. Filter intercepts data transfer and filters the data in the stream.
<bean id="typeFilterFactory"
class="com.coldcore.coloradoftp.filter.impl.GenericDataFilterFactory">
<constructor-arg index="0">
<map>
<entry key="I" value=""/>
<entry key="A" value="typeADataFilter"/>
</map>
</constructor-arg>
</bean>
Properties you may apply:
constructor
Takes map of available data filters. Key must be the upper-cased name of a data filter as user supplies it and a value is the name of a filter bean defined in this XML file or an empty value is no filtering required. In this example there is no filter set for TYPE I – nothing happens if user sends TYPE I command. If user sends TYPE A then typeADataFilter filter will be applied to a data stream once she attempts file transfer, this A filter changes line feeds in the data stream to system default as the file is transferred.
There are 3 Filter Factories defined:
- typeFilterFactory handles TYPE A and TYPE I commands
- modeFilterFactory handles MODE S command
- struFilterFactory handles STRU F command
The latter two factories do not define any filters but exist to handle mandatory FTP commands.
Type A Data Filter
Class name TypeADataFilter
<bean id="typeADataFilter" class="com.coldcore.coloradoftp.filter.impl.TypeADataFilter"... <property name="windows" value="false"/> </bean>
Properties you may apply:
windows
true for the Windows-style line feeds (replaces \n to \r\n) or false for the UNIX-style line feeds (replaces \r\n to \n) on upload only. If omitted then this filter tries to guess your OS type.
This Type A Data Filter filters the underlying data stream upon upload and changes line feeds to system default, upon download it always changes line feeds to Windows-style \r\n.
Connection Pool
Class name GenericConnectionPool
<bean id="controlConnectionPool" class="com.coldcore.coloradoftp.connection.impl.GenericConnectionPool"/>
<bean id="dataConnectionPool" class="com.coldcore.coloradoftp.connection.impl.GenericConnectionPool"/>
Properties you may apply:
sleep
Time the thread must sleep after processing all connections in milliseconds. By default it is set to 100.
Command Factory
Class name GenericCommandFactory
<bean id="commandFactory"
class="com.coldcore.coloradoftp.command.impl.GenericCommandFactory"...
<constructor-arg index="0">
<map>
<entry key="USER" value="userCommand"/>
<entry key="PASS" value="passCommand"/>
<entry key="PWD" value="pwdCommand"/>
<entry key="HELP" value="helpCommand"/>
<entry key="FEAT" value="helpCommand"/>
<entry key="SYST" value="systCommand"/>
Properties you may apply:
constructor
Takes map of available commands. Key must be the upper-cased name of a command as user supplies it and a value is the name of a command bean defined in this XML file. When user enters a command the bean associated with the command will be executed, otherwise an error message will be sent back to the user.
USER Command
Class name UserCommand
<bean id="userCommand" class="com.coldcore.coloradoftp.command.impl.ftp.UserCommand"... <property name="anonymous" value="true"/> </bean>
Properties you may apply:
anonymous
Set it to true to allow anonymous logins or false to deny anonymous logins. By default it is set to true.
SYST Command
Class name SystCommand
<bean id="systCommand" class="com.coldcore.coloradoftp.command.impl.ftp.SystCommand"... <constructor-arg index="0" value="UNIX"/> </bean>
Properties you may apply:
constructor
Takes the name of your system to display to users.
PASV Command
Class name PasvCommand
<bean id="pasvCommand" class="com.coldcore.coloradoftp.command.impl.ftp.PasvCommand"... <property name="ip" value="127.0.0.1"/> </bean>
Properties you may apply:
ip
Server's IP address for incoming data connections. Users will attempt to connect to this IP address to transfer files.
PASS Command
Class name PassCommand
<bean id="passCommand" class="com.coldcore.coloradoftp.command.impl.ftp.PassCommand"...
Properties you may apply:
emailRegExp
Email regular expression to test against anonymous passwords. Anonymous login will be forbidden if the password will not match this regular expression. By default it is set to:
([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]*)
Server log
This FTP server logs its activity to the file log/server.log located in its directory. This is a plain text file and you may open it in a text editor. By default the log level set to INFO which outputs very little information. You can change the level to DEBUG to see much more of server's activity. Just edit the file conf/log4j.properties and change INFO to DEBUG:
log4j.rootCategory=ERROR, FILE log4j.category.com.coldcore=DEBUG ..............
The DEBUG level will produce tremendous amount of output and is recommended only for testing or debugging. Don't change to it unless you really have to.
Plug-ins configuration
Server plug-ins configured separately, please refer to the plug-ins list for more information on configuration.
Return to FTP Server: Generic Bundle