[Yanel-dev] different schemes in yanel

Josias Thöny josias.thoeny at wyona.com
Mon Jan 14 14:21:16 CET 2008


Evaldas Taroza wrote:
> Hi,
> 
> I am trying to understand how I can programmatically access a resource 
> in Yanel without passing it through HTTP.
> 
> Can anyone explain how yanelrepo: and yanelreource: schemes are working? 
> For instance I have an XML resource (extends BasicXMLResource) for which 
> I get content as specified in the parameter. I need a class which 
> transparently gives me an XML with any given URI in the repository, for 
> example, the parameters for my resource can be
> 1. my.xml
> 2. yanelrepo:/my.xml
> 3. yanelresource:/my.xml
> 
> Is there anything like:
> InputStream is = new NodeInRepository(paramURI).getContents();

The yanelrepo protocol can be used to access a repository node, and the 
yanelresource protocol can be used to access a resource view (it's like 
calling getView() on the resource).

I'm not sure which protocol you need. Be aware that a repository node 
does not necessarily correspond to a resource. I mean a resource may 
store its content in a repo node, but it doesn't have to. Moreover the 
path of the resource does not have to be the same as the repository 
path. It depends on the resource implementation.

If you want to resolve a URI like e.g. yanelrepo:/my.xml, you can use 
the SourceResolver:

SourceResolver resolver = new SourceResolver(resource);
Source source = resolver.resolve("yanelrepo:/my.xml", null);
InputStream is = SAXSource.sourceToInputSource(source).getByteStream();

hth,
josias


> 
> Evaldas
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development



More information about the Yanel-development mailing list