Source Code Cross Referenced for JEntityRemote.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: JEntityRemote.java 7900 2006-01-18 16:04:21Z durieuxp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.container;
025:
026:        import java.rmi.Remote;
027:        import java.rmi.RemoteException;
028:
029:        import javax.ejb.EJBException;
030:        import javax.ejb.EJBHome;
031:        import javax.ejb.EJBObject;
032:
033:        import org.objectweb.carol.rmi.exception.RmiUtility;
034:
035:        import org.objectweb.jonas_ejb.lib.EJBInvocation;
036:
037:        import org.objectweb.util.monolog.api.BasicLevel;
038:
039:        /**
040:         * Generic part of the EJBObject implementation
041:         * @author Philippe Coq
042:         * @author Philippe Durieux
043:         */
044:        public abstract class JEntityRemote extends JRemote implements  Remote {
045:
046:            protected JEntityFactory ebf;
047:
048:            protected JEntitySwitch bs;
049:
050:            /**
051:             * constructor
052:             * @param bf The Entity Factory
053:             */
054:            public JEntityRemote(JEntityFactory bf) throws RemoteException {
055:                super (bf);
056:                if (TraceEjb.isDebugIc()) {
057:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
058:                }
059:                this .ebf = bf;
060:            }
061:
062:            /**
063:             * finish initialization
064:             * @param bs The Entity Bean Switch
065:             */
066:            public void setEntitySwitch(JEntitySwitch bs) {
067:                if (TraceEjb.isDebugIc()) {
068:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
069:                }
070:                this .bs = bs;
071:            }
072:
073:            // --------------------------------------------------------------------------
074:            // EJBObject implementation
075:            // remove() is implemented in the generated part.
076:            // --------------------------------------------------------------------------
077:
078:            /**
079:             * @return the enterprise Bean's home interface.
080:             */
081:            public EJBHome getEJBHome() {
082:                if (TraceEjb.isDebugIc()) {
083:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
084:                }
085:
086:                /*
087:                 * try/catch block is commented because the encapsulated code don't
088:                 * throw a RemoteException for the moment
089:                 * If the code changes and throws a such exception, let's think
090:                 * to uncomment it
091:                 *
092:                 * try {
093:                 */
094:
095:                return ebf.getHome();
096:
097:                /*
098:                 * } catch (RemoteException e) {
099:                 * // check if rmi exception mapping is needed - if yes the method  rethrows it
100:                 * RmiUtility.rethrowRmiException(e);
101:                 * // if not, throws the exception just as it is
102:                 * throw e;
103:                 * }
104:                 */
105:
106:            }
107:
108:            /**
109:             * @return the Primary Key for this EJBObject
110:             * @throws EJBException Bean has no primary key yet.
111:             */
112:            public Object getPrimaryKey() {
113:                if (TraceEjb.isDebugIc()) {
114:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
115:                }
116:                /*
117:                 * try/catch block is commented because the encapsulated code don't
118:                 * throw a RemoteException for the moment
119:                 * If the code changes and throws a such exception, let's think
120:                 * to uncomment it
121:                 *
122:                 * try {
123:                 */
124:
125:                if (bs == null) {
126:                    throw new EJBException("No Primary Key yet");
127:                }
128:                return bs.getPrimaryKey();
129:
130:                /*
131:                 * } catch (RemoteException e) {
132:                 * // check if rmi exception mapping is needed - if yes the method  rethrows it
133:                 * RmiUtility.rethrowRmiException(e);
134:                 * // if not, throws the exception just as it is
135:                 * throw e;
136:                 * }
137:                 */
138:
139:            }
140:
141:            /**
142:             * Tests if a given EJB is identical to the invoked EJB object.
143:             * @param obj - An object to test for identity with the invoked object.
144:             * @return True if the given EJB object is identical to the invoked object.
145:             * @throws RemoteException Thrown when the method failed due to a
146:             *         system-level failure.
147:             */
148:            public boolean isIdentical(EJBObject obj) throws RemoteException {
149:                if (TraceEjb.isDebugIc()) {
150:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
151:                }
152:
153:                try {
154:
155:                    boolean ret = false;
156:
157:                    if (obj != null) { // Get the home class name
158:                        String homeClassName = getEJBHome().getEJBMetaData()
159:                                .getHomeInterfaceClass().getName();
160:                        String objHomeClassName = obj.getEJBHome()
161:                                .getEJBMetaData().getHomeInterfaceClass()
162:                                .getName();
163:
164:                        // Tests the home equality and the primary key equality
165:                        ret = ((obj.equals(this )) || ((objHomeClassName
166:                                .equals(homeClassName)) && (obj.getPrimaryKey()
167:                                .equals(getPrimaryKey()))));
168:                    }
169:
170:                    return ret;
171:
172:                } catch (RemoteException e) {
173:                    // check if rmi exception mapping is needed - if yes the method rethrows it
174:                    RmiUtility.rethrowRmiException(e);
175:                    // if not, throws the exception just as it is
176:                    throw e;
177:                }
178:
179:            }
180:
181:            // ---------------------------------------------------------------
182:            // other public methods, for internal use.
183:            // ---------------------------------------------------------------
184:
185:            /**
186:             * preInvoke is called before any request.
187:             * @param txa Transaction Attribute (Supports, Required, ...)
188:             * @return A RequestCtx object
189:             * @throws RemoteException
190:             */
191:            public RequestCtx preInvoke(int txa) throws RemoteException {
192:                if (TraceEjb.isDebugIc()) {
193:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
194:                }
195:                return bf.preInvokeRemote(txa);
196:            }
197:
198:            /**
199:             * Check if the access to the bean is authorized
200:             * @param ejbInv object containing security signature of the method, args of
201:             *        method, etc
202:             */
203:            public void checkSecurity(EJBInvocation ejbInv) {
204:                if (TraceEjb.isDebugIc()) {
205:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
206:                }
207:                bf.checkSecurity(ejbInv);
208:            }
209:
210:            /**
211:             * postInvoke is called after any request.
212:             * @param rctx The RequestCtx that was returned at preInvoke()
213:             * @throws RemoteException
214:             */
215:            public void postInvoke(RequestCtx rctx) throws RemoteException {
216:                if (TraceEjb.isDebugIc()) {
217:                    TraceEjb.interp.log(BasicLevel.DEBUG, "");
218:                }
219:                try {
220:                    bf.postInvokeRemote(rctx);
221:                } finally {
222:                    bs.releaseICtx(rctx.currTx, rctx.sysExc != null);
223:                }
224:            }
225:
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.