[Yanel-dev] direct file access

Guillaume Déflache guillaume.deflache at wyona.com
Thu May 7 12:22:49 CEST 2009


simon litwan schrieb:
> Guillaume Déflache schrieb:
>> Michael Wechner schrieb:
>>> simon litwan schrieb:
>>>> simon litwan schrieb:
>>>>> Michael Wechner schrieb:
>>>>>> simon litwan schrieb:
>>>>>>> [...]
>>>>>>>>
>>>>>>>> no way via the API. But you could do a cast on a specific file 
>>>>>>>> based implementation
>>>>>>> even if i cast to VFSNode there is nothing to access the file.
>>>>>>>
>>>>>> adding such a VFSNode specific method could be discussed of course 
>>>>>> ;-)
>>>>> i think it would make sense.
>>>> should i provide a patch. with something like
>>>>
>>>> public File getFile() {
>>>
>>> my guts feeling tells me that introducing such a method is a bad 
>>> thing, mainly because
>>> one breaks the exchangebility of the data repo implementation. It 
>>> doesn't hurt the API or anything like that, but
>>> it somehow encourages "bad behaviour". WDOT?
>>
>> I think it's not so bad as breaking it would be intentional by adding 
>> a cast, and that alone makes it explicit and greppable. Also doing 
>> this is not encouraging anything as you have to put a little extra 
>> effort (granted only a few more characters) to do it, which is IMHO 
>> better than having to give up using Yanel altogether! ;)
> i agree. but it's not about give up using yanel, rather give up using 
> yarep.

Oops, sorry, but all the same, you get the general idea! :)


>>> As said I would rather first talk to the xuggle guys, especially 
>>> since they really seem to be into Open Source.
>>
>> Sure, it would be nicer.
> 
> as i wrote before, i found a thread where they talk about 
> Input/OutputStreams but seems to be some effort. and at the moment i can 
> not wait, and i also have not really the time to implement this by my self.
> 
> now i found a new approach. i'm using yarep as before except if i need 
> the file. when i need the file i ask the repo for its configFile and 
> read out the path to the content and construct the file path.

Well let's say this is a handy hack! ;)

IMHO the configFile File object itself really shouldn't be available 
publicly via the API as that prevents us to mock repos easily. We should 
use URLs (well, strings representing URLs) instead of files as in:
     /**
      * Read configuration
      */
     public void readConfiguration(String configurationURL) throws 
RepositoryException;

     /**
      * Get repository configuration URL.
      */
     public String getConfigurationURL();


So in general please better not rely on that too much if at at all 
possible! (I know you probably have no other choice for this particular 
issue ATM...) :/


More information about the Yanel-development mailing list