[Yanel-dev] creation of new resource-types

Guillaume Déflache guillaume.deflache at wyona.com
Tue Jan 12 12:30:11 CET 2010


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? 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


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.


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).


More information about the Yanel-development mailing list