|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--org.objectweb.mobilitools.smi.lib.SMIClassLoader
MobiliTools $Name: $, $Id: SMIClassLoader.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
MAF-based class loader for SMI. Makes it possible to define classes by loading their byte code from a local filesystem, a URL, or an implementation of MAF's MAFAgentSystem interface. It also handles access to resources in the same manner. A dedicated classloader is created for each new mobile object (created or incoming). However, byte-code, classes and resources are kept in a cache and reused for each given codebase. This way, mobile objects may invoke each other through and only through a class, interface or object with the same codebase, or loaded by a common parent class loader.
The class/resource loading policy is the following:
Notes:
RMIClassLoaderAdapter
,
URLClassLoaderAdapter
,
getClassLoader(ClassLoader, String, AgentProfile, MAFAgentSystem)
,
Constants
Method Summary | |
void |
finalize()
|
protected java.lang.Class |
findClass(java.lang.String name)
Gets the byte code for, and defines the requested class, either through local or remote bytecode load. |
java.net.URL |
findResource(java.lang.String name)
Gets the content of the named resource and keeps it in the cache associated to current SMI class loader's codebase. |
java.util.Enumeration |
findResources(java.lang.String name)
Since a codebase for SMI class loaders hold a single value, this method is similar to findResource(). |
byte[] |
getBytes(java.lang.String name)
Reads or retrieves from a cache the byte code for a given class name, or a resource content (accordingly to current class loader's code base). |
static java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader parent,
java.lang.String codebase,
org.omg.CfMAF.AgentProfile profile,
org.omg.CfMAF.MAFAgentSystem provider)
Creates a new SMI class loader. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.ClassLoader |
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent, java.lang.String codebase, org.omg.CfMAF.AgentProfile profile, org.omg.CfMAF.MAFAgentSystem provider)
the
- parent class loader (from which SMI class loader tries to get
classes before fetching them by itself)codebase
- the codebase for the classes; may be a single pathname or
URL designating a ZIP/JAR file or directory holding the classesprofile
- the agent profile (based on SMI's profile, see MAF spec.)provider
- the MAFAgentSystem implementation (SMI agency) providing
the classes.public byte[] getBytes(java.lang.String name)
name
- the class full name (i.e. including the package name if any) or resource nameprotected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.lang.ClassLoader
name
- the name of the class to define (see Java2 API).java.lang.ClassNotFoundException
- if the class could not be loaded and defined.public java.net.URL findResource(java.lang.String name)
findResource
in class java.lang.ClassLoader
name
- the resource's namepublic java.util.Enumeration findResources(java.lang.String name)
findResources
in class java.lang.ClassLoader
name
- the resource's namefindResource(String)
public java.lang.String toString()
toString
in class java.lang.Object
public void finalize()
finalize
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |