Hi everyone,
I've been working on adding support for annotations to perform the
element declarations. The current state is still experimental and
work in progress, but it would be nice if some people could play with
it and give their impressions. It's the first time that I design an
annotations API, so I think it's a good idea to test it out in 'the
real world' for a while.
I created a small example that uses annotations, you obtain it
through Subversion from here:
https://svn.rifers.org/rife-jumpstart/branches/
simonbrownsblog_annotations
These are the currently supported annotations:
https://svn.rifers.org/rife/trunk/src/framework/com/uwyn/rife/engine/
annotations/
A complete overview of everything that's currently tested can be
found here:
https://svn.rifers.org/rife/trunk/src/unittests/com/uwyn/rife/engine/
testelements/annotations/Simple.java
Annotations are basically used when you declare an element with just
an implementation (no ID, no file). All that's needed is the @Elem
annotation on the element class.
The following default behaviors are in place:
* if no ID is provided as an annotation value, the short class name
will be used (without the package)
* if no URL is provided as an annotation value, the lower cased short
class name will be used
If you use a flowlink or a datalink with a destClass annotation value
(instead of destId), the destination element class should also be
annotated with @Elem and its ID will be obtained. RIFE assumes that
this element has been declared priorly in the site-structure and its
ID will be evaluated inside the scope of the active sub-site.
I added a workaround for the fact that annotations are not hot-
swapped, so when you change and recompile a class while the
application is running and modify, add or delete the annotations, the
whole site-structure will automatically adapt.
Also, since you can add annotations on setters and getters for
params, files, submission beans, inputs, inbeans, incookies, outputs,
outbeans and outcookies, RIFE should ideally inject and outject the
related property values. This is currently only implemented for
params and inputs, the rest will follow.
Note that for declaring parameters, files, beans of a submission on
properties, RIFE will look at the last submission annotation that you
used and add the declaration to that submission. It's syntactically
not possible "wrap around" method annotations.
Ideally I wanted to provide support for element globbing so that you
could for example say:
<elements implementations="com.mysite.*"/>
This would then import the elements in that package and integrate
them using annotations in the active sub-site. However, there's no
way to intelligibly scan the classpath to be able to have an
iterative development process (with auto-reloading). RIFE would have
to constantly scan all the entries in the class path which could
become extremely slow. Any suggestions here are welcomed.
Please try this new feature out and play with it. Let me know what
you think!
Best regards,
Geert
--
Geert Bevin Uwyn bvba GTalk: [EMAIL PROTECTED]
"Use what you need" Avenue de Scailmont 34 Skype: gbevin
http://www.uwyn.com 7170 Manage, Belgium AIM: geertbevin
gbevin at uwyn dot com Tel: +32 64 84 80 03 Mobile: +32 477 302 599
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9
Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users