Top Description Inners Fields Constructors Methods
org.apache.catalina.startup

public final Class ClassLoaderFactory

extends Object
Class Inheritance
Imports
java.io.File, .IOException, java.net.MalformedURLException, .URI, .URISyntaxException, .URL, .URLClassLoader, java.security.AccessController, .PrivilegedAction, java.util.LinkedHashSet, .List, .Locale, .Set, org.apache.juli.logging.Log, .LogFactory

Utility class for building class loaders for Catalina. The factory method requires the following parameters in order to build a new class loader (with suitable defaults in all cases):

Author
Craig R. McClanahan

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static enum

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static URL
private static URL
public static ClassLoader

Returns:

the new class loader
createClassLoader
(File[]
Array of pathnames to unpacked directories that should be added to the repositories of the class loader, or null for no unpacked directories to be considered
unpacked
,
File[]
Array of pathnames to directories containing JAR files that should be added to the repositories of the class loader, or null for no directories of JAR files to be considered
packed
,
final ClassLoader
Parent class loader for the new class loader, or null for the system class loader.
parent
)

Create and return a new class loader, based on the configuration defaults and the specified directory paths:

public static ClassLoader

Returns:

the new class loader
createClassLoader
(List<ClassLoaderFactory.Repository>
List of class directories, jar files, jar directories or URLS that should be added to the repositories of the class loader.
repositories
,
final ClassLoader
Parent class loader for the new class loader, or null for the system class loader.
parent
)

Create and return a new class loader, based on the configuration defaults and the specified directory paths:

private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Log log

Constructor Detail

ClassLoaderFactoryback to summary
public ClassLoaderFactory()

Method Detail

buildClassLoaderUrlback to summary
private static URL buildClassLoaderUrl(String urlString) throws MalformedURLException, URISyntaxException
buildClassLoaderUrlback to summary
private static URL buildClassLoaderUrl(File file) throws MalformedURLException, URISyntaxException
createClassLoaderback to summary
public static ClassLoader createClassLoader(File[] unpacked, File[] packed, final ClassLoader parent) throws Exception

Create and return a new class loader, based on the configuration defaults and the specified directory paths:

Parameters
unpacked:File[]

Array of pathnames to unpacked directories that should be added to the repositories of the class loader, or null for no unpacked directories to be considered

packed:File[]

Array of pathnames to directories containing JAR files that should be added to the repositories of the class loader, or null for no directories of JAR files to be considered

parent:ClassLoader

Parent class loader for the new class loader, or null for the system class loader.

Returns:ClassLoader

the new class loader

Exceptions
Exception:
if an error occurs constructing the class loader
createClassLoaderback to summary
public static ClassLoader createClassLoader(List<ClassLoaderFactory.Repository> repositories, final ClassLoader parent) throws Exception

Create and return a new class loader, based on the configuration defaults and the specified directory paths:

Parameters
repositories:List<ClassLoaderFactory.Repository>

List of class directories, jar files, jar directories or URLS that should be added to the repositories of the class loader.

parent:ClassLoader

Parent class loader for the new class loader, or null for the system class loader.

Returns:ClassLoader

the new class loader

Exceptions
Exception:
if an error occurs constructing the class loader
validateFileback to summary
private static boolean validateFile(File file, ClassLoaderFactory.RepositoryType type) throws IOException
org.apache.catalina.startup back to summary

public Class ClassLoaderFactory.Repository

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
private final ClassLoaderFactory.RepositoryType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public ClassLoaderFactory.RepositoryType
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locationback to summary
private final String location
typeback to summary
private final ClassLoaderFactory.RepositoryType type

Constructor Detail

Repositoryback to summary
public Repository(String location, ClassLoaderFactory.RepositoryType type)

Method Detail

getLocationback to summary
public String getLocation()
getTypeback to summary
public ClassLoaderFactory.RepositoryType getType()
org.apache.catalina.startup back to summary

public final Enum ClassLoaderFactory.RepositoryType

extends Enum<ClassLoaderFactory.RepositoryType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ClassLoaderFactory.RepositoryType
public static final ClassLoaderFactory.RepositoryType
public static final ClassLoaderFactory.RepositoryType
public static final ClassLoaderFactory.RepositoryType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ClassLoaderFactory.RepositoryType
public static ClassLoaderFactory.RepositoryType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DIRback to summary
public static final ClassLoaderFactory.RepositoryType DIR
GLOBback to summary
public static final ClassLoaderFactory.RepositoryType GLOB
JARback to summary
public static final ClassLoaderFactory.RepositoryType JAR
URLback to summary
public static final ClassLoaderFactory.RepositoryType URL

Constructor Detail

RepositoryTypeback to summary
private RepositoryType()

Method Detail

valueOfback to summary
public static ClassLoaderFactory.RepositoryType valueOf(String name)
valuesback to summary
public static ClassLoaderFactory.RepositoryType[] values()