KickJava   Java API By Example, From Geeks To Geeks.

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


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.MetaDataResolver;
27 import org.jboss.aop.metadata.SimpleMetaData;
28
29 import java.lang.reflect.Constructor JavaDoc;
30 import java.lang.reflect.Method JavaDoc;
31 import java.util.Map JavaDoc;
32
33 /**
34  * Comment
35  *
36  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
37  * @version $Revision: 44098 $
38  *
39  **/

40 public class ConstructorCalledByConstructorInvocationWrapper extends ConstructorCalledByConstructorInvocation
41 {
42    private static final long serialVersionUID = -3045541205784967429L;
43    
44    ConstructorCalledByConstructorInvocation wrapped;
45
46    public ConstructorCalledByConstructorInvocationWrapper(ConstructorCalledByConstructorInvocation wrapped, Interceptor[] interceptors)
47    {
48       super(interceptors);
49       this.wrapped = wrapped;
50    }
51
52    public Object JavaDoc getMetaData(Object JavaDoc group, Object JavaDoc attr)
53    {
54       return wrapped.getMetaData(group, attr);
55    }
56
57    public Object JavaDoc invokeNext() throws Throwable JavaDoc
58    {
59       if (interceptors != null && currentInterceptor < interceptors.length)
60       {
61          try
62          {
63             return interceptors[currentInterceptor++].invoke(this);
64          }
65          finally
66          {
67             // so that interceptors like clustering can reinvoke down the chain
68
currentInterceptor--;
69          }
70       }
71       try
72       {
73          return wrapped.invokeNext();
74       }
75       finally
76       {
77          responseContextInfo = wrapped.getResponseContextInfo();
78       }
79    }
80
81    public MetaDataResolver getInstanceResolver()
82    {
83       return wrapped.getInstanceResolver();
84    }
85
86    public Object JavaDoc[] getArguments()
87    {
88       return wrapped.getArguments();
89    }
90
91    public void setArguments(Object JavaDoc[] arguments)
92    {
93       wrapped.setArguments(arguments);
94    }
95
96    public Constructor JavaDoc getCallingConstructor()
97    {
98       return wrapped.getCallingConstructor();
99    }
100
101    public Constructor JavaDoc getCalledConstructor()
102    {
103       return wrapped.getCalledConstructor();
104    }
105
106    public boolean isWrapped()
107    {
108       return wrapped.isWrapped();
109    }
110
111    public Method JavaDoc getWrappingMethod()
112    {
113       return wrapped.getWrappingMethod();
114    }
115
116    public Invocation copy()
117    {
118       ConstructorCalledByConstructorInvocationWrapper invocation = new ConstructorCalledByConstructorInvocationWrapper((ConstructorCalledByConstructorInvocation)wrapped.copy(), interceptors);
119       invocation.currentInterceptor = this.currentInterceptor;
120       return invocation;
121    }
122
123    public Map JavaDoc getResponseContextInfo()
124    {
125       return wrapped.getResponseContextInfo();
126    }
127
128    public void addResponseAttachment(Object JavaDoc key, Object JavaDoc val)
129    {
130       wrapped.addResponseAttachment(key, val);
131    }
132
133    public void setResponseContextInfo(Map JavaDoc responseContextInfo)
134    {
135       wrapped.setResponseContextInfo(responseContextInfo);
136    }
137
138    public Object JavaDoc getResponseAttachment(Object JavaDoc key)
139    {
140       return wrapped.getResponseAttachment(key);
141    }
142
143    public SimpleMetaData getMetaData()
144    {
145       return wrapped.getMetaData();
146    }
147
148    public void setMetaData(SimpleMetaData data)
149    {
150       wrapped.setMetaData(data);
151    }
152
153    public Advisor getAdvisor()
154    {
155       return wrapped.getAdvisor();
156    }
157
158    public Object JavaDoc getTargetObject()
159    {
160       return wrapped.getTargetObject();
161    }
162
163    public void setTargetObject(Object JavaDoc targetObject)
164    {
165       wrapped.setTargetObject(targetObject);
166    }
167 }
168
Popular Tags