> From: Hamilton Verissimo de Oliveira (Engenharia - SPO)
>
> -----Mensagem original-----
> De: Leo Sutic [mailto:[EMAIL PROTECTED]
>
> > The handlers then allow for extensions to plug in where appropriate
> > *for the component type*.
>
> How's that? Tell me about it.
I'm a little confused by your question - do you want to know what I
mean by "where appropriate" or how the extension is plugged in?
This is how it is plugged in:
You have this interface:
interface LifecycleInterceptor {
public Object interceptCreation (Object instance);
public Object interceptAccess (String accessor, Object
instance);
}
Each method can do either or both of:
+ Proxy the instance, return the proxy.
+ Call some method in the instance.
For example, you'd implement Initializable like this:
public Object interceptCreation (Object instance) {
if (instance instanceof Initializable) {
((Initializable) instance).initialize ();
}
return instance;
}
If you wanted to proxy the object, you'd do:
public Object interceptCreation (Object instance) {
Object proxy = createProxy (instance);
return proxy;
}
Now, the question is, *when* do you apply the creation intercepts?
+ For an Avalon 4 component, it should be before Initialize.
+ For a Pico component, it should be after construction.
You have Handlers that manage component instances, so it is there
that these LifecycleInterceptors are called:
http://cvs.apache.org/viewcvs.cgi/avalon-sandbox/aspect/src/java/org/apa
che/avalon/aspect/Avalon4ComponentHandler.java?rev=1.1&view=markup
And this is how an Aspect provides the interceptor:
http://cvs.apache.org/viewcvs.cgi/avalon-sandbox/aspect/src/java/org/apa
che/avalon/aspect/SecurityAspect.java?rev=1.1&view=markup
/LS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]