Registering and using a resource type


Registering a resource type

In order to use an existing resource type within a realm one first needs to register the resource type such that the Yanel core knows about it. A resource can either be registered by providing a directory path to where the definition of the resource type is located

<yanel:resource-type src="/home/USER/yanel-resource-types/calendar/"/>

or by providing a package name if the resource type is available as jar file

<yanel:resource-type package="org.wyona.yanel.impl.resources.redirect"/>

whereas such a package needs to contain a resource.xml file and if no src attribute was specified, then it needs to be referenced by some maven dependencies file in order to be downloaded. As an example see the redirect resource configured within YANEL_HOME/conf/resource-types.xml.

In the case of a binary webapp distribution one needs to add such an entry to the file WEB-INF/classes/resource-types.xml.

In the case of the source distribution one should copy the file conf/resource-types.xml to conf/local/local.resource-types.xml and add such a resource-type entry to this local file (whereas the path to this local configuration file can be configured within src/build/(local.)build.properties with the local.config.dir parameter). Please note that the local configuration file is overwriting the default configuration (and is NOT additional).

Please note that a resource is basically a Java class which is compiled during the build process of Yanel, hence once needs to add a src attribute also for resource types which shall be made available as a package, e.g.

<yanel:resource-type package="org.wyona.yanel.impl.resources.redirect" src="/home/USER/yanel/contributions/resources/redirect/" compile="true"/>

except the library containing the package is referenced within some maven dependencies file of a realm or another resource.

Using a resource type

Depending on the realm configuration one first has to figure out where the realm specific resource configurations are located. Take a look at the realm configuration file realm.xml and search for the XML element with the name "rti". In the case of the "from scratch" realm the value should be config/rti-repository.xml (whereas the path is resolved relative to the file realm.xml).

Then take a look at this file and depending on the configured repository implementation one should be able to figure out where the resource configurations are located. In the case of the "from scratch" realm, the resource configurations are located within the directory res-configs.



Your comments are much appreciated

Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.