Source Code Cross Referenced for JHomeHandleIIOP.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » svc » 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.svc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 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: JHomeHandleIIOP.java 6072 2005-01-12 14:40:21Z pelletib $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.svc;
025:
026:        import java.io.IOException;
027:        import java.io.Serializable;
028:        import java.rmi.RemoteException;
029:
030:        import javax.ejb.EJBHome;
031:        import javax.ejb.HomeHandle;
032:        import javax.ejb.spi.HandleDelegate;
033:        import java.util.logging.Level;
034:        import java.util.logging.Logger;
035:
036:        import javax.naming.NamingException;
037:        import javax.rmi.PortableRemoteObject;
038:        import javax.rmi.CORBA.Util;
039:
040:        import org.omg.PortableServer.Servant;
041:
042:        /**
043:         * This class implements javax.ejb.HomeHandle interface. A handle is an
044:         * abstraction of a network reference to a home object. A handle is intended to
045:         * be used as a "robust" persistent reference to a home object.
046:         * @author Philippe Durieux, Philippe Coq
047:         */
048:        public class JHomeHandleIIOP implements  HomeHandle, Serializable {
049:
050:            /**
051:             * JDK logger to be portable
052:             */
053:            private static Logger logger = Logger
054:                    .getLogger("org.objectweb.jonas_ejb.svc");
055:
056:            /**
057:             * CORBA ref
058:             * @serial
059:             */
060:            private String ior = null;
061:
062:            /**
063:             * Classloader of EJB
064:             */
065:            private ClassLoader cl = null;
066:
067:            /**
068:             * EjbHome class
069:             */
070:            private EJBHome ejbHome = null;
071:
072:            /**
073:             * constructor
074:             * @param h EJBHome
075:             * @param cl classloader used for EJB
076:             */
077:            public JHomeHandleIIOP(EJBHome h, ClassLoader cl) {
078:                logger.log(Level.FINE, "h=" + h);
079:                try {
080:                    Servant servant = (Servant) Util.getTie(h);
081:                    org.omg.CORBA.Object o = servant._this _object();
082:                    this .ior = Utility.getORB().object_to_string(o);
083:                    this .cl = cl;
084:                    logger.log(Level.FINE, "ior=" + ior);
085:                } catch (Exception e) {
086:                    logger.log(Level.SEVERE, "cannot get Handle: ", e);
087:                }
088:            }
089:
090:            // -----------------------------------------------------------------------
091:            // HomeHandle implementation
092:            // -----------------------------------------------------------------------
093:
094:            /**
095:             * Obtains the home object represented by this handle.
096:             * @throws RemoteException The home object could not be obtained because of
097:             *         a system-level failure.
098:             * @return The EJBHome object
099:             */
100:            public EJBHome getEJBHome() throws RemoteException {
101:                logger.log(Level.FINE, "");
102:                ClassLoader old = Thread.currentThread()
103:                        .getContextClassLoader();
104:                logger.log(Level.FINE, "");
105:                if (ejbHome == null) {
106:                    try {
107:                        Thread.currentThread().setContextClassLoader(cl);
108:                        ejbHome = (EJBHome) PortableRemoteObject.narrow(Utility
109:                                .getORB().string_to_object(ior), EJBHome.class);
110:                    } catch (NamingException e) {
111:                        throw new RemoteException("getEJBHome:" + e);
112:                    } finally {
113:                        // reset
114:                        Thread.currentThread().setContextClassLoader(old);
115:                    }
116:                }
117:                return ejbHome;
118:            }
119:
120:            /**
121:             * Specific implementation of serialization.
122:             * Must call HandleDelegate.writeEJBObject, as specified in 19.5.5.1 of spec EJB 2.1
123:             * @param out The output stream used to write object
124:             * @throws IOException error when writing object.
125:             */
126:            private void writeObject(java.io.ObjectOutputStream out)
127:                    throws IOException {
128:                logger.log(Level.FINE, "");
129:                HandleDelegate hdld;
130:                try {
131:                    hdld = Utility.getHandleDelegate();
132:                } catch (NamingException e) {
133:                    throw new IOException("Cannot get HandleDelegate");
134:                }
135:                hdld.writeEJBHome(getEJBHome(), out);
136:            }
137:
138:            /**
139:             * Specific implementation of deserialization.
140:             * Must call HandleDelegate.readEJBObject, as specified in 19.5.5.1 of spec EJB 2.1
141:             * @param in The input Stream from where is read the object.
142:             * @throws IOException error when reading object.
143:             * @throws ClassNotFoundException -
144:             */
145:            private void readObject(java.io.ObjectInputStream in)
146:                    throws IOException, ClassNotFoundException {
147:                logger.log(Level.FINE, "");
148:                HandleDelegate hdld;
149:                try {
150:                    hdld = Utility.getHandleDelegate();
151:                } catch (NamingException e) {
152:                    throw new IOException("Cannot get HandleDelegate");
153:                }
154:                try {
155:                    ejbHome = hdld.readEJBHome(in);
156:                } catch (ClassNotFoundException e) {
157:                    logger.log(Level.SEVERE, "Cant read EJBHome:" + e);
158:                    throw e;
159:                } catch (IOException e) {
160:                    logger.log(Level.SEVERE, "Cant read EJBHome:" + e);
161:                    throw e;
162:                }
163:            }
164:
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.