KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > interceptors > lifecycle > misc > AllLifeCallback00


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: AllLifeCallback00.java 602 2006-06-08 08:40:57Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.interceptors.lifecycle.misc;
26
27 import javax.annotation.PostConstruct;
28 import javax.annotation.PreDestroy;
29 import javax.ejb.PostActivate JavaDoc;
30 import javax.ejb.PrePassivate JavaDoc;
31 import javax.interceptor.InvocationContext;
32
33 import org.objectweb.easybeans.log.JLog;
34 import org.objectweb.easybeans.log.JLogFactory;
35
36 /**
37  * This interceptor contains methods to the four lifecycle callbacks.
38  * @author Eduardo Studzinski Estima de Castro
39  * @author Gisele Pinheiro Souza
40  */

41 public class AllLifeCallback00 {
42
43     /**
44      * Logger.
45      */

46     private JLog logger = JLogFactory.getLog(AllLifeCallback00.class);
47
48     /**
49      * Simple lifecyle callback interceptor method to PostConstruct.
50      * @param ic contains attributes of invocation
51      */

52     @PostConstruct
53     public void postConstruct(final InvocationContext ic){
54         logger.debug("PostConstruct method.");
55         try {
56             ic.proceed();
57         } catch (Exception JavaDoc e) {
58             return;
59         }
60     }
61
62     /**
63      * Simple lifecyle callback interceptor method to PreDestroy.
64      * @param ic contains attributes of invocation
65      */

66     @PreDestroy
67     public void preDestroy(final InvocationContext ic){
68         logger.debug("PreDestroy method.");
69         try {
70             ic.proceed();
71         } catch (Exception JavaDoc e) {
72             e.printStackTrace();
73         }
74     }
75
76     /**
77      * Simple lifecyle callback interceptor method to PostActivate.
78      * @param ic contains attributes of invocation
79      */

80     @PostActivate JavaDoc
81     public void postActivate(final InvocationContext ic){
82         logger.debug("PostActivate method.");
83         try {
84             ic.proceed();
85         } catch (Exception JavaDoc e) {
86             e.printStackTrace();
87         }
88     }
89
90     /**
91      * Simple lifecyle callback interceptor method to PrePassivate.
92      * @param ic contains attributes of invocation
93      */

94     @PrePassivate JavaDoc
95     public void prePassivate(final InvocationContext ic){
96         logger.debug("PrePassivate method.");
97         try {
98             ic.proceed();
99         } catch (Exception JavaDoc e) {
100             e.printStackTrace();
101         }
102     }
103
104 }
105
Popular Tags