cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Geissel" <>
Subject [Donation] Pooled ftp connection component for Cocoon2
Date Thu, 22 Nov 2001 16:33:27 GMT

The attached ZIP file contains a new poolable ftp-client component to fit
into the Cocoon2 / Avalon framework.

This component is registered in the cocoon.xconf using the following syntax
(and located after the <datasources/> section):

    <connection pool-max="32" pool-min="0" pool-grow="2"
        <parameter name="server" value="##host##"/>
        <parameter name="port" value="##port##"/>
        <parameter name="user" value="##user##"/>
        <parameter name="password" value="##password##"/>

Multiple ftp-connection pools are supported (it uses the standard
ExcaliburComponentSelector). The actual ftp connection is linked to the IBM
alphaWorks FTP Bean Suite project, available under IBM Public Licence.

The ftp connection is accessed using the
org.apache.cocoon.components.ftp.FtpClient interface, which provides access
to file upload / download, etc. Connections are managed through the
FtpConnect interface.

The included implementation satisfies these two interfaces, as well as
Component, Loggable, Parameterizable, Poolable and Startable. Therefore, to
access a connection, just include the following java code in your calling

    import org.apache.cocoon.components.ftp.FtpClient;

    ComponentSelector selector = (ComponentSelector)
    FtpClient ftpClient = (FtpClient)"##pool-name##");

    ftpClient.put(ftpFilename, inputStream); // or whatever


For those who prefer XSP, there is a basic logisheet also included. Just add
the following namespace declaration to <xsp:page/>:

and then the following XSP:

    <ftp-client:connection pool="##pool-name##">
        <ftp-client:put src-file="winnt.bmp" dest-file="winnt.bin"
        <ftp-client:get src-file="winnt.bin" dest-file="new-winnt.bmp"

To update the Cocoon2.rc2 build, extract the attached ZIP file into the
appropriate folders, apply the diffs and download the IBM ftp Bean jar
(FTPProtocol.jar - available from into the
cocoon/lib folder, and rebuild.

In the spirit of all things open, I would honour its inclusion in the
regular Cocoon distribution.
Many thanks,
Adrian Geissel

View raw message