org.jboss.classloader.spi.base
Class BaseClassLoaderPolicy

java.lang.Object
  extended by org.jboss.classloader.spi.base.BaseClassLoaderPolicy
Direct Known Subclasses:
ClassLoaderPolicy

public abstract class BaseClassLoaderPolicy
extends Object

Base ClassLoader policy.

This class hides some of the implementation details and allows package access to the protected methods.

Version:
$Revision: 1.1 $
Author:
Adrian Brock

Constructor Summary
BaseClassLoaderPolicy()
          Create a new BaseClassLoaderPolicy.
 
Method Summary
protected  void clearBlackList(String name)
          Cleans the entry with the given name from the blackList
protected  AccessControlContext getAccessControlContext()
          Get the access control context for this policy
protected abstract  List<? extends DelegateLoader> getDelegates()
          Get the delegate loaders for imported stuff
 String getDomainName()
          Get the classloader domain name
protected abstract  DelegateLoader getExported()
          Get the delegate loader for exported stuff
abstract  String[] getPackageNames()
          Get the exported packages
protected abstract  ProtectionDomain getProtectionDomain(String className, String path)
          Get the protection domain
protected abstract  boolean isBlackListable()
          Whether to cache misses
protected abstract  boolean isCachable()
          Whether to cache
protected abstract  boolean isImportAll()
          Whether to import all exports from other classloaders in the domain
protected abstract  ClassLoader isJDKRequest(String name)
          Check whether this a request from the jdk if it is return the relevant classloader
protected  void shutdownPolicy()
          Shutdown the policy
 String toLongString()
          A long version of toString()
protected  void toLongString(StringBuilder builder)
          For subclasses to add information for toLongString()
 String toString()
           
protected  byte[] transform(String className, byte[] byteCode, ProtectionDomain protectionDomain)
          Transform the byte code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseClassLoaderPolicy

public BaseClassLoaderPolicy()
Create a new BaseClassLoaderPolicy.

Throws:
SecurityException - if the caller does not have permission to create a classloader
Method Detail

getAccessControlContext

protected AccessControlContext getAccessControlContext()
Get the access control context for this policy

Returns:
the access control context

getExported

protected abstract DelegateLoader getExported()
Get the delegate loader for exported stuff

NOTE: Protected access for security reasons

Returns:
the delegate loader

getPackageNames

public abstract String[] getPackageNames()
Get the exported packages

Provides a hint for indexing

Returns:
the package names

getDelegates

protected abstract List<? extends DelegateLoader> getDelegates()
Get the delegate loaders for imported stuff

NOTE: Protected access for security reasons

Returns:
the delegate loaders

isImportAll

protected abstract boolean isImportAll()
Whether to import all exports from other classloaders in the domain

Returns:
true to import all

getProtectionDomain

protected abstract ProtectionDomain getProtectionDomain(String className,
                                                        String path)
Get the protection domain

NOTE: Defined as protected here for security reasons

Parameters:
className - the class name
path - the path
Returns:
the protection domain

transform

protected byte[] transform(String className,
                           byte[] byteCode,
                           ProtectionDomain protectionDomain)
                    throws Exception
Transform the byte code

By default, this delegates to the domain

Parameters:
className - the class name
byteCode - the byte code
protectionDomain - the protection domain
Returns:
the transformed byte code
Throws:
Exception - for any error

isCachable

protected abstract boolean isCachable()
Whether to cache

Returns:
true to cache

isBlackListable

protected abstract boolean isBlackListable()
Whether to cache misses

Returns:
true to cache misses

isJDKRequest

protected abstract ClassLoader isJDKRequest(String name)
Check whether this a request from the jdk if it is return the relevant classloader

Parameters:
name - the class name
Returns:
the classloader

toLongString

public String toLongString()
A long version of toString()

Returns:
the long string

toLongString

protected void toLongString(StringBuilder builder)
For subclasses to add information for toLongString()

Parameters:
builder - the builder

toString

public String toString()
Overrides:
toString in class Object

getDomainName

public String getDomainName()
Get the classloader domain name

Returns:
the domain

shutdownPolicy

protected void shutdownPolicy()
Shutdown the policy

The default implementation removes and shutdowns the classloader


clearBlackList

protected void clearBlackList(String name)
Cleans the entry with the given name from the blackList

Parameters:
name - the name of the resource to clear from the blackList


Copyright ? 2007 JBoss Inc.. All Rights Reserved.