hammett wrote:
Jini 2.0 was just released. It supports a new type of configuration
<snip/>
The ConfigurationFile supports a subset of Java code
<snip/>
Thoughs?

well....ugh! A *real* scripting language works much nicer IMNSHO....for example, you can use BeanShell to not support a subset of java, but a superset that is very clean!


One could also use javascript, python, ruby, whatever. Once you make the (sometimes, admittedly questionable) decision that your configuration is allowed to "act" directly on your component (as opposed to the conceptually very clean avalon-style configuration where a component is allowed to "read" from its configuration, but the configuration itself is passive), it makes no sense at all to invent a new language (be it Jelly, Droolz, xmlbeans, or Jini 2.0 config files).

Here's an example of how simple this actually is:
---
Object getComponent( Factory factory, Container container ) // fragment
    throws ConfigurationException
{
  ComponentEntry entry = factory.getEntry( /* ... */ );
  InputStream script = entry.getConfigScript();

Interpreter i = new Interpreter();

  try
  {
    i.set( "entry", entry );
    i.set( "container", container );
    i.source( script ); // actual configuration at this point

    return i.get( "component" );
  }
  catch( Error e )
  {
    throw new ConfigurationException( e );
  }
}
---
your config script might look like:
---
component = entry.getInstance();
component.setParameter( container.get( "someDependencyKey" ) );
component.setBlah( container.get( "somethingelse" ) );
---

cheers!

- Leo



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to