Java Doc for CustomClassLoader.java in  » ESB » open-esb » com » sun » jbi » framework » 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 » ESB » open esb » com.sun.jbi.framework 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.net.URLClassLoader
   com.sun.jbi.framework.CustomClassLoader

CustomClassLoader
final public class CustomClassLoader extends java.net.URLClassLoader (Code)
Implementation of a custom class loader. There is one instance of this classloader per component lifecycle /bootstrap/shared library. This classloader subclasses java.net.URLClassLoader and implements functionality to force 'local' loading of classes at the component level before delegating it to the parent classloader . This is to allow the component/SL to load specific versions of libraries such as Xerces rather than be forced to use the JVM/Application Server version of the same .
author:
   Sun Microsystems, Inc.



Constructor Summary
public  CustomClassLoader(URL[] urls, ClassLoader parentCL, boolean selfFirst)
     Constructor.

Method Summary
public  URLgetResource(String name)
     Overloaded getResource method that implements the 'selfFirst' functionality .
public  InputStreamgetResourceAsStream(String name)
     Overloaded getResourceAsStream method for the 'selfFirst' functionality .
public  ClassloadClass(String name)
     Overloaded loadClass method that works similarly to the loadClass(String, boolean) method with false asthe second argument.
Parameters:
  name - The name of class to load.
protected  ClassloadClass(String name, boolean resolve)
     Overloaded loadClass method that implements the 'selfFirst=true/false' functionality .
public  voidreleaseResources()
     Releases all resources currently held in this classloader's cache.


Constructor Detail
CustomClassLoader
public CustomClassLoader(URL[] urls, ClassLoader parentCL, boolean selfFirst)(Code)
Constructor.
Parameters:
  urls - the urls to construct this class loader with
Parameters:
  parentCL - the parent of the component class loader
Parameters:
  selfFirst - flag indicating whether the componentshould try loading libraries itself first or delegate to its parent .




Method Detail
getResource
public URL getResource(String name)(Code)
Overloaded getResource method that implements the 'selfFirst' functionality . We need to overload getResource instead of findResource since we want to interfere with the normal Java2 class loading sequence . By the time the findResource() method is called, the parent class loader has already been asked to try and load the class - this is exactly what we are trying to circumvent .
See Also:   java.lang.ClassLoader.getResource(String)
See Also:   
See Also:   The sequence of looking for a resource is as follows -
See Also:   

    See Also:   
  • if 'selfFirst=false' hand off the loading to the parent i.e.
    See Also:   the Delegating ClassLoader for this classloader. If parent is null
    See Also:   the class loader built into the VM is used instead.
    See Also:   
  • call findResource() to try loading the resource locally, if it
    See Also:   succeeds , hand back the resource ,
    See Also:   
  • finally hand control to parent and let the
    See Also:   normal delegation class loading continue.
    See Also:   
  • if the resource was not found in above sequence, return NULL
    See Also:   

Parameters:
  name - The name of resource to load. The loaded resource.



getResourceAsStream
public InputStream getResourceAsStream(String name)(Code)
Overloaded getResourceAsStream method for the 'selfFirst' functionality . We need to overload getResourceAsStream since we want to interfere with the normal Java2 class loading sequence .
See Also:   java.lang.ClassLoader.getResourceAsStream(String)
See Also:   
See Also:   The sequence of looking for a resource is as follows -
See Also:   

    See Also:   
  • if 'selfFirst=false' hand off the loading to the parent i.e.
    See Also:   the Delegating ClassLoader for this classloader. If parent is null
    See Also:   the class loader built into the VM is used instead.
    See Also:   
  • call findResourceAsStream() to try loading the resource locally,
    See Also:   if it succeeds , hand back the resource ,
    See Also:   
  • finally hand control to parent and let the
    See Also:   normal delegation class loading continue.
    See Also:   
  • if the resource was not found in above sequence, return NULL
    See Also:   

Parameters:
  name - The name of resource to load. The loaded resource.



loadClass
public Class loadClass(String name) throws ClassNotFoundException(Code)
Overloaded loadClass method that works similarly to the loadClass(String, boolean) method with false asthe second argument.
Parameters:
  name - The name of class to load. The loaded class.
throws:
  ClassNotFoundException - If the class cannot be loaded by thisclassloader.



loadClass
protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)
Overloaded loadClass method that implements the 'selfFirst=true/false' functionality . We need to overload loadClass instead of findClass since we want to interfere with the normal Java2 class loading sequence . By the time the findClass() method is called, the parent class loader has already been asked to try and load the class - this is exactly what we are trying to circumvent .
See Also:   java.lang.ClassLoader.loadClass(Stringboolean)
See Also:   
See Also:   java.lang.ClassLoader.findClass(String)
See Also:   
See Also:   The sequence of looking for a class is as follows -
See Also:   

    See Also:   
  • call findLoadedClass(String) to check if the class has
    See Also:   already been loaded.
    See Also:   
  • if 'selfFirst=false' hand off the loading to the parent i.e.
    See Also:   the Delegating ClassLoader for this classloader. If parent is null
    See Also:   the class loader built into the VM is used instead.
    See Also:   
  • call findClass() to try loading the class locally, if it
    See Also:   succeeds , hand back the class
    See Also:   
  • finally hand control to parent and let the normal delegation
    See Also:   class loading continue.
    See Also:   
  • if class was not found in above sequence, throw a
    See Also:   ClassNotFoundException
    See Also:   
  • resolveClass is called at each stage before returning the
    See Also:   loaded class
    See Also:   

Parameters:
  name - The name of class to load.
Parameters:
  resolve - whether or not to reolve the loaded class. The loaded class.
throws:
  ClassNotFoundException - If the class cannot be loaded by thisclassloader.



releaseResources
public void releaseResources()(Code)
Releases all resources currently held in this classloader's cache.



Methods inherited from java.net.URLClassLoader
protected void addURL(URL url)(Code)(Java Doc)
protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException(Code)(Java Doc)
protected Class findClass(String name) throws ClassNotFoundException(Code)(Java Doc)
public URL findResource(String name)(Code)(Java Doc)
public Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc)
protected PermissionCollection getPermissions(CodeSource codesource)(Code)(Java Doc)
public URL[] getURLs()(Code)(Java Doc)
public static URLClassLoader newInstance(URL[] urls, ClassLoader parent)(Code)(Java Doc)
public static URLClassLoader newInstance(URL[] urls)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.