KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Map JavaDoc;
31
32 /**
33  * Comment
34  *
35  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
36  * @version $Revision: 37406 $
37  *
38  **/

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