avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: State of the Aspect
Date Tue, 09 Mar 2004 15:18:07 GMT


> From: Jonathan Hawkes [mailto:jhawkes@adsnm.com] 
> 
> public interface Aspect {
>     void setContainer(Container c);
> }
> 
> public interface Container {
>     void addContainerServicesListener(ContainerServicesListener l); }
> 
> 
> Something like the java.beans.context package?  Registered 
> aspects can peruse or register to be notified of particular 
> containment services?

That would put a burden on the container to maintain a list
of services exposed and so on, and a burden on the aspect to
"pull" services from the container.

I was more thinking like this: Any aspect that can be monitored
exposes a Monitorable interface.

When you add a LoggerAspect, it will iterate over all existing 
aspects and connect to them via the Monitorable interface.

    public interface Monitorable {
        // Get the interface the monitor must implement
        public Class getMonitorClass ();
        // sets the monitor. It is guaranteed to implement the
        // interface given by the getMonitorClass method
        public void setMonitor (Object monitor);
    }

The aspect would then do:

   forall Aspect a in allCurrentAspects:
       if a instanceof Monitorable
           Class monitorClass = a.getMonitorClass();
           Object loggerMonitor = createLoggerMonitor (monitorClass);
           // loggerMonitor implements monitorClass
           a.setMonitor (loggerMonitor);

Thus, the logger/monitor aspect pushes services to those that want
it.

/LS


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


Mime
View raw message