commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Poulard <Philippe.Poul...@sophia.inria.fr>
Subject Re: [VFS] VFS.getManager().getFilesCache() - exists() vs findFiles()
Date Fri, 03 Jun 2005 11:18:14 GMT
Mario Ivankovits wrote:
> Philippe Poulard wrote:
> 
>> i need these attributes to create the file : XML:DB oblige to indicate 
>> if a file is XML or binary ; other attributes may also be required 
>> according to the provider ; so, if IMAGINARY was a type that would 
>> accept attributes, all would work fine
> 
> Hmmm ... I am not happy with this.
> 
> Sure, this is a small and easy change but it breaks VFS philosphy: A 
> single and consistent api to access files.
> Why? - You now have to know which filesystem you access and maybe setup 
> some (not defined by the fs) attributes to correctly create/read/write 
> files.

an XML:DB "file system" is somewhat exotic ; an URI is just a canonical 
expression of the representation of a file on a single string, but the 
fields are known : scheme, host, port, user, pwd, path etc ; the 
question is how to deal with additional informations required by the 
scheme provider but that can't be canonicalized ? the solution is to 
accept parameters

> 
> Say if I would like to move from a FTP: store to XMLDB: I would like to 
> be able to do this without the need to change the whole application 
> (e.g. set attributes before file creation)

these attributes are tightly coupled to this scheme
so if you have "xmldb:provider://..." somewhere, you also have attribute 
settings beside
thus, when you make the switch from xmldb to -say- ftp, this includes to 
clean attributes becoming irrelevant

example:

with active tags i write it like this:
<io:file name="target" 
file-name="xmldb:xyl://user:pwd@www.foo.com/path/to/file.xml">
     <!--needed by XML:DB-->
     <xcl:param name="xmldb-resource-type" value="XMLResource"/>
     <!--needed by Xyleme-->
     <xcl:param name="cluster" value="Raweb2004"/>
</io:file>

if i decide to move to ftp, i change like this:
<io:file name="target" 
file-name="ftp://user:pwd@ftp.foo.com/path/to/file.xml"/>

> 
> 
> When exactly do you need those attributes?
> If we need to distinguish between binary/text files wouldnt it be better 
> we provide a configuration to map filename-extensions/content-types to 
> its type?

this implies that we must know which types we intend to use ; with XML, 
there is many and many usual extensions and if a new extension is 
encountered, what do we do ? eventually, we could attempt to parse the 
file and if it fails, we assume that it's a binary file ; but how can we 
distinguish a broken XML file (that we should't store) with a binary one 
  (that would also store broken XML) ?
so, we can't based upon the content or name or content-type to decide 
which kind of file we are dealing with : this must be driven by the 
application

> 
> Which attributes else do you need?
> 

many others, that depend on the XML:DB provider
with Xyleme Zone Server, i have for example :
-the cluster name
-the attachment n°
-the timeout
-the mode (pipeline or document)
etc

some could be "normalized" by VFS ; for example, the "timeout" is a 
concept shared by remote file systems
why not define the "org.apache.commons.VFS.attributes.timeout" attribute ?
same thing for other providers ; this would avoid name conflicts
-- 
Cordialement,

            ///
           (. .)
  -----ooO--(_)--Ooo-----
|   Philippe Poulard    |
  -----------------------

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


Mime
View raw message