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.ejb.plugins;
23
24 import java.util.Map;
25
26 import org.jboss.invocation.Invocation;
27
28 import org.jboss.metadata.SessionMetaData;
29
30 /**
31 * This interceptor handles transactions for session BMT beans.
32 *
33 * @author <a href="mailto:marc.fleury@telkel.com">Marc Fleury</a>
34 * @author <a href="mailto:sebastien.alborini@m4x.org">Sebastien Alborini</a>
35 * @author <a href="mailto:peter.antman@tim.se">Peter Antman</a>.
36 * @author <a href="mailto:akkerman@cs.nyu.edu">Anatoly Akkerman</a>
37 * @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
38 * @version $Revision: 37459 $
39 */
40 public class TxInterceptorBMT
41 extends AbstractTxInterceptorBMT
42 {
43
44 // Attributes ----------------------------------------------------
45
46 // Static --------------------------------------------------------
47
48 // Constructors --------------------------------------------------
49
50 // Public --------------------------------------------------------
51
52 // Interceptor implementation --------------------------------------
53
54 public void create()
55 throws Exception
56 {
57 // Do initialization in superclass.
58 super.create();
59
60 // Set the atateless attribute
61 stateless = ((SessionMetaData)container.getBeanMetaData()).isStateless();
62 }
63
64 public Object invokeHome(Invocation mi)
65 throws Exception
66 {
67 // stateless: no context, no transaction, no call to the instance
68 if (stateless || mi.getEnterpriseContext() == null)
69 return getNext().invokeHome(mi);
70 else
71 return invokeNext(mi);
72 }
73
74 public Object invoke(Invocation mi)
75 throws Exception
76 {
77 return invokeNext(mi);
78 }
79
80 // Monitorable implementation ------------------------------------
81 public void sample(Object s)
82 {
83 // Just here to because Monitorable request it but will be removed soon
84 }
85 public Map retrieveStatistic()
86 {
87 return null;
88 }
89 public void resetStatistic()
90 {
91 }
92
93 // Protected ----------------------------------------------------
94
95 // Inner classes -------------------------------------------------
96
97 }
98