Torsten Curdt wrote:
> 
> Since we would really like to have an autoload
> feature of components. I'd propose the following:
> 
>  <component class="org.apache.something" autoload="true">
>    <parameter name="test" value=""/>
>  </component>
> 
> In configure
> 
>  componentManager.configure(conf)
> 
> the componentManager is supposed on autoload="true" to
> do a subsequent lookup of this component (or whatever
> is appropriate to create an instance of this component)
> 
> Is this a possible sollution?


Take a look at Excalibur's ComponentManagement architecture.
It will allow you to use the ComponentManager to automatically
set up and manage all the components specified in a configuration
file.  It has a standard method of declaring components, as well
as a shorthand/user-friendly method.  Both methods accomplish the
same thing--however the shorthand method has the added benefit of
enabling a Component to not be declared in a configuration file,
and _still_ be accessed (through the default-class info).

The ComponentManager/Selector automagically determines if the
Component in question is ThreadSafe, SingleThreaded, or Poolable.
If no Configuration element is provided for a Component, but the
Component is Configurable, it will manufacture an empty Configuaration
element.  It's pretty cool stuff.

STANDARD DECLARATION
--------------------

<!--
     A component directly accessible from the manager
-->
<component role="org.apache.avalon.excalibur.MyRole"
           class="org.apache.something">
  <parameter name="test" value=""/>
</component>

<!--
     A component indirectly accessible from a selector
-->
<component role="org.apache.somethingSelector"
           class="org.apache.avalon.excalibur.ExcaliburSelector">
  <component-instance hint="foo"
                      class="org.apache.something">
    <parameter name="test" value="foo"/>
  </component-instance>
  <component-instance hint="bar"
                      class="org.apache.something">
    <parameter name="test" value="bar"/>
  </component-instance>
</component>


SHORTHAND ROLE MANAGER CONFIG
-----------------------------

<roles>
  <role name="org.apache.avalon.excalibur.MyRole"
        shorthand="something"
        default-class="org.apache.something"/>

  <role name="org.apache.somethingSelector"
        shorthand="things"
        default-class="org.apache.avalon.excalibur.ExcaliburSelector">
    <hint shorthand="something" class="org.apache.something"/>
  </role>
</roles>


SHORTHAND COMPONENT CONFIG
--------------------------

<!--
     A component directly accessible from the manager
-->
<something>
  <parameter name="test" value=""/>
</something>

<!--
     A component indirectly accessible from a selector
-->
<things>
  <something hint="foo">
    <parameter name="test" value="foo"/>
  </something>
  <something hint="bar">
    <parameter name="test" value="bar"/>
  </something>
</things>

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

Reply via email to