Source Code Cross Referenced for JSessionContext.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » container » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_ejb.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         *----------------------------------------------------------------
022:         * $Id: JSessionContext.java 7525 2005-10-19 10:43:24Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.container;
025:
026:        import java.io.Serializable;
027:        import java.rmi.RemoteException;
028:        import java.util.List;
029:
030:        import javax.ejb.EJBLocalObject;
031:        import javax.ejb.EJBObject;
032:        import javax.ejb.RemoveException;
033:        import javax.ejb.SessionBean;
034:        import javax.ejb.SessionContext;
035:        import javax.xml.rpc.handler.MessageContext;
036:
037:        import org.objectweb.util.monolog.api.BasicLevel;
038:
039:        /**
040:         * This class implements javax.ejb.SessionContext interface. it should be
041:         * implemented by JStatefulContext and JStatelessContext depending if the beans
042:         * is stateful or stateless.
043:         * @author Philippe Coq, Philippe Durieux
044:         */
045:
046:        public abstract class JSessionContext extends JContext implements 
047:                SessionContext, Serializable {
048:
049:            protected JSessionSwitch bs = null;
050:
051:            protected boolean ismarkedremoved;
052:
053:            /**
054:             * Constructs a SessionContext
055:             * @param bf The Session Factory
056:             * @param eb The Session bean instance
057:             */
058:            public JSessionContext(JSessionFactory bf, SessionBean eb) {
059:                super (bf, eb);
060:                if (TraceEjb.isDebugIc()) {
061:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
062:                }
063:            }
064:
065:            // ------------------------------------------------------------------
066:            // SessionContext implementation
067:            // ------------------------------------------------------------------
068:
069:            /**
070:             * Obtains a reference to the EJB object that is currently associated with
071:             * the instance.
072:             * @return The EJB object currently associated with the instance.
073:             * @exception IllegalStateException: Thrown if the instance invokes this
074:             *            method while the instance is in a state that does not allow
075:             *            the instance to invoke this method.
076:             */
077:            public EJBObject getEJBObject() throws IllegalStateException {
078:                if (TraceEjb.isDebugIc()) {
079:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
080:                }
081:                if (ismarkedremoved || bs == null) {
082:                    if (ismarkedremoved)
083:                        TraceEjb.logger.log(BasicLevel.ERROR, "marked removed");
084:                    else
085:                        TraceEjb.logger.log(BasicLevel.ERROR,
086:                                "no SessionSwitch");
087:                    throw new IllegalStateException(
088:                            "getEJBObject: EJB is removed");
089:                }
090:                EJBObject ejbobject = bs.getRemote();
091:                if (ejbobject == null) {
092:                    throw new IllegalStateException(
093:                            "No Remote Interface for this bean");
094:                }
095:                return ejbobject;
096:            }
097:
098:            /**
099:             * Obtain a reference to the EJB local object that is currently associated
100:             * with the instance.
101:             * @return The EJB local object currently associated with the instance.
102:             * @throws java.lang.IllegalStateException - if the instance invokes this
103:             *         method while the instance is in a state that does not allow the
104:             *         instance to invoke this method, or if the instance does not have
105:             *         a local interface.
106:             */
107:            public EJBLocalObject getEJBLocalObject()
108:                    throws IllegalStateException {
109:                if (TraceEjb.isDebugIc()) {
110:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
111:                }
112:                if (ismarkedremoved || bs == null) {
113:                    if (ismarkedremoved)
114:                        TraceEjb.logger.log(BasicLevel.ERROR, "marked removed");
115:                    else
116:                        TraceEjb.logger.log(BasicLevel.ERROR,
117:                                "no SessionSwitch");
118:                    throw new IllegalStateException(
119:                            "getEJBLocalObject: EJB is removed");
120:                }
121:                EJBLocalObject ejblocalobject = bs.getLocal();
122:                if (ejblocalobject == null)
123:                    throw new IllegalStateException(
124:                            "No Local Object for this bean");
125:                return ejblocalobject;
126:            }
127:
128:            /**
129:             * Obtain a reference to the JAX-RPC MessageContext.
130:             * @return The MessageContext for this web service invocation.
131:             * @throws java.lang.IllegalStateException - the instance is in a state that
132:             *         does not allow access to this method.
133:             */
134:            public abstract MessageContext getMessageContext()
135:                    throws java.lang.IllegalStateException;
136:
137:            /**
138:             * Tests if the transaction has been marked for rollback only.
139:             * @return true if transaction will rollback
140:             */
141:            public boolean getRollbackOnly() throws IllegalStateException {
142:                if (TraceEjb.isDebugIc()) {
143:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
144:                }
145:
146:                if (getState() < 2) {
147:                    throw new IllegalStateException(
148:                            "the instance is not allowed to call this method");
149:                }
150:                return super .getRollbackOnly();
151:            }
152:
153:            // -------------------------------------------------------------------
154:            // Other public methods
155:            // -------------------------------------------------------------------
156:
157:            /**
158:             * Reinit Context for reuse
159:             * @param bs The SessionSwitch to reuse.
160:             */
161:            public void initSessionContext(JSessionSwitch bs) {
162:                if (TraceEjb.isDebugIc()) {
163:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
164:                }
165:                this .bs = bs;
166:                ismarkedremoved = false;
167:            }
168:
169:            /**
170:             * Returns the bean instance of this context Used in the generated classes
171:             * to retrieve the instance
172:             * @return the bean instance
173:             * @throws RemoteException if no instance
174:             */
175:            // RemoteException is throwned to allow simpler genic templates
176:            public SessionBean getInstance() throws RemoteException {
177:                if (myinstance == null) {
178:                    TraceEjb.logger.log(BasicLevel.ERROR, "null!");
179:                    throw new RemoteException("No instance available");
180:                }
181:                return (SessionBean) myinstance;
182:            }
183:
184:            /**
185:             * @return True if bean instance is marked removed.
186:             */
187:            public boolean isMarkedRemoved() {
188:                return ismarkedremoved;
189:            }
190:
191:            // ------------------------------------------------------------------
192:            // Other methods
193:            // ------------------------------------------------------------------
194:
195:            abstract public void setRemoved() throws RemoteException,
196:                    RemoveException;
197:
198:            abstract public void setConnectionList(List conlist);
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.