GigaSpaces XAP 9.7.2 API

net.jini.loader
Class ClassLoading

java.lang.Object
  extended by net.jini.loader.ClassLoading

public final class ClassLoading
extends Object

Provides static methods for loading classes using RMIClassLoader with optional verification that the codebase URLs used to load classes provide content integrity (see Security.verifyCodebaseIntegrity).

Since:
2.0
Author:
Sun Microsystems, Inc.

Method Summary
static Class loadClass(String codebase, String name, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader)
          Loads a class using RMIClassLoader.loadClass, optionally verifying that the codebase URLs provide content integrity.
static Class loadProxyClass(String codebase, String[] interfaceNames, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader)
          Loads a dynamic proxy class using RMIClassLoader.loadProxyClass, optionally verifying that the codebase URLs provide content integrity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadClass

public static Class loadClass(String codebase,
                              String name,
                              ClassLoader defaultLoader,
                              boolean verifyCodebaseIntegrity,
                              ClassLoader verifierLoader)
                       throws MalformedURLException,
                              ClassNotFoundException
Loads a class using RMIClassLoader.loadClass, optionally verifying that the codebase URLs provide content integrity.

If verifyCodebaseIntegrity is true and codebase is not null, then this method invokes Security.verifyCodebaseIntegrity with codebase as the first argument and verifierLoader as the second argument (this invocation may be skipped if a previous invocation of this method or loadProxyClass has already invoked Security.verifyCodebaseIntegrity with the same value of codebase and the same effective value of verifierLoader as arguments without it throwing an exception). If Security.verifyCodebaseIntegrity throws a SecurityException, then this method proceeds as if codebase were null. If Security.verifyCodebaseIntegrity throws any other exception, then this method throws that exception.

This method then invokes RMIClassLoader.loadClass with codebase as the first argument (or null if in the previous step Security.verifyCodebaseIntegrity was invoked and it threw a SecurityException), name as the second argument, and defaultLoader as the third argument. If RMIClassLoader.loadClass throws a ClassNotFoundException, then this method throws a ClassNotFoundException; if RMIClassLoader.loadClass throws any other exception, then this method throws that exception; otherwise, this method returns the Class returned by RMIClassLoader.loadClass.

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 - the class loader value (possibly null) to pass as the defaultLoader argument to RMIClassLoader.loadClass
verifyCodebaseIntegrity - if true, verify that the codebase URLs provide content integrity
verifierLoader - the class loader value (possibly null) to pass to Security.verifyCodebaseIntegrity, if verifyCodebaseIntegrity is true
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException - if Security.verifyCodebaseIntegrity or RMIClassLoader.loadClass throws a MalformedURLException
ClassNotFoundException - if RMIClassLoader.loadClass throws a ClassNotFoundException
NullPointerException - if name is null

loadProxyClass

public static Class loadProxyClass(String codebase,
                                   String[] interfaceNames,
                                   ClassLoader defaultLoader,
                                   boolean verifyCodebaseIntegrity,
                                   ClassLoader verifierLoader)
                            throws MalformedURLException,
                                   ClassNotFoundException
Loads a dynamic proxy class using RMIClassLoader.loadProxyClass, optionally verifying that the codebase URLs provide content integrity.

If verifyCodebaseIntegrity is true and codebase is not null, then this method invokes Security.verifyCodebaseIntegrity with codebase as the first argument and verifierLoader as the second argument (this invocation may be skipped if a previous invocation of this method or loadClass has already invoked Security.verifyCodebaseIntegrity with the same value of codebase and the same effective value of verifierLoader as arguments without it throwing an exception). If Security.verifyCodebaseIntegrity throws a SecurityException, then this method proceeds as if codebase were null. If Security.verifyCodebaseIntegrity throws any other exception, then this method throws that exception.

This method invokes RMIClassLoader.loadProxyClass with codebase as the first argument (or null if in the previous step Security.verifyCodebaseIntegrity was invoked and it threw a SecurityException), interfaceNames as the second argument, and defaultLoader as the third argument. If RMIClassLoader.loadProxyClass throws a ClassNotFoundException, then this method throws a ClassNotFoundException; if RMIClassLoader.loadProxyClass throws any other exception, then this method throws that exception; otherwise, this method returns the Class returned by RMIClassLoader.loadProxyClass.

Parameters:
codebase - the list of URLs (separated by spaces) to load classes from, or null
interfaceNames - the names of the interfaces for the proxy class to implement
defaultLoader - the class loader value (possibly null) to pass as the defaultLoader argument to RMIClassLoader.loadProxyClass
verifyCodebaseIntegrity - if true, verify that the codebase URLs provide content integrity
verifierLoader - the class loader value (possibly null) to pass to Security.verifyCodebaseIntegrity, if verifyCodebaseIntegrity is true
Returns:
the Class object representing the loaded dynamic proxy class
Throws:
MalformedURLException - if Security.verifyCodebaseIntegrity or RMIClassLoader.loadProxyClass throws a MalformedURLException
ClassNotFoundException - if RMIClassLoader.loadProxyClass throws a ClassNotFoundException
NullPointerException - if interfaceNames is null or if any element of interfaceNames is null

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.