SmartFrog 3.10.000

org.smartfrog.sfcore.security
Class SFRMIClassLoaderSpi

java.lang.Object
  extended by java.rmi.server.RMIClassLoaderSpi
      extended by org.smartfrog.sfcore.security.SFRMIClassLoaderSpi

public class SFRMIClassLoaderSpi
extends java.rmi.server.RMIClassLoaderSpi

RMIClassLoaderSpi is the service provider interface for RMIClassLoader. We wrap the default RMIClassLoaderSpi to add extra checks.


Constructor Summary
SFRMIClassLoaderSpi()
           
 
Method Summary
 java.lang.String getClassAnnotation(java.lang.Class cl)
          Provides the implementation for RMIClassLoader.getClassAnnotation(Class).
 java.lang.ClassLoader getClassLoader(java.lang.String codebase)
          Provides the implementation for RMIClassLoader.getClassLoader(String).
 java.lang.Class loadClass(java.lang.String codebase, java.lang.String name, java.lang.ClassLoader defaultLoader)
          Provides the implementation for RMIClassLoader.loadClass(URL,String), RMIClassLoader.loadClass(String,String), and RMIClassLoader.loadClass(String,String,ClassLoader).
 java.lang.Class loadProxyClass(java.lang.String codebase, java.lang.String[] interfaces, java.lang.ClassLoader defaultLoader)
          Provides the implementation for RMIClassLoader.loadProxyClass(String,String[],ClassLoader).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SFRMIClassLoaderSpi

public SFRMIClassLoaderSpi()
Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String codebase,
                                 java.lang.String name,
                                 java.lang.ClassLoader defaultLoader)
                          throws java.net.MalformedURLException,
                                 java.lang.ClassNotFoundException
Provides the implementation for RMIClassLoader.loadClass(URL,String), RMIClassLoader.loadClass(String,String), and RMIClassLoader.loadClass(String,String,ClassLoader). Loads a class from a codebase URL path, optionally using the supplied loader. Typically, a provider implementation will attempt to resolve the named class using the given defaultLoader, if specified, before attempting to resolve the class from the codebase URL path.

An implementation of this method must either return a class with the given name or throw an exception.

Specified by:
loadClass in class java.rmi.server.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:
java.net.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
java.lang.ClassNotFoundException - if a definition for the class could not be found at the specified location

loadProxyClass

public java.lang.Class loadProxyClass(java.lang.String codebase,
                                      java.lang.String[] interfaces,
                                      java.lang.ClassLoader defaultLoader)
                               throws java.net.MalformedURLException,
                                      java.lang.ClassNotFoundException
Provides the implementation for RMIClassLoader.loadProxyClass(String,String[],ClassLoader). 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.

An implementation of this method must either return a proxy class that implements the named interfaces or throw an exception.

Specified by:
loadProxyClass in class java.rmi.server.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:
java.net.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
java.lang.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 java.lang.ClassLoader getClassLoader(java.lang.String codebase)
                                     throws java.net.MalformedURLException
Provides the implementation for RMIClassLoader.getClassLoader(String). Returns a class loader that loads classes from the given codebase URL path.

If there is a security manger, its checkPermission method will be invoked with a RuntimePermission("getClassLoader") permission; this could result in a SecurityException. The implementation of this method may also perform further security checks to verify that the calling context has permission to connect to all of the URLs in the codebase URL path.

Specified by:
getClassLoader in class java.rmi.server.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:
java.net.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 java.lang.String getClassAnnotation(java.lang.Class cl)
Provides the implementation for RMIClassLoader.getClassAnnotation(Class). 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.

Specified by:
getClassAnnotation in class java.rmi.server.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

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP