[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: AOP ClassLoader/Scoping needs thoroughly revising

adrian@jboss.org do-not-reply at jboss.com
Thu Jul 5 10:54:49 EDT 2007


So what I'm getting at is that just determining the aop advices from the
classloader of the advice or the advised class is not enough.

What is really required, is for aop to use some notion of scope so it knows
what server/subsystem/deployment/class/instance it is working with.

I'm not asking for aop to implement anything related to scope
(it already exists in fact see below), but what we need is a mechanism
where the correct scope is used in each case.

An integration api (to replace AOPScopedClassLoaderHelper) might be something as simple as:

  | public interface DomainContextFactory
  | {
  |    // Get the domain from the current context (e.g. a thread local)
  |    Domain getDomain();
  | 
  |    // Get the domain for a specific scope
  |    // Not sure if you really need this but you have a getTopLevelClassLoader()
  |    // in the old api - not sure what is for?
  |    Domain getDomain(Scope scope);
  | }
  | 

You might have guessed from the signature that I'm suggesting using
the MetaDataRepository as the implementation of this api inside JBoss.

The idea being that a Domain can be added to different scopes
and populated by the AOPDeployer(s).

e.g. the default scope (what is currently now the AspectManager)
would be something like (pseudo code - not the real api for simplicity)

  | MetaData md = MetaDataRepository.getScope(ScopeLevel.JVM, "Instance");
  | Domain domain = rep.getMetaData(Domain.class);
  | 

The first method in the proposed api would be implemented as
(assuming the callers have setup the correct scope context)

  | MetaData md = MetaDataStack.peek();
  | Domain domain = rep.getMetaData(Domain.class);
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060854#4060854

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060854



More information about the jboss-dev-forums mailing list