Java Doc for StandardClassLoader.java in  » Sevlet-Container » tomcat-catalina » org » apache » catalina » loader » 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 » Sevlet Container » tomcat catalina » org.apache.catalina.loader 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.net.URLClassLoader
   org.apache.catalina.loader.StandardClassLoader

StandardClassLoader
public class StandardClassLoader extends URLClassLoader implements Reloader,StandardClassLoaderMBean(Code)
Subclass implementation of java.net.URLClassLoader that knows how to load classes from disk directories, as well as local and remote JAR files. It also implements the Reloader interface, to provide automatic reloading support to the associated loader.

In all cases, URLs must conform to the contract specified by URLClassLoader - any URL that ends with a "/" character is assumed to represent a directory; all other URLs are assumed to be the address of a JAR file.

IMPLEMENTATION NOTE - Local repositories are searched in the order they are added via the initial constructor and/or any subsequent calls to addRepository().

IMPLEMENTATION NOTE - At present, there are no dependencies from this class to any other Catalina class, so that it could be used independently.
author:
   Craig R. McClanahan
author:
   Remy Maucherat
version:
   $Revision: 1.13 $ $Date: 2004/05/26 15:47:34 $



Field Summary
protected  intdebug
     The debugging detail level of this component.
protected  booleandelegate
     Should this class loader delegate to the parent class loader before searching its own repositories (i.e.
protected  URLStreamHandlerFactoryfactory
     URL stream handler for additional protocols.
protected  Stringrepositories
     The list of local repositories, in the order they should be searched for locally loaded classes or resources.

Constructor Summary
public  StandardClassLoader()
     Construct a new ClassLoader with no defined repositories and no parent ClassLoader.
public  StandardClassLoader(URLStreamHandlerFactory factory)
     Construct a new ClassLoader with no defined repositories and no parent ClassLoader, but with a stream handler factory.
public  StandardClassLoader(ClassLoader parent)
     Construct a new ClassLoader with no defined repositories and the specified parent ClassLoader.
public  StandardClassLoader(ClassLoader parent, URLStreamHandlerFactory factory)
     Construct a new ClassLoader with no defined repositories and the specified parent ClassLoader.
public  StandardClassLoader(String repositories)
     Construct a new ClassLoader with the specified repositories and no parent ClassLoader.
public  StandardClassLoader(String repositories, ClassLoader parent)
     Construct a new ClassLoader with the specified repositories and parent ClassLoader.
public  StandardClassLoader(URL repositories, ClassLoader parent)
     Construct a new ClassLoader with the specified repositories and parent ClassLoader.

Method Summary
public  voidaddRepository(String repository)
     Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
protected  voidaddRepositoryInternal(String repository)
     Add a repository to our internal array only.
protected static  URL[]convert(String input)
     Convert an array of String to an array of URL and return it.
protected static  URL[]convert(String input, URLStreamHandlerFactory factory)
     Convert an array of String to an array of URL and return it.
public  ClassfindClass(String name)
     Find the specified class in our local repositories, if possible.
protected  InputStreamfindLoadedResource(String name)
     Finds the resource with the given name if it has previously been loaded and cached by this class loader, and return an input stream to the resource data.
public  String[]findRepositories()
     Return a String array of the current repositories for this class loader.
public  URLfindResource(String name)
     Find the specified resource in our local repository, and return a URL refering to it, or null if this resource cannot be found.
public  EnumerationfindResources(String name)
     Return an enumeration of URLs representing all of the resources with the given name.
public  intgetDebug()
     Return the debugging detail level for this component.
public  booleangetDelegate()
     Return the "delegate first" flag for this class loader.
final protected  PermissionCollectiongetPermissions(CodeSource codeSource)
     Get the Permissions for a CodeSource.
public  URLgetResource(String name)
     Find the resource with the given name.
public  InputStreamgetResourceAsStream(String name)
     Find the resource with the given name, and return an input stream that can be used for reading it.
public  ClassloadClass(String name)
     Load the class with the specified name.
public  ClassloadClass(String name, boolean resolve)
     Load the class with the specified name, searching using the following algorithm until it finds and returns the class.
public  booleanmodified()
     This class loader doesn't check for reloading.
protected static  StringparseProtocol(String spec)
     Parse URL protocol.
public  voidsetDebug(int debug)
     Set the debugging detail level for this component.
public  voidsetDelegate(boolean delegate)
     Set the "delegate first" flag for this class loader.
protected  voidsetPermissions(String path)
     If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.
protected  voidsetPermissions(URL url)
     If there is a Java SecurityManager add a read FilePermission or JndiPermission for URL.
public  StringtoString()
     Render a String representation of this object.

Field Detail
debug
protected int debug(Code)
The debugging detail level of this component.



delegate
protected boolean delegate(Code)
Should this class loader delegate to the parent class loader before searching its own repositories (i.e. the usual Java2 delegation model)? If set to false, this class loader will search its own repositories first, and delegate to the parent only if the class or resource is not found locally.



factory
protected URLStreamHandlerFactory factory(Code)
URL stream handler for additional protocols.



repositories
protected String repositories(Code)
The list of local repositories, in the order they should be searched for locally loaded classes or resources.




Constructor Detail
StandardClassLoader
public StandardClassLoader()(Code)
Construct a new ClassLoader with no defined repositories and no parent ClassLoader.



StandardClassLoader
public StandardClassLoader(URLStreamHandlerFactory factory)(Code)
Construct a new ClassLoader with no defined repositories and no parent ClassLoader, but with a stream handler factory.
Parameters:
  factory - the URLStreamHandlerFactory to use when creating URLs



StandardClassLoader
public StandardClassLoader(ClassLoader parent)(Code)
Construct a new ClassLoader with no defined repositories and the specified parent ClassLoader.
Parameters:
  parent - The parent ClassLoader



StandardClassLoader
public StandardClassLoader(ClassLoader parent, URLStreamHandlerFactory factory)(Code)
Construct a new ClassLoader with no defined repositories and the specified parent ClassLoader.
Parameters:
  parent - The parent ClassLoader
Parameters:
  factory - the URLStreamHandlerFactory to use when creating URLs



StandardClassLoader
public StandardClassLoader(String repositories)(Code)
Construct a new ClassLoader with the specified repositories and no parent ClassLoader.
Parameters:
  repositories - The initial set of repositories



StandardClassLoader
public StandardClassLoader(String repositories, ClassLoader parent)(Code)
Construct a new ClassLoader with the specified repositories and parent ClassLoader.
Parameters:
  repositories - The initial set of repositories
Parameters:
  parent - The parent ClassLoader



StandardClassLoader
public StandardClassLoader(URL repositories, ClassLoader parent)(Code)
Construct a new ClassLoader with the specified repositories and parent ClassLoader.
Parameters:
  repositories - The initial set of repositories
Parameters:
  parent - The parent ClassLoader




Method Detail
addRepository
public void addRepository(String repository)(Code)
Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
Parameters:
  repository - Name of a source of classes to be loaded, such as adirectory pathname, a JAR file pathname, or a ZIP file pathname
exception:
  IllegalArgumentException - if the specified repository isinvalid or does not exist



addRepositoryInternal
protected void addRepositoryInternal(String repository)(Code)
Add a repository to our internal array only.
Parameters:
  repository - The new repository
exception:
  IllegalArgumentException - if the manifest of a JAR filecannot be processed correctly



convert
protected static URL[] convert(String input)(Code)
Convert an array of String to an array of URL and return it.
Parameters:
  input - The array of String to be converted



convert
protected static URL[] convert(String input, URLStreamHandlerFactory factory)(Code)
Convert an array of String to an array of URL and return it.
Parameters:
  input - The array of String to be converted
Parameters:
  factory - Handler factory to use to generate the URLs



findClass
public Class findClass(String name) throws ClassNotFoundException(Code)
Find the specified class in our local repositories, if possible. If not found, throw ClassNotFoundException.
Parameters:
  name - Name of the class to be loaded
exception:
  ClassNotFoundException - if the class was not found



findLoadedResource
protected InputStream findLoadedResource(String name)(Code)
Finds the resource with the given name if it has previously been loaded and cached by this class loader, and return an input stream to the resource data. If this resource has not been cached, return null.
Parameters:
  name - Name of the resource to return



findRepositories
public String[] findRepositories()(Code)
Return a String array of the current repositories for this class loader. If there are no repositories, a zero-length array is returned. For security reason, returns a clone of the Array (since String are immutable).



findResource
public URL findResource(String name)(Code)
Find the specified resource in our local repository, and return a URL refering to it, or null if this resource cannot be found.
Parameters:
  name - Name of the resource to be found



findResources
public Enumeration findResources(String name) throws IOException(Code)
Return an enumeration of URLs representing all of the resources with the given name. If no resources with this name are found, return an empty enumeration.
Parameters:
  name - Name of the resources to be found
exception:
  IOException - if an input/output error occurs



getDebug
public int getDebug()(Code)
Return the debugging detail level for this component.



getDelegate
public boolean getDelegate()(Code)
Return the "delegate first" flag for this class loader.



getPermissions
final protected PermissionCollection getPermissions(CodeSource codeSource)(Code)
Get the Permissions for a CodeSource. If this instance of StandardClassLoader is for a web application context, add read FilePermissions for the base directory (if unpacked), the context URL, and jar file resources.
Parameters:
  codeSource - where the code was loaded from PermissionCollection for CodeSource



getResource
public URL getResource(String name)(Code)
Find the resource with the given name. A resource is some data (images, audio, text, etc.) that can be accessed by class code in a way that is independent of the location of the code. The name of a resource is a "/"-separated path name that identifies the resource. If the resource cannot be found, return null.

This method searches according to the following algorithm, returning as soon as it finds the appropriate URL. If the resource cannot be found, returns null.

  • If the delegate property is set to true, call the getResource() method of the parent class loader, if any.
  • Call findResource() to find this resource in our locally defined repositories.
  • Call the getResource() method of the parent class loader, if any.

Parameters:
  name - Name of the resource to return a URL for



getResourceAsStream
public InputStream getResourceAsStream(String name)(Code)
Find the resource with the given name, and return an input stream that can be used for reading it. The search order is as described for getResource(), after checking to see if the resource data has been previously cached. If the resource cannot be found, return null.
Parameters:
  name - Name of the resource to return an input stream for



loadClass
public Class loadClass(String name) throws ClassNotFoundException(Code)
Load the class with the specified name. This method searches for classes in the same manner as loadClass(String, boolean) with false as the second argument.
Parameters:
  name - Name of the class to be loaded
exception:
  ClassNotFoundException - if the class was not found



loadClass
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)
Load the class with the specified name, searching using the following algorithm until it finds and returns the class. If the class cannot be found, returns ClassNotFoundException.
  • Call findLoadedClass(String) to check if the class has already been loaded. If it has, the same Class object is returned.
  • If the delegate property is set to true, call the loadClass() method of the parent class loader, if any.
  • Call findClass() to find this class in our locally defined repositories.
  • Call the loadClass() method of our parent class loader, if any.
If the class was found using the above steps, and the resolve flag is true, this method will then call resolveClass(Class) on the resulting Class object.
Parameters:
  name - Name of the class to be loaded
Parameters:
  resolve - If true then resolve the class
exception:
  ClassNotFoundException - if the class was not found



modified
public boolean modified()(Code)
This class loader doesn't check for reloading.



parseProtocol
protected static String parseProtocol(String spec)(Code)
Parse URL protocol. String protocol



setDebug
public void setDebug(int debug)(Code)
Set the debugging detail level for this component.
Parameters:
  debug - The new debugging detail level



setDelegate
public void setDelegate(boolean delegate)(Code)
Set the "delegate first" flag for this class loader.
Parameters:
  delegate - The new "delegate first" flag



setPermissions
protected void setPermissions(String path)(Code)
If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path.
Parameters:
  path - file directory path



setPermissions
protected void setPermissions(URL url)(Code)
If there is a Java SecurityManager add a read FilePermission or JndiPermission for URL.
Parameters:
  url - URL for a file or directory on local system



toString
public String toString()(Code)
Render a String representation of this object.



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.