> >*** Stage is compose with :
> >**** 1..1 queue (maybe a decorator or composite)
> >**** 0..n processor (sorted)
> >**** 0..1 Dispatcher (to
> >
> >So Stage :
> >
> >* construction
> >** need to define some context for queue, processor, disptacher (like
> >the name, workdir...)
> >
> 
> You can intercept the contextualization stage by creating a custom 
> contextualization handler.  An example is in the CVS under the path
> merlin/merlin-core/src/test/org/apache/avalon/playground
> 
> >
> >** assemble/chain the processor(s) and disptacher
> >* life style/algo (simple version)
> >** receive message from any component : other stage (via its dispather,
> >service X like a socket listener...) and enqueue it
> >** select a Thread and wait message from the Queue
> >** take message from Queue and submit it to the chain of processor
> >** if message processing and dispatching is ok then remove message from
> >the queue (ack)
> >
> >Currently I've got a version running under Phoenix but with heavy
> >configuration (Queue, Processor, Dispatcher are managed (lifecycle...)
> >by Stage):
> >* need 'cut and paste' stage's definition in assembly to be able to have
> >several stage (with different name)
> >
> 
> No problem - these would be represented as named components.
> 
> >
> >* need to define Queue, Processor and Dispatcher dependencies has Stage
> >dependencies, not very flexibeable : when I create a new Processor with
> >other dependencies than the already exists in Stage, I need to modify
> >the source of Stage (java generate .xinfo), all the defintion of stage
> >instance in assembly.xml...
> >
> >And if I choose to try Merlin it's first because Merlin is presented has
> >able to manage sub/custom container. (And I saw the source/config of
> >larm :
> >http://marc.theaimsgroup.com/?l=avalon-users&m=104554030111477&w=2)
> >
> 
> If I understand correctly - what you are describing is a dynamic 
> component.  I.e. a component that is programmatically established 
> outside of the general deployment phase.  Is this possible? Yes.  Is a 
> component acting as a container the right place to do it? Yes.
> 
> Inside the component implementation declared for the container, you has 
> a supplementary default context entry "urn:assembly:engine".  This 
> context entry is only available to components acting as containers.  
> Once you have access to the engine, you can narrow it to the Engine 
> interface and use create or locate appliances within the current engine 
> (immediate and parent engines).  You locate services by locating the 
> appliance and resolving the service from the appliance.  If this sounds 
> like what you want to do I can post additional details (examples are not 
> available yet in the doc but test cases are available).
> 
> Example:
> 
>    public void contextualize( Context context )
>    {
>       Engine engine = (Engine) context.get( Engine.KEY );
> 
>       // do dynamic stuff based on the operations exposed
>       // on the Engine interface
> 
>    }
> 
> See the Engine javadoc for details:
> 
> http://avalon.apache.org/sandbox/merlin/api/org/apache/avalon/assembly/engine/Engine.html

1) form the Engine how can I get reference to my sub-component ?
public class DefaultStage extends AbstractLogEnabled implements Contextualizable {
    public void contextualize(Context context){
        Engine engine = (Engine) contxet.get(Engine.KEY);
        Appliance app = engine.resolve(new ReferenceDescriptor("queue"));
        // And now how to get my queue ?
    }
}

2) What's append if I've got several Component that satisfy 
ReferenceDescriptor("processor") ?
 !! And I need to have processor in the order define in config :

<container name="stage-a" class="DefaultStage">
  <!-- the message queue -->
  <component class="MyQueueImpl"/>
  <!-- the processors pipeline (optionnal) -->
  <component class="ProcessorA"/>
  <component class="ProcessorB"/>
  <!-- the dispatcher (optionnal) -->
  <dispatcher class="ConstantDispatcher">
    <configuration>
      <next stage-name="stage-b"/>
    </configuration>
  </dispatcher>
</container>

<container name="stage-b" ...>
...

---------------------------------------------------
Disraeli was pretty close: actually, there are Lies, Damn lies, Statistics,
Benchmarks, and Delivery dates.
---------------------------------------------------


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

Reply via email to