KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > aspect > AspectContainer


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.aspect;
5
6 /**
7  * Interface that all aspect container implementations must implement.
8  * <p/>
9  * An implementation can have a no-arg constructor or a constructor with 5 args:
10  * Class aspectClass, ClassLoader aopSystemClassLoader, String systemUuid, String aspectQualifiedName (composed of systemUuid and given aspect name
11  * in the aop.xml that defines it), Map (of parameters declared in the aop.xml for this aspect declaration).
12  * <p/>
13  * An Aspect can have no aspect container at all. In such a case, the aspect is simply created using its no-arg
14  * constructor (thus in a faster way).
15  * <p/>
16  * Note that the container will only be invoked for aspect instantiation, but not for aspect lookup (association).
17  * The lookup is handled by the deployment model semantics and thus by the framework.
18  *
19  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
20  * @author <a HREF="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
21  */

22 public interface AspectContainer {
23
24   /**
25    * Creates a new perJVM cross-cutting instance, if it already exists then return it.
26    *
27    * @return the cross-cutting instance
28    */

29   Object JavaDoc aspectOf();
30
31   /**
32    * Creates a new perClass cross-cutting instance, if it already exists then return it.
33    *
34    * @param klass
35    * @return the cross-cutting instance
36    */

37   Object JavaDoc aspectOf(Class JavaDoc klass);
38
39   /**
40    * Creates a new perInstance cross-cutting instance, if it already exists then return it.
41    *
42    * @param instance
43    * @return the cross-cutting instance
44    */

45   Object JavaDoc aspectOf(Object JavaDoc instance);
46
47   /**
48    * Creates a new perThread cross-cutting instance, if it already exists then return it.
49    *
50    * @param thread the thread for the aspect
51    * @return the cross-cutting instance
52    */

53   Object JavaDoc aspectOf(Thread JavaDoc thread);
54
55 }
Popular Tags