Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Archives

< 'Enterprise' development requires balls   Documentation writers wanted for RIFE >
RIFE 1.0rc2 released

This should be the last release candidate before the final 1.0 release. Most efforts will now go to completing missing javadocs, creating a proper web site and writing some tutorials. Any help with this is greatly appreciated!

Below are the highlights of this release.

You can also read the full changelog for more details.


IoC support

We don't support the creation and dependency management of object references. Instead, we focus on the retrieval of the references and the injection of objects into the web engine elements.

The instantiation or management of your object references has to be done in participants. These can contain your own personal Java code where you create new objects for the reference keys that are requested, or you can setup existing IoC containers like Spring, Pico, ... and delegate the management to them in dedicated participants.

Retrieving the references

We simply rely on the repository as a generic way of providing object references. We already had support for any kind of participant which can provide any kind of object according to a key. An IoC container is simply one possible participant and any number of containers can work together and even be swapped later in the development.

Besides setting a simple string as a property value, the syntax we will use for this is:

<property name="datasource">
    <participant name="ParticipantDatasources">
        <participant name="ParticipantConfig">DATASOURCE</participant>
    </participant>
</property>

This is the full syntax of what could have been written like this:

<property name="datasource">
    <participant name="ParticipantDatasources">
        <config param="DATASOURCE"/>
    </participant>
</property>

Or even like this:

<property name="datasource">
    <datasource>postgresql</datasource>
</property>

For convenience, we directly support tags for common RIFE features. These tags are:

  • config
  • datasource
  • template

Declaring the properties

Properties can be declared in several locations:

  • an element definition
  • a site declaration
  • a sub-site declaration
  • an element declaration in the site

Properties with the same name are applied in the same order as the list above, which means that properties inside an element declaration take precedence over anything else.

Properties that are defined in a sub-site or in a site, will be available to all containing elements. This is very handy for global dependencies like, for instance, datasources.

Injecting the references

Every time an element is created, the declared properties will be compared with the actual bean properties and the setters will be used to inject the references of those with the same name.

Currently we only support three situations here:

  • String bean properties:
    The reference's toString() method will be called before injecting it.
  • primitive bean properties or their class wrappers:
    We do our best to convert the values and if it's not possible, an exception is thrown.
  • other bean properties:
    If the bean property type is assignable from the type of injected reference, the setter will be called normally. Otherwise, an exception will be thrown, indicating that the types are not compatible.

Obtaining the references

If an element hasn't got the appropriate setters, the references are still obtainable through the existing getPropertyString(String key) and getProperty(String key) method.

An example ...

<datasources>
    <datasource name="postgresql">
        <driver>org.postgresql.Driver</driver>
        <URL>jdbc:postgresql://localhost:5432/mydb</url>
        <user>user</user>
        <password>password</password>
        <poolsize>10</poolsize>
    </datasource>
</datasources>
<element implementation="MyBlah">
    <property name="datasource"><datasource>postgresql</datasource></property>
</element>
public class MyBlah extends Element
{
    public void processElement()
    {
        Datasource ds = (Datasource)getProperty("datasource");
        ...
    }
}

... or ...

public class MyBlah extends Element
{
    Datasource mDatasource;

    public void setDatasource(Datasource datasource) { mDatasource = datasource; }

    public void processElement()
    {
        ...
    }
}

[ top ]

Spring integration

We now provide a ParticipantSpringWeb participant. If you provide a parameter to this participant, it will be used as the the attribute that Spring will use to look up the context XML declaration. If you provide no parameter, Spring will try to look up an existing web application context in the servlet context.

[ top ]

Fully redeployable

Before, RIFE-applications weren't re-deployable since our resource loaders and class loaders relied on the URL openStream(). By default, this method caches all the content. We disabled all these caches and performed some fixes on the loading of resource bundles.

Every feature that RIFE provides is now redeployable in a running servlet container.

[ top ]

Template value renderers

Besides the main manipulation logic of a template, value content needs to be sometimes created that is solely presentation related. This doesn't actually have its place in elements and sometimes even creates a burden. For these purposes, we created the ValueRenderer interface with the render(Template template, String valueName, String differentiator) method. Classes that implement this interface can be specified in any template like this:

<!--V 'RENDER:pakkage.classname'/-->

An instance of the class will be created and the render method will be called if the value hasn't been set yet. This has as side-effect that if you have several occurances of this value ID, they will all have the same renderer value and the renderer will only be called once.

If you need to have different results of the same renderer, you need to use a differentiator, like this:

<!--V 'RENDER:pakkage.classname:differentiator'/-->

[ top ]

posted by Geert Bevin in RIFE on May 22, 2005 7:58 PM : 0 comments [permalink]
 

Comments

Add a new comment

Comments on this blog entry have been closed.

< 'Enterprise' development requires balls   Documentation writers wanted for RIFE >
 
 
 
Google
rifers.org web