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


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2005 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: RemoteClassLoaderSpi.java 7557 2005-10-21 11:56:51Z coqp $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.server;
025:
026:        import java.net.MalformedURLException;
027:        import java.net.URLClassLoader;
028:        import java.rmi.server.RMIClassLoader;
029:        import java.rmi.server.RMIClassLoaderSpi;
030:
031:        import org.objectweb.carol.util.configuration.CarolDefaultValues;
032:
033:        /**
034:         * Class <code>RemoteClassLoaderSpi</code> is the CAROL JRMP CLass Loader SPI
035:         * for serialization performances.
036:         * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
037:         */
038:        public class RemoteClassLoaderSpi extends RMIClassLoaderSpi {
039:
040:            /**
041:             * Carol was already initialized
042:             */
043:            private static boolean carolIsInitialized = false;
044:
045:            /**
046:             * Local call optimization is set
047:             */
048:            private static boolean carolIsOptimized = false;
049:
050:            /**
051:             * Current provider
052:             */
053:            private final RMIClassLoaderSpi defaultProvider = RMIClassLoader
054:                    .getDefaultProviderInstance();
055:
056:            /**
057:             * Loads a class from a codebase URL path, optionally using the supplied
058:             * loader.
059:             * @param codebase the list of URLs (separated by spaces) to load the class
060:             *        from, or <code>null</code>
061:             * @param name the name of the class to load
062:             * @param defaultLoader additional contextual class loader to use, or
063:             *        <code>null</code>
064:             * @return the <code>Class</code> object representing the loaded class
065:             * @throws MalformedURLException if <code>codebase</code> is non-<code>null</code>
066:             *         and contains an invalid URL, or if <code>codebase</code> is
067:             *         <code>null</code> and the system property
068:             *         <code>java.rmi.server.codebase</code> contains an invalid URL
069:             * @throws ClassNotFoundException if a definition for the class could not be
070:             *         found at the specified location
071:             */
072:            public Class loadClass(String codebase, String name,
073:                    ClassLoader defaultLoader) throws MalformedURLException,
074:                    ClassNotFoundException {
075:                return defaultProvider.loadClass(codebase, name, defaultLoader);
076:            }
077:
078:            /**
079:             * Loads a dynamic proxy class (see {@link java.lang.reflect.Proxy} that
080:             * implements a set of interfaces with the given names from a codebase URL
081:             * path, optionally using the supplied loader.
082:             * @param codebase the list of URLs (space-separated) to load classes from,
083:             *        or <code>null</code>
084:             * @param interfaces the names of the interfaces for the proxy class to
085:             *        implement
086:             * @return a dynamic proxy class that implements the named interfaces
087:             * @param defaultLoader additional contextual class loader to use, or
088:             *        <code>null</code>
089:             * @throws MalformedURLException if <code>codebase</code> is non-<code>null</code>
090:             *         and contains an invalid URL, or if <code>codebase</code> is
091:             *         <code>null</code> and the system property
092:             *         <code>java.rmi.server.codebase</code> contains an invalid URL
093:             * @throws ClassNotFoundException if a definition for one of the named
094:             *         interfaces could not be found at the specified location, or if
095:             *         creation of the dynamic proxy class failed (such as if
096:             *         {@link java.lang.reflect.Proxy#getProxyClass(ClassLoader,Class[])}
097:             *         would throw an <code>IllegalArgumentException</code> for the
098:             *         given interface list)
099:             */
100:            public Class loadProxyClass(String codebase, String[] interfaces,
101:                    ClassLoader defaultLoader) throws MalformedURLException,
102:                    ClassNotFoundException {
103:                return defaultProvider.loadProxyClass(codebase, interfaces,
104:                        defaultLoader);
105:            }
106:
107:            /**
108:             * Returns a class loader that loads classes from the given codebase URL
109:             * path.
110:             * @param codebase the list of URLs (space-separated) from which the
111:             *        returned class loader will load classes from, or <code>null</code>
112:             * @return a class loader that loads classes from the given codebase URL
113:             *         path
114:             * @throws MalformedURLException if <code>codebase</code> is non-<code>null</code>
115:             *         and contains an invalid URL, or if <code>codebase</code> is
116:             *         <code>null</code> and the system property
117:             *         <code>java.rmi.server.codebase</code> contains an invalid URL
118:             */
119:            public ClassLoader getClassLoader(String codebase)
120:                    throws MalformedURLException {
121:                return defaultProvider.getClassLoader(codebase);
122:            }
123:
124:            /**
125:             * Returns the annotation string (representing a location for the class
126:             * definition) that RMI will use to annotate the class descriptor when
127:             * marshalling objects of the given class.<br>
128:             * By default, remove rmi annotations of JClassLoader class. Between two
129:             * JOnAS, commons classes are the same, don't need t have a bigger
130:             * annotation. When local call is set, always disable annotation.
131:             * @param cl the class to obtain the annotation for
132:             * @return a string to be used to annotate the given class when it gets
133:             *         marshalled, or <code>null</code>
134:             */
135:            public String getClassAnnotation(Class cl) {
136:                ClassLoader loader = cl.getClassLoader();
137:
138:                // Init values
139:                if (!carolIsInitialized) {
140:                    String sValue = System.getProperty(
141:                            CarolDefaultValues.LOCALREG_JRMP_PROPERTY, "init");
142:                    if (!sValue.equals("init")) {
143:                        carolIsOptimized = new Boolean(sValue).booleanValue();
144:                        carolIsInitialized = true;
145:                    }
146:
147:                }
148:
149:                if (loader instanceof  JClassLoader) {
150:                    return null;
151:                } else if ((loader instanceof  URLClassLoader)
152:                        && (carolIsOptimized)) {
153:                    return null;
154:                } else {
155:                    return defaultProvider.getClassAnnotation(cl);
156:                }
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.