KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > joinpoint > Invocation


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.aop.joinpoint;
23
24 import org.jboss.aop.Advisor;
25 import org.jboss.aop.advice.Interceptor;
26 import org.jboss.aop.metadata.SimpleMetaData;
27
28 import java.util.Map JavaDoc;
29
30 /**
31  * Comment
32  *
33  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
34  * @version $Revision: 46058 $
35  */

36 public interface Invocation
37 {
38    Map JavaDoc getResponseContextInfo();
39
40    void setResponseContextInfo(Map JavaDoc responseContextInfo);
41
42    void addResponseAttachment(Object JavaDoc key, Object JavaDoc val);
43
44    Object JavaDoc getResponseAttachment(Object JavaDoc key);
45
46    /**
47     * Return all the contextual untyped data attached to this invocation
48     */

49    SimpleMetaData getMetaData();
50
51    /**
52     * Set all the contextual untyped data attached to this invocation
53     */

54    void setMetaData(SimpleMetaData data);
55
56    /**
57     * Resolve class level untyped metadata based on a key and the attribute of the key
58     *
59     * @param key
60     * @param attr
61     * @return
62     */

63    Object JavaDoc resolveClassMetaData(Object JavaDoc key, Object JavaDoc attr);
64
65    /**
66     * Abstraction for resolving an annotation so that
67     * it can be overriden from the Class
68     *
69     * @param annotation
70     * @return
71     */

72    Object JavaDoc resolveClassAnnotation(Class JavaDoc annotation);
73
74    /**
75     * Abstraction for resolving an annotation so that
76     * it can be overriden from the Method, Constructor, Field, etc.
77     *
78     * @param annotation
79     * @return
80     */

81    Object JavaDoc resolveAnnotation(Class JavaDoc annotation);
82    
83    /**
84     * Abstraction for resolving an annotation so that
85     * it can be overriden from the Method, Constructor, Field, etc.
86     *
87     * @param annotations
88     * @return
89     */

90    Object JavaDoc resolveAnnotation(Class JavaDoc[] annotations);
91
92     /**
93     * Invoke on the next interceptor in the chain. If this is already
94     * the end of the chain, reflection will call the constructor, field, or
95     * method you are invoking on.
96     */

97    Object JavaDoc invokeNext() throws Throwable JavaDoc;
98    
99    /**
100     * Invokes the target joinpoint for this invocation skipping any subsequent
101     * interceptors in the chain.
102     */

103    Object JavaDoc invokeTarget() throws Throwable JavaDoc;
104
105    /**
106     * Invoke on the next interceptor in the chain. If this is already
107     * the end of the chain, reflection will call the constructor, field, or
108     * method you are invoking on.
109     * <p/>
110     * The Invocation will use a new set of interceptors to do the invocation
111     */

112    Object JavaDoc invokeNext(Interceptor[] newInterceptors) throws Throwable JavaDoc;
113
114    Interceptor[] getInterceptors();
115
116    /**
117     * This method resolves untyped metadata based on the context of the invocation.
118     * It iterates through its list of MetaDataResolvers to find out the
119     * value of the metadata desired.
120     * <p/>
121     * This list usually is ThreadMetaData, InstanceAdvisor.getMetaData
122     * ClassAdvisor.getMethodMetaData (or field, or constructor)
123     * ClassAdvisor.getDefaultMetaData
124     */

125    Object JavaDoc getMetaData(Object JavaDoc group, Object JavaDoc attr);
126
127    Object JavaDoc getTargetObject();
128
129    void setTargetObject(Object JavaDoc targetObject);
130
131    /**
132     * Get a wrapper invocation object that can insert a new chain of interceptors
133     * at runtime to the invocation flow. CFlow makes use of this.
134     * When the wrapper object finishes its invocation chain it delegates back to
135     * the wrapped invocation.
136     *
137     * @param newchain
138     * @return
139     */

140    Invocation getWrapper(Interceptor[] newchain);
141
142    /**
143     * Copies complete state of Invocation object so that it could possibly
144     * be reused in a spawned thread.
145     *
146     * @return
147     */

148    public Invocation copy();
149
150    public Advisor getAdvisor();
151 }
152
Popular Tags