Create a new resource type from scratch

Run build Script

  • First we create an empty resource-type. For this, use the build script in the console:
    ./ new-resource-type for Linux
    build.bat new-resource-type for windows
  • It will ask you for a name for your resource-type and type a name (this should be all lower case and hyphen separated, e.g.: my-resource). This will also be the name of the directory where your resource will reside.
  • Next, it will ask you for a namespace for your resource. Insert a namespace, e.g.
  • Then, give a short description for your resource-type
  • Now, it will ask you for a package name for the java class of your resource type. Type a package name, e.g. org.wyona.yanel.impl.resources.mypackage
  • Enter a java class name of this resource-type, e.g. MyResource
  • Now choose the template for your java class. Type any one of the following: {empty | xml | usecase | examples}.
  • Then, you will be asked if you want to implement interfaces in your java class. Type yes to implement interfaces.
  • You will be asked for the different interfaces. Type yes for necessary interfaces.
  • Now the newly created resource is available in the directory $YANELHOME/src/contributions/resources
  • Your resource type directory now contains the following items:
    • ./yanel-htdocs/doc/index.html
    • ./yanel-htdocs/icons/scalable/rt-icon.svg
    • ./yanel-htdocs/icons/32x32/rt-icon.png
    • ./yanel-htdocs/icons/22x22/rt-icon.png
    • ./yanel-htdocs/icons/16x16/rt-icon.png
    • ./resource.xml
    • ./build.xml
    • ./src/build/dependencies.xml
    • ./src/build/
    • ./src/java/org/myproject/yanel/impl/resources/

Register New Resource

  • Register your newly created resource to the local.resource-types.xml (in $YANELHOME/conf/local/local.resource-types.xml) by adding the following line:
  • <resource-type src="@YANEL_SRC_DIR@/src/contributions/resources/your-resource/" compile="true"/>
  • Rebuild Yanel (or copy your resource-types.xml to local/apache-tomcat-7.0.25/

Implement Functionality

  • Implement necessary functionality in the

Rebuild Yanel

  • Rebuild Yanel so that yanel can build our newly created resource-type also.
  • Please note that a resource type can also be built on its own (e.g. ./ -f src/resources/xml/build.xml), whereas one might have to update the dependencies (e.g. in src/resources/xml/src/build/dependencies.xml)

Restart Yanel

  • Type ./ start for Linux or start-yanel.bat for Windows
  • Your new resource type should be listed now at

Add Resource Type configuration

  • Yanel looks up the configuration for a requested URL, to determine what resource-type to use. The resource-type configuration files are located in the repository which is configured as the rti (resource type identifier) repository in a realm (e.g $YANELHOME/src/realms/use-cases/yanel/rti/my-resource.html.yanel-rc).
    <?xml version="1.0"?>
    <yanel:resource-config xmlns:yanel="">
    <yanel:rti name="hello-world" namespace=""/>

Browse Resource

  • You can view the newly created resource by visiting http://localhost:8080/yanel/test/use-cases/my-resource.html.

Ignoring the build directory

  • If you are using svn or git for version control, note that the first time you build your new resource, the directory build will be created in the resource's home directory. To make svn ignore this directory, in the resource's home directory do:
    svn propset svn:ignore build
    Or to make git ignore this directory, create a .gitignore file containing 'build' as a directory to be ignored.

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.