Re: AspectJ and the Plexus core

Jason van Zyl <[email protected]> 03 Jul 2003 21:19:07 -0400
Newsgroups gmane.comp.java.plexus.devel
Organization Zenplex
Message-ID <[email protected]>
On Thu, 2003-07-03 at 08:59, Stephen Haberman wrote:
> Hi,
> 
> I just wanted to note that I think this runtime AspectJ stuff is
> very cool and would be a prime reason for convincing the company I'm
> currently working for for moving one of their applications into a
> container environment (something I've been looking forward to for
> awhile now).
> 
> The idea I have of how I'd like to use the runtime AOP features is
> to have introductions dynamically plugin modules into the system.
> 
> E.g. instead of having one huge domain model with every possible
> feature and then just flip them on and off by setting admin-level
> boolean variables, have each module be its own service that could
> then introduce itself to the other services.
> 
> E.g. the core user object has just the basics:
> 
>  user.name
>  user.address
> 
> But then after the accounting module is enabled in the config, one
> of it aspects runs and introduces into the user class:
> 
>  user.accounts
>  user.amountDue
> 
> Or what not.
> 
> Is this the kind of use case you're hoping AOP-enabled Plexus could
> solve? Or am I mis-understanding what you're trying to do?

Basically yes. With AspectJ currently there is no way to dynamically
load aspects, though it is close, but you can compile in various aspects
and have them be executed based on a runtime property.

But to answer your question more directly the basic tenet will be that
you will be able to morph the container and all of the components you
use to suit the requirements of your specific domain.

You can store your various aspects in JARs and with a little help from
the plexus plugin you could weave your aspects into the JARs that
contain all the third-party components you wish to use. You may write a
few yourself, you may use some from the plexus component repository, or
you may get them from some other source.

The basic plan is to provide an empty hull that all components will
extend. This is really to provide one clean place where you can make any
additions you want. So you can add new fields or methods using an aspect
and then weave this aspect into all the components by 'filling' up this
empty hull so to speak. 

I think a lot in biological terms so I think of this as an adaptive
container and you have adaptive components. With this method you could
easily add any domain specifics to any of the components without
touching them. In effect change the whole nervous system of the
container and components with a set of aspects.

The components provide some basic functionality like a persistence
mechanism or an smtp server and you could, say, weave in your own
notions of security. Anything is possible really.

> (As an aside, I have a lot of respect for the skills of people on
> this list, so if you have a bad gut reaction to my proposed
> architecture of AOP-introducted features, I'd appreciate it if you
> could say as much, even without a detailed explanation of why you
> think so).

Your idea is pretty much in line with the general direction we've been
moving in and actually a few weeks ago I made reference to the empty
hull notion and will implement when I get some time.

> Thanks,
> Stephen
> 
> _______________________________________________
> Plexus-dev mailing list
> [email protected]
> http://lists.codehaus.org/mailman/listinfo/plexus-dev
-- 
jvz.

Jason van Zyl
[email protected]
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society