org.ow2.jonas.lib.bootstrap
Class RemoteClassLoaderSpi

java.lang.Object
  extended by java.rmi.server.RMIClassLoaderSpi
      extended by org.ow2.jonas.lib.bootstrap.RemoteClassLoaderSpi

public class RemoteClassLoaderSpi
extends RMIClassLoaderSpi

Class RemoteClassLoaderSpi is the CAROL JRMP CLass Loader SPI for serialization performances.

Author:
Guillaume Riviere (Guillaume.Riviere@inrialpes.fr), S. Ali Tokmen

Constructor Summary
RemoteClassLoaderSpi()
           
 
Method Summary
 String getClassAnnotation(Class cl)
          Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.
By default, remove rmi annotations of JClassLoader class.
 ClassLoader getClassLoader(String codebase)
          Returns a class loader that loads classes from the given codebase URL path.
 Class loadClass(String codebase, String name, ClassLoader defaultLoader)
          Loads a class from a codebase URL path, optionally using the supplied loader.
 Class loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader)
          Loads a dynamic proxy class (see Proxy that implements a set of interfaces with the given names from a codebase URL path, optionally using the supplied loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteClassLoaderSpi

public RemoteClassLoaderSpi()
Method Detail

loadClass

public Class loadClass(String codebase,
                       String name,
                       ClassLoader defaultLoader)
                throws MalformedURLException,
                       ClassNotFoundException
Loads a class from a codebase URL path, optionally using the supplied loader.

Specified by:
loadClass in class RMIClassLoaderSpi
Parameters:
codebase - the list of URLs (separated by spaces) to load the class from, or null
name - the name of the class to load
defaultLoader - additional contextual class loader to use, or null
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and the system property java.rmi.server.codebase contains an invalid URL
ClassNotFoundException - if a definition for the class could not be found at the specified location

loadProxyClass

public Class loadProxyClass(String codebase,
                            String[] interfaces,
                            ClassLoader defaultLoader)
                     throws MalformedURLException,
                            ClassNotFoundException
Loads a dynamic proxy class (see Proxy that implements a set of interfaces with the given names from a codebase URL path, optionally using the supplied loader.

Specified by:
loadProxyClass in class RMIClassLoaderSpi
Parameters:
codebase - the list of URLs (space-separated) to load classes from, or null
interfaces - the names of the interfaces for the proxy class to implement
defaultLoader - additional contextual class loader to use, or null
Returns:
a dynamic proxy class that implements the named interfaces
Throws:
MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and the system property java.rmi.server.codebase contains an invalid URL
ClassNotFoundException - if a definition for one of the named interfaces could not be found at the specified location, or if creation of the dynamic proxy class failed (such as if Proxy.getProxyClass(ClassLoader,Class[]) would throw an IllegalArgumentException for the given interface list)

getClassLoader

public ClassLoader getClassLoader(String codebase)
                           throws MalformedURLException
Returns a class loader that loads classes from the given codebase URL path.

Specified by:
getClassLoader in class RMIClassLoaderSpi
Parameters:
codebase - the list of URLs (space-separated) from which the returned class loader will load classes from, or null
Returns:
a class loader that loads classes from the given codebase URL path
Throws:
MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and the system property java.rmi.server.codebase contains an invalid URL

getClassAnnotation

public String getClassAnnotation(Class cl)
Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.
By default, remove rmi annotations of JClassLoader class. Between two JOnAS, commons classes are the same, don't need t have a bigger annotation. When local call is set, always disable annotation.

Specified by:
getClassAnnotation in class RMIClassLoaderSpi
Parameters:
cl - the class to obtain the annotation for
Returns:
a string to be used to annotate the given class when it gets marshalled, or null


Copyright © 2010 OW2 Consortium. All Rights Reserved.