KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > interceptors2 > XMLClassInterceptor3


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.ejb3.test.interceptors2;
23
24 import javax.interceptor.InvocationContext;
25
26 /**
27  *
28  * @author <a HREF="kabir.khan@jboss.com">Kabir Khan</a>
29  * @version $Revision: 44679 $
30  */

31 public class XMLClassInterceptor3
32 {
33    static int currentInstance;
34    int instance = ++currentInstance;
35
36    public Object JavaDoc intercept3(InvocationContext ctx) throws Exception JavaDoc
37    {
38       StatusBean.addInterceptionStatic(new Interception(this, "intercept3"));
39       return ctx.proceed();
40    }
41
42    public void postConstruct3(InvocationContext ctx)
43    {
44       StatusBean.addPostConstruct(new Interception(this, "postConstruct3", instance));
45       try
46       {
47          ctx.proceed();
48       }
49       catch (Exception JavaDoc e)
50       {
51          throw new RuntimeException JavaDoc(e);
52       }
53    }
54
55    public void postActivate3(InvocationContext ctx)
56    {
57       StatusBean.addPostActivate(new Interception(this, "postActivate3", instance));
58       try
59       {
60          ctx.proceed();
61       }
62       catch (Exception JavaDoc e)
63       {
64          throw new RuntimeException JavaDoc(e);
65       }
66    }
67
68    public void prePassivate3(InvocationContext ctx)
69    {
70       StatusBean.addPrePassivate(new Interception(this, "prePassivate3", instance));
71       try
72       {
73          ctx.proceed();
74       }
75       catch (Exception JavaDoc e)
76       {
77          throw new RuntimeException JavaDoc(e);
78       }
79    }
80
81    public void preDestroy3(InvocationContext ctx)
82    {
83       System.out.println("XMLClassInterceptor pd!");
84       StatusBean.addPreDestroy(new Interception(this, "preDestroy3", instance));
85       try
86       {
87          ctx.proceed();
88       }
89       catch (Exception JavaDoc e)
90       {
91          throw new RuntimeException JavaDoc(e);
92       }
93    }
94 }
95
Popular Tags