public class CommonClassLoader extends CustomURLClassLoader implements ComponentLoader
ComponentLoader
interface and is
created by the RioServiceDescriptor
or org.jini.rio.boot.RioActivatableServiceDescriptor
when starting a Rio service and contains
common declared platform JARs to be made available to its children.
The CommonClassLoader enables a platform oriented framework conducive towards creating a layered product. The resulting capabilities allow the declaration of JARs that are added to the CommonClassLoader, making the classes accessible by all ClassLoader instances which delegate to the CommonClassLoader. In this fashion a platform can be declared, initialized and made available.
The ClassLoader hierarchy when starting a Rio service is as follows :
AppCL | CommonClassLoader + | +-------+-------+----...---+ | | | Service-1CL Service-2CL Service-nCL |
Modifier and Type | Method and Description |
---|---|
void |
addCommonJARs(URL[] jars)
Add common JARs
|
void |
addComponent(String name,
URL[] urls)
Registers a class name, and the code source which is used as the search path to load the
class.
|
static CommonClassLoader |
getInstance()
Get an instance of the CommonCLassLoader
|
URL[] |
getSearchPath()
Alternate method for getURLs (some implementations override it in a non-traceable fashion)
|
URL[] |
getURLs()
Override getURLs to ensure when an Object is marshalled its annotation is correct
|
Object |
load(String name)
Creates an Object which has been added to the ComponentLoader using the addSystemComponent
method, or is in the classpath of the ComponentLoader.
|
void |
setDisableSmartGetUrl(boolean disableSmartGetUrl) |
boolean |
testComponentExistence(String name)
Test whether a named component (Class) exists.
|
boolean |
testResourceExistence(String name)
Test whether a named resource exists.
|
findClass, findResource, getLogName, getResource, loadClass, toString
addURL, close, definePackage, findResources, getPermissions, getResourceAsStream, newInstance, newInstance
defineClass, defineClass
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public void setDisableSmartGetUrl(boolean disableSmartGetUrl)
public static CommonClassLoader getInstance()
public URL[] getURLs()
getURLs
in class URLClassLoader
public URL[] getSearchPath()
CustomURLClassLoader
getSearchPath
in class CustomURLClassLoader
public boolean testComponentExistence(String name)
ComponentLoader
testComponentExistence
in interface ComponentLoader
name
- The component nameComponentLoader.testComponentExistence(java.lang.String)
public void addCommonJARs(URL[] jars)
jars
- Array of URLspublic boolean testResourceExistence(String name)
ComponentLoader
The name of a resource is a '/ '-separated path name that identifies the resource.
testResourceExistence
in interface ComponentLoader
name
- The resource nameComponentLoader.testResourceExistence(java.lang.String)
public void addComponent(String name, URL[] urls)
ComponentLoader
addComponent
in interface ComponentLoader
name
- The name of the classurls
- Codebase for the class identified by the name parameterComponentLoader.addComponent(java.lang.String, java.net.URL[])
public Object load(String name) throws ClassNotFoundException, IllegalAccessException, InstantiationException
ComponentLoader
load
in interface ComponentLoader
name
- The name of the class. The resulting class will be loaded and a new instance of
the class created using a zero-arg contructor.ClassNotFoundException
- - If the class cannot be located by the class loader or it has
not been registeredIllegalAccessException
- - If the Class or its nullary constructor is not accessible.InstantiationException
- - If this Class represents an abstract class, an interface, an
array class, a primitive type, or void; or if the class has no
nullary constructor; or if the instantiation fails for some
other reason.ComponentLoader.load(java.lang.String)
Copyright © GigaSpaces.