cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: source resolving help
Date Mon, 19 May 2003 23:10:51 GMT
Geoff Howard wrote:

> At 06:16 PM 5/18/2003, you wrote:
>
>> Geoff Howard wrote:
>> ...
>>
>>> so, I could do (?) FileSource fs = 
>>> (FileSource)resolver.resolveURI("directory/filename.ext");
>>
>>
>> ClassCastException!
>>
>> Why do you think you will get FileSource? :)
>> Of course, sometimes, you *will* get FileSource. But in many 
>> ligitimate situations you won't.
>
>
> Yes, if I think I might get something else, I'll do an instanceof 
> before the cast.  


Thanks :)


> That's part of what's opaque to me though - what determines what kind 
> of source I get?  Is it simply the prefix? (file:, http:, etc)?  Now 
> that I know I'm on the right track, I can dig in the source if you 
> think it'll be unraveled there.


Sometimes, when running out of archived war, you will get URLSource 
(jndi: in case of Tomcat, zip: in case of WebLogic 6, what else?) and 
not a file.


> I am handling file uploads and simply moving a file (or writing an 
> InputSource to a file).  I'm using Source for the destination.  In 
> this case, I'd usually if not always expect a FileSource, no?  


I think you should test for / cast to ModifiableSource or something like 
that which provides functionality you need. This will give flexibility / 
extensibility (see below). If returned source is read-only, you can 
throw some meaningful exception.


> But part of the reason for delving into using Source is that I might 
> expect to get support for other places to put a file 
> semi-automagically.  But I'm not sure what other end sources would 
> make sense as a destination besides FileSource. 


CVSSource, SlideSource... XMLDBSource also could be made writable... I 
can also imaging writable FTPSource... BlobSource... Won't it be cool? :)

Vadim



Mime
View raw message