Rio Project 4.2 API Documentation



org.rioproject.boot
Class ServiceClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by edu.emory.mathcs.util.classloader.URIClassLoader
                  extended by org.rioproject.boot.ServiceClassLoader
All Implemented Interfaces:
ClassAnnotation

public class ServiceClassLoader
extends edu.emory.mathcs.util.classloader.URIClassLoader
implements ClassAnnotation

The ServiceClassLoader overrides getURLs(), ensuring all classes that need to be annotated with specific location(s) are returned appropriately

Author:
Dennis Reedy

Constructor Summary
ServiceClassLoader(URI[] searchPath, ClassAnnotator annotator, ClassLoader parent)
          Constructs a new ServiceClassLoader for the specified URLs having the given parent.
ServiceClassLoader(URI[] searchPath, ClassAnnotator annotator, ClassLoader parent, Properties metaData)
          Constructs a new ServiceClassLoader for the specified URLs having the given parent.
 
Method Summary
 void addMetaData(Properties metaData)
          Add meta data associated with the classloader
 void addURLs(URL[] urls)
          Appends the specified URLs to the list of URLs to search for classes and resources.
 String getClassAnnotation()
          Get the class annotations as determined by the ClassAnnotator
 ClassAnnotator getClassAnnotator()
          Get the ClassAnnotator created at construction time
 Properties getMetaData()
          Get the meta data associated with this classloader
 URL[] getSearchPath()
          Get the search path of URLs for loading classes and resources
static URI[] getURIs(URL[] urls)
          Convert a URL[] into a URI[]
 URL[] getURLs()
          Get the URLs to be used for class annotations as determined by the ClassAnnotator
 String toString()
          Returns a String representation of this class loader.
 
Methods inherited from class edu.emory.mathcs.util.classloader.URIClassLoader
addURI, addURL, defineClass, findClass, findLibrary, findResource, findResources, getClassHandle, getJarHandler, getLibraryHandle, getResourceHandle, getResourceHandles
 
Methods inherited from class java.net.URLClassLoader
definePackage, getPermissions, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceClassLoader

public ServiceClassLoader(URI[] searchPath,
                          ClassAnnotator annotator,
                          ClassLoader parent)
Constructs a new ServiceClassLoader for the specified URLs having the given parent. The constructor takes two sets of URLs. The first set is where the class loader loads classes from, the second set is what it returns when getURLs() is called.

Parameters:
searchPath - Array of URIs to search for classes
annotator - Array of URLs to use for the codebase
parent - Parent ClassLoader to delegate to

ServiceClassLoader

public ServiceClassLoader(URI[] searchPath,
                          ClassAnnotator annotator,
                          ClassLoader parent,
                          Properties metaData)
Constructs a new ServiceClassLoader for the specified URLs having the given parent. The constructor takes two sets of URLs. The first set is where the class loader loads classes from, the second set is what it returns when getURLs() is called.

Parameters:
searchPath - Array of URIs to search for classes
annotator - Array of URLs to use for the codebase
parent - Parent ClassLoader to delegate to
metaData - Optional meta data associated with the classloader
Method Detail

getClassAnnotator

public ClassAnnotator getClassAnnotator()
Get the ClassAnnotator created at construction time

Returns:
The ClassAnnotator

getMetaData

public Properties getMetaData()
Get the meta data associated with this classloader

Returns:
A Properties object representing any meta data associated with this classloader. A new Properties object is created each time

addMetaData

public void addMetaData(Properties metaData)
Add meta data associated with the classloader

Parameters:
metaData - Properties to associate to this classloader. If the property already exists in the managed metaData, it will be replaced. New properties will be added. A null parameter will be ignored.

getURLs

public URL[] getURLs()
Get the URLs to be used for class annotations as determined by the ClassAnnotator

Overrides:
getURLs in class edu.emory.mathcs.util.classloader.URIClassLoader

getSearchPath

public URL[] getSearchPath()
                    throws MalformedURLException
Get the search path of URLs for loading classes and resources

Returns:
The array of URL[] which corresponds to the search path for the class loader; that is, the array elements are the locations from which the class loader will load requested classes.
Throws:
MalformedURLException - If any of the URis cannot be transformed to URLs

addURLs

public void addURLs(URL[] urls)
Appends the specified URLs to the list of URLs to search for classes and resources.

Parameters:
urls - The URLs to add

getClassAnnotation

public String getClassAnnotation()
Get the class annotations as determined by the ClassAnnotator

Specified by:
getClassAnnotation in interface ClassAnnotation
See Also:
ClassAnnotation.getClassAnnotation()

toString

public String toString()
Returns a String representation of this class loader.

Overrides:
toString in class Object

getURIs

public static URI[] getURIs(URL[] urls)
                     throws URISyntaxException
Convert a URL[] into a URI[]

Parameters:
urls - Array of URLs to convert
Returns:
Converted array of URIs
Throws:
URISyntaxException - If there are errors converting the URLs to URIs

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.