Package org.jini.rio.boot
Class CommonClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
com.gigaspaces.classloader.CustomURLClassLoader
org.jini.rio.boot.CommonClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable,LoggableClassLoader,ComponentLoader
The CommonClassLoader implements
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 |
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommonJARs(URL[] jars) Add common JARsvoidaddComponent(String name, URL[] urls) Registers a class name, and the code source which is used as the search path to load the class.static CommonClassLoaderGet an instance of the CommonCLassLoaderURL[]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 correctCreates an Object which has been added to the ComponentLoader using the addSystemComponent method, or is in the classpath of the ComponentLoader.voidsetDisableSmartGetUrl(boolean disableSmartGetUrl) booleantestComponentExistence(String name) Test whether a named component (Class) exists.booleantestResourceExistence(String name) Test whether a named resource exists.Methods inherited from class com.gigaspaces.classloader.CustomURLClassLoader
findClass, findResource, getLogName, getResource, loadClass, toStringMethods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findResources, getPermissions, getResourceAsStream, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Method Details
-
setDisableSmartGetUrl
public void setDisableSmartGetUrl(boolean disableSmartGetUrl) -
getInstance
Get an instance of the CommonCLassLoader- Returns:
- The CommonClassLoader
-
getURLs
Override getURLs to ensure when an Object is marshalled its annotation is correct- Overrides:
getURLsin classURLClassLoader- Returns:
- Array of URLs
-
getSearchPath
Description copied from class:CustomURLClassLoaderAlternate method for getURLs (some implementations override it in a non-traceable fashion)- Overrides:
getSearchPathin classCustomURLClassLoader- Returns:
-
testComponentExistence
Description copied from interface:ComponentLoaderTest whether a named component (Class) exists.- Specified by:
testComponentExistencein interfaceComponentLoader- Parameters:
name- The component name- Returns:
- true If the requested component can be located, false otherwise.
- See Also:
-
addCommonJARs
Add common JARs- Parameters:
jars- Array of URLs
-
testResourceExistence
Description copied from interface:ComponentLoaderTest whether a named resource exists. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.The name of a resource is a '/ '-separated path name that identifies the resource.
- Specified by:
testResourceExistencein interfaceComponentLoader- Parameters:
name- The resource name- Returns:
- true If the requested resource can be located, false otherwise.
- See Also:
-
addComponent
Description copied from interface:ComponentLoaderRegisters a class name, and the code source which is used as the search path to load the class.- Specified by:
addComponentin interfaceComponentLoader- Parameters:
name- The name of the classurls- Codebase for the class identified by the name parameter- See Also:
-
load
public Object load(String name) throws ClassNotFoundException, IllegalAccessException, InstantiationException Description copied from interface:ComponentLoaderCreates an Object which has been added to the ComponentLoader using the addSystemComponent method, or is in the classpath of the ComponentLoader. The Object is loaded from the registered code source.- Specified by:
loadin interfaceComponentLoader- Parameters:
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.- Throws:
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.- See Also:
-