You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Torsten Curdt <tc...@dff.st> on 2001/06/13 14:48:29 UTC

[proposal] autoload of components

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?
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: [proposal] autoload of components

Posted by Berin Loritsch <bl...@apache.org>.
Berin Loritsch wrote:
> 
> 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?

If you are refering to making the components come alive,
the ExcaliburComponentManager is now Initializable.  Initialize
the ComponentManager, and all components will begin to load.

> 
> 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: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: [proposal] autoload of components

Posted by Berin Loritsch <bl...@apache.org>.
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: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


RE: [proposal] autoload of components

Posted by Torsten Curdt <tc...@dff.st>.
> >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?
> 
> I am not sure I understand you - could you expand?
> Cheers,

Well, although I don't really need it any longer (since
Cocoon2 now loads all it's components on startup)
I still think it is a useful feature to decide inside
the configuration the startup time of component.

For what I understood the configuration only defines/registers
components to the manager. A flag to tell the component
manager e.g. "at least one instance should be created" the
time it is defined would be reasonable IMHO - particular
for runnables...

See what I mean now?
--
Torsten



---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: [proposal] autoload of components

Posted by Peter Donald <do...@apache.org>.
At 02:48 PM 6/13/01 +0200, 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?

I am not sure I understand you - could you expand?
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org