imario 2004/09/19 11:23:48
Modified: vfs/src/java/org/apache/commons/vfs/provider/ftp
FtpFileObject.java FtpFileSystemConfigBuilder.java
Log:
setFTPFileEntryParserFactoryKey: allows to set the "key" used in
FTPFileEntryParserFactory. In case of the default commons-net implementation this can
be a FQCN (which could be your own implementation) or one of the already known
ftp-entry parsers - see
org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory for details.
Revision Changes Path
1.26 +2 -1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
Index: FtpFileObject.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- FtpFileObject.java 27 May 2004 20:15:28 -0000 1.25
+++ FtpFileObject.java 19 Sep 2004 18:23:48 -0000 1.26
@@ -114,7 +114,8 @@
final FTPClient client = ftpFs.getClient();
try
{
- final FTPFile[] tmpChildren = client.listFiles(relPath);
+ String key =
FtpFileSystemConfigBuilder.getInstance().getFTPFileEntryParserFactoryKey(getFileSystem().getFileSystemOptions());
+ final FTPFile[] tmpChildren = client.listFiles(key, relPath);
if (tmpChildren == null || tmpChildren.length == 0)
{
children = EMPTY_FTP_FILE_ARRAY;
1.6 +36 -1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
Index: FtpFileSystemConfigBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FtpFileSystemConfigBuilder.java 26 Aug 2004 16:37:55 -0000 1.5
+++ FtpFileSystemConfigBuilder.java 19 Sep 2004 18:23:48 -0000 1.6
@@ -29,6 +29,8 @@
{
private final static FtpFileSystemConfigBuilder builder = new
FtpFileSystemConfigBuilder();
+ private final static String FACTORY_KEY =
FTPFileEntryParserFactory.class.getName() + ".KEY";
+
public static FtpFileSystemConfigBuilder getInstance()
{
return builder;
@@ -38,14 +40,47 @@
{
}
+ /**
+ * FTPFileEntryParserFactory which will be used for ftp-entry parsing
+ *
+ * @param opts
+ * @param factory instance of your factory
+ */
public void setFTPFileEntryParserFactory(FileSystemOptions opts,
FTPFileEntryParserFactory factory)
{
setParam(opts, FTPFileEntryParserFactory.class.getName(), factory);
}
+ /**
+ * @param opts
+ * @return
+ * @see #setFTPFileEntryParserFactory
+ */
public FTPFileEntryParserFactory getFTPFileEntryParserFactory(FileSystemOptions
opts)
{
return (FTPFileEntryParserFactory) getParam(opts,
FTPFileEntryParserFactory.class.getName());
+ }
+
+ /**
+ * set the key for using as argument to FTPFileEntryParserFactory.<br />
+ * If you use the default implementation in commons-net and you set a FQCN,
this class will be instantiated and used for ftp-entry parsing.<br />
+ *
+ * @param opts
+ * @param key
+ */
+ public void setFTPFileEntryParserFactoryKey(FileSystemOptions opts, String key)
+ {
+ setParam(opts, FACTORY_KEY, key);
+ }
+
+ /**
+ * @param opts
+ * @return
+ * @see #setFTPFileEntryParserFactoryKey
+ */
+ public String getFTPFileEntryParserFactoryKey(FileSystemOptions opts)
+ {
+ return (String) getParam(opts, FACTORY_KEY);
}
protected Class getConfigClass()
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]