org.apache.cocoon.classloader
Class AbstractClassLoaderFactory

java.lang.Object
  extended byorg.apache.cocoon.classloader.AbstractClassLoaderFactory
All Implemented Interfaces:
org.apache.cocoon.classloader.ClassLoaderFactory
Direct Known Subclasses:
DefaultClassLoaderFactory

public abstract class AbstractClassLoaderFactory
extends Object
implements org.apache.cocoon.classloader.ClassLoaderFactory

Abstract implementation of ClassLoaderFactory. It accepts both class directory and jar directory configurations.

Wildcard patterns can also be specified to include or exclude some classes to be loaded in the classloader. In such case, the class is directly loaded from the parent classloader. The default is to include all classes.

Example:

 <classpath>
   <class-dir src="BLOCK-INF/classes"/>
   <lib-dir src="BLOCK-INF/lib"/>
   <include-classes pattern="org.apache.cocoon.**"/>
   <exclude-classes pattern="org.apache.cocoon.transformation.**"/>
 &/lt;classpath>
 

Since:
2.2
Version:
$Id: AbstractClassLoaderFactory.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
protected static class AbstractClassLoaderFactory.JarFileFilter
           
protected static class AbstractClassLoaderFactory.UrlComparator
           
 
Field Summary
 
Fields inherited from interface org.apache.cocoon.classloader.ClassLoaderFactory
ROLE
 
Constructor Summary
AbstractClassLoaderFactory()
           
 
Method Summary
 ClassLoader createClassLoader(ClassLoader parent, org.apache.cocoon.classloader.ClassLoaderConfiguration config, ServletContext servletContext)
           
protected abstract  ClassLoader createClassLoader(URL[] urls, List includePatterns, List excludePatterns, ClassLoader parent)
           
protected  String getContextPath(String path)
           
protected  File getFile(String path)
           
protected  URL getUrl(ServletContext servletContext, String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractClassLoaderFactory

public AbstractClassLoaderFactory()
Method Detail

getUrl

protected URL getUrl(ServletContext servletContext,
                     String path)
              throws MalformedURLException
Throws:
MalformedURLException

getFile

protected File getFile(String path)
                throws MalformedURLException
Throws:
MalformedURLException

getContextPath

protected String getContextPath(String path)

createClassLoader

public ClassLoader createClassLoader(ClassLoader parent,
                                     org.apache.cocoon.classloader.ClassLoaderConfiguration config,
                                     ServletContext servletContext)
                              throws Exception
Specified by:
createClassLoader in interface org.apache.cocoon.classloader.ClassLoaderFactory
Throws:
Exception

createClassLoader

protected abstract ClassLoader createClassLoader(URL[] urls,
                                                 List includePatterns,
                                                 List excludePatterns,
                                                 ClassLoader parent)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.