commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject [VFS] Pass down configuration to the file-system layer.
Date Thu, 18 Mar 2004 10:31:49 GMT
Hello !

I implementd the "move file" function into VFS.
If the file is on the _SAME_ filesystem a _"RENAME"_ is issued, 
otherwise the file is copied to the destination and then deleted at the 
source. I know, if the delete failes, the file is duplicated, but this 
is the way like some other filemanager work.

Before i add the patch to Bugzilla, i would like to solve another 
problem: The way how the clients within the FileSystem can be 
configured, they cant now.
If you dont want to read all the stuff, jump to my preferred Solution3.


Solution1: Add a addConfigurationParameter(String, Object) to the 
FileSystem object.

That way it should be possible to configure e.g. the FTPFileEntryParser 
in the FTPFileSystem.
But the drawback is, that this has to be done at every 
"FileSystemManager.resolveFile"
e.g.
FileObject fo = myFileSystemManager.resolveFile("ftp://server/file");
fo.getFileSystem().addConfigurationParameter("FILE_ENTRY_PARSER", 
myFileEntryParser);

Due to the resolveFile does not do anything with the filesystem this 
works, but this isnt a contract and therefore a very bad design.


Solution 2: Add a properties parameter to resolveFile and pass this 
collection down to the filesystem.

Properties properties = new Properties();
FileObject fo = myFileSystemManager.resolveFile("ftp://server/file", 
properties);

The drawback here is: If the filesystem is already created we can not 
(and should not) change the properies.


Solution 3: Add a FileSystemClientFactory interface

with the following Method
Object FileSystemClientFactory.createClient(FileObject rootURI)

An instance of the Factory could be added to the FileSystemManager

FileSystemManager fsm = new FileSystemManager();
fsm.setFileSystemClientFactory(new MyFileSystemClientFactory())
FileObject fo = fsm.resolveFile("ftp://server/file");

That way, you could create a FileSystemClientFactory based on the 
complexity you would like to have.
Based on scheme (ftp, http, sftp, ...), server, , ... global, per 
instance or based on ApplicationThreadLocal.

What do you think?



Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message