[Yanel-dev] creation of new resource-types
Michael Wechner
michael.wechner at wyona.com
Tue Jan 12 14:11:26 CET 2010
Guillaume Déflache wrote:
> While adding a new resource-type, I just stumbled upon an odd XML
> element generated by default by the "new-resource-type" Yanel Ant
> build target in the resource.xml file:
> ---8<---
> <rtd>
> <!--
> <property name="foo" default-value="bar"/>
> -->
> </rtd>
> ---8<---
> Is this still supported and useful?
it's actually intended for documentation and validation of resource
config instances
> I could not find any use of it in
> http://svn.wyona.com/repos/public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceTypeDefinition.java
>
AFAIK it's not implemented yet
>
>
> If the resource.xml file has so few data in it maybe we could consider
> using Java 5 annotations on the resource-type class to define the
> URI-to-class mapping and other RTD properties, as IMHO this mapping is
> an intrinsic part to the class and so will probably not be changed
> independently of the class.
> E.g.:
> @org.yanel.core.resource.type.RTD(""http://yanel.org/1.0/resource-types/my-fancy")
>
> /**
> * This would be the description of my fancy resource-type.
> */
> class MyFancyResource {
> [...]
>
> The resource*.xml files may have to be generated beforehand to keep
> backward compatibility, and to do that the build process would
> probably have to scan in each RT directory all src/java/**.java files
> for RTD annotations, but then we would not need yet another file for
> each RT anymore.
it's not clear to me how you want to represent for example the content of
src/contributions/resources/calendar/resource.xml
via annotations? Can you give a more concrete example (e.g. for the
calendar above)?
>
>
> Also FYI one can now easily define in which directory new
> resource-types get created
> using the 'new-resource-types.home' Ant location property, e.g.:
> `build new-resource-type
> -Dnew-resource-types.home=/home/guillaume/yanel-RTs`
> (cf. r47027).
would it make sense to add this to the src/build/build.properties file
and set the default as it currently is.
Also you might want to update the documentation:
http://127.0.0.1:8080/yanel/yanel-website/en/documentation/create-new-resource.html
Thanks
Michi
More information about the Yanel-development
mailing list