avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: [merlin] JMX MBean generator facility
Date Mon, 01 Mar 2004 15:13:11 GMT
On Monday 01 March 2004 22:59, Cameron Fieber wrote:
> On Mon, 2004-03-01 at 06:07, Stephen McConnell wrote:
> > Have not looked at the code yet - but basically a facility would do
> > the
> > following:
> >
> >    (a) on deployment, do scan of the model to locate component models
> >        its is interested in, and secondly, register a composition
> > event
> >        listener to capture info about model structural changes
> >
> >    (b) on a composition event - just check the model that is added
> >        (or handle updating is something is removed) - no need to
> > rescan
> >
> > Stephen.
>
> That is what I am doing - I borrowed heavily from the
> DefaultModelListener in the http facility code.

Without trying to be 'obstinate', you call processModel() on every event 
containing a ContainmentModel, which traverse the whole model.


    public void modelAdded( CompositionEvent compositionEvent )
    {
        DeploymentModel model = compositionEvent.getChild();
        processModel( model, true );
    }

    private void processModel( DeploymentModel model, boolean flag )
    {
        if ( model instanceof ContainmentModel )
        {
            ContainmentModel containment = ( ContainmentModel ) model;
            if ( flag )
            {
                containment.addCompositionListener( this );
            }
            else
            {
                containment.removeCompositionListener( this );
            }
            DeploymentModel[] models = containment.getModels();
            for ( int i = 0; i < models.length; i++ )
            {
                processModel( models[i], flag );
            }
        }

But this is nit-picking :o)

Stephen's idea of LifeCycle extension is worth-while considering, but I wonder 
if the ComponentManagementCompositionListener will be instantiated early 
enough. Stephen ?

Niclas

-- 
+---------//-------------------+
|   http://www.bali.ac         |
|  http://niclas.hedhman.org   |
+------//----------------------+

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


Mime
View raw message