01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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: BaseInsertCallbackEvent.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger;
25:
26: import javax.ejb.EJB;
27: import javax.interceptor.InvocationContext;
28:
29: import org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
30: import org.ow2.util.log.Log;
31: import org.ow2.util.log.LogFactory;
32:
33: /**
34: * @author Eduardo Studzinski Estima de Castro
35: * @author Gisele Pinheiro Souza
36: *
37: */
38: public class BaseInsertCallbackEvent {
39:
40: /**
41: * Log helper.
42: */
43: private Log logger = LogFactory
44: .getLog(BaseInsertCallbackEvent.class);
45:
46: /**
47: * Bean logger.
48: */
49: @EJB(beanName="SLSBCallbackLoggerAccess")
50: private ItfCallbackLoggerAccess beanLogger;
51:
52: /**
53: * Log action.
54: * @param ic context
55: * @param type lifecycle interceptor type
56: * @param interceptorClass class that contains the interceptor method.
57: */
58: public void log(final InvocationContext ic,
59: final CallbackType type, final Class interceptorClass) {
60: log(ic.getTarget().getClass().getName(), type, interceptorClass
61: .getName());
62: }
63:
64: /**
65: * Log action.
66: * @param interceptedClass intercepted class
67: * @param type lifecycle interceptor type
68: * @param interceptorClass class that contains the interceptor method.
69: */
70: public void log(final Class interceptedClass,
71: final CallbackType type, final Class interceptorClass) {
72: log(interceptedClass.getName(), type, interceptorClass
73: .getName());
74: }
75:
76: /**
77: * Log action.
78: * @param interceptedClassName intercepted class name
79: * @param type lifecycle interceptor type
80: * @param interceptorClassName class that contains the interceptor method name.
81: */
82: public void log(final String interceptedClassName,
83: final CallbackType type, final String interceptorClassName) {
84: logger.debug("Logging event: {0}", interceptorClassName);
85: beanLogger.insertCallbackLogger(interceptedClassName, type,
86: interceptorClassName);
87: }
88: }
|