cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Ezkovich <>
Subject Re: Singleton component
Date Sat, 17 Jul 2004 22:57:29 GMT

On Jul 17, 2004, at 4:06 PM, Ralph Goers wrote:

> At 7/17/2004  11:44 AM, you wrote:
>>> Something else. Basically, it's a workflow manager. Once a job is 
>>> submitted a sequence of events need to occur before the job is 
>>> accepted and completed. The sequence of events may complete in 
>>> seconds or they may take several days to complete. Most of the time, 
>>> they will complete in seconds. Rather then read the job from the 
>>> database and create a new instance of the job several times in this 
>>> short span they are stored in a Map. The component needs access to a 
>>> SourceResolver and several DataSources. It needs to be available to 
>>> several Poolable components.
>> i'm unclear about <component> and <component-instance> too :)
>> The most meaningful difference i noticed is the declaration of the 
>> 'role', that would help you to lookup
>> your component instance from the component/service manager.
>> so, i'm waiting an explanation too :)
>> regards
> <component> and <component-instance> are avalon constructs.  
> Basically, a component is something you would look up using the 
> ServiceManager via its role.  Sometimes the component represents a 
> collection of objects which are all of the same type, such as input 
> modules, source resolvers, etc.  In this case, the component is 
> something that just manages the collection, like 
> ExtendedComponentSelector.  If you look at the code that access a 
> component-instance you will see that it looks for a role name with the 
> word "Selector" appended to it. Then the selector will be called with 
> the key to the desired instance (i.e - the specific input module, 
> etc.).
> If you take a look at cocoon.roles you will notice that these are 
> really just short-hand ways of specifying a component.  For example, 
> in cocoon.roles there is a definition for source-factories that names 
> ExtendedSourceFactorySelector as its implementing class and with a 
> name of org.apache.excalibur.source.SourceFactorySelector.  This means 
> that in cocoon.xconf, instead of declaring
> <component 
> class="org.apache.cocoon.components.ExtendedSourceFactorySelector 
> role="org.apache.excalibur.source.SourceFactorySelector>
> we can just put
> <source-factories>
> Hope this clears it up a little bit.

Thanks, it does. But just to make sure... A Component marked as 
ThreadSafe and declared with <component> in cocoon.xconf will be a 
singleton. If I had several implementations of an interface, I could 
define a role in cocoon.roles, implement a selector, and using that 
role declare the implementations in cocoon.xconf using 

Glen Ezkovich
HardBop Consulting - new and improved site coming soon

A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message