[Yanel-dev] Configuring a resource

Michael Wechner michael.wechner at wyona.com
Mon Dec 20 15:53:36 CET 2010


Hi Rob

On 12/20/10 1:32 PM, Rob Adamson wrote:
> Hi,
>
> I want to create an object when Yanel starts up, taking a
> configuration parameter from a file or JNDI, and then pass that object
> to two different resources.
>
> What are my options for achieving this?

One possibility would be to introduce a custom realm implementation, 
which can be configured

http://www.yanel.org/en/documentation/realm/realm-configuration.html#realm-class

See for example

https://svn.wyona.com/repos/public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/map/FOAFRealm.java


and then cast this realm within your custom resource types.

Another possibility might be to extend

YANEL_HOME/conf/spring-yanel-config.xml

in the sense that one could have such a config per realm.
Shouldn't be too hard to extend the Yanel core for this.

A third possibility would be to introduce a resource type interface 
called "InitializableV1" which
would mean if a resource type implements this method, then Yanel core 
will call the corresponding
methods at startup.


>   My goal is to move the object
> configuration (and hence code dependencies) out of the resource
> classes.

can you give an example?

Thanks

Michael
> Rob



More information about the Yanel-development mailing list