ehcache

net.sf.ehcache.management
Class ResourceClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by net.sf.ehcache.management.ResourceClassLoader

public class ResourceClassLoader
extends ClassLoader

ResourceClassLoader can load classes nested in a subdirectory of a jar Example : ehcache.jar!/net/sf/ehcache/CacheManager is in the "normal" classpath and will be loaded by any typical classloader ehcache.jar!/subdirectory/net/sf/ehcache/CacheManager can only be loaded by the ResourceClassLoader, with prefix "subdirectory" Assumes classes under prefix directory to have ending .clazz

Author:
Anthony Dahanne

Constructor Summary
ResourceClassLoader(String prefix, ClassLoader parent)
          Given a parent classloader and the prefix to apply to the lookup path Creates a ResourceClassLoader able to load classes from resources prefixed with "prefix"
 
Method Summary
protected  Class<?> findClass(String className)
           
protected  URL findResource(String name)
           
protected  Enumeration<URL> findResources(String name)
           
 URL getResource(String name)
           
 Enumeration<URL> getResources(String resourceName)
           
 Class<?> loadClass(String name, boolean resolve)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceClassLoader

public ResourceClassLoader(String prefix,
                           ClassLoader parent)
Given a parent classloader and the prefix to apply to the lookup path Creates a ResourceClassLoader able to load classes from resources prefixed with "prefix"

Parameters:
prefix -
parent -
Throws:
IOException
Method Detail

loadClass

public Class<?> loadClass(String name,
                          boolean resolve)
                   throws ClassNotFoundException
Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)
Overrides:
getResource in class ClassLoader

findResource

protected URL findResource(String name)
Overrides:
findResource in class ClassLoader

getResources

public Enumeration<URL> getResources(String resourceName)
                              throws IOException
Overrides:
getResources in class ClassLoader
Throws:
IOException

findResources

protected Enumeration<URL> findResources(String name)
                                  throws IOException
Overrides:
findResources in class ClassLoader
Throws:
IOException

findClass

protected Class<?> findClass(String className)
                      throws ClassNotFoundException
Overrides:
findClass in class ClassLoader
Throws:
ClassNotFoundException

ehcache

Copyright 2001-2017, Terracotta, Inc.