JavaTM 2 Platform
Std. Ed. v1.3.1

java.rmi.server
Class RMIClassLoader

java.lang.Object
  |
  +--java.rmi.server.RMIClassLoader

public class RMIClassLoader
extends Object

RMIClassLoader provides static methods for loading classes from a network location (one or more URLs) and obtaining the location from which an existing class can be loaded. These methods are used by the RMI runtime when marshalling and unmarshalling classes of parameters and return values.

Since:
JDK1.1

Method Summary
static String getClassAnnotation(Class cl)
          Returns the class annotation (representing the location for a class) that RMI will use to annotate the call stream when marshalling objects of the given class.
static ClassLoader getClassLoader(String codebase)
          Returns a class loader that loads classes from the given codebase URL path.
static Object getSecurityContext(ClassLoader loader)
          Deprecated. no replacement. As of the Java 2 platform v1.2, RMI no longer uses this method to obtain a class loader's security context.
static Class loadClass(String name)
          Deprecated. replaced by loadClass(String,String) method
static Class loadClass(String codebase, String name)
          Loads a class from a codebase URL path.
static Class loadClass(URL codebase, String name)
          Loads a class from a codebase URL.
 
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 name)
                       throws MalformedURLException,
                              ClassNotFoundException
Deprecated. replaced by loadClass(String,String) method

Loads a class from the codebase URL path specified by the java.rmi.server.codebase property.
Parameters:
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException - if the system property java.rmi.server.codebase contains an invalid URL
ClassNotFoundException - if a definition for the class could not be found at the codebase location
Since:
JDK1.1
See Also:
loadClass(String,String)

loadClass

public static Class loadClass(URL codebase,
                              String name)
                       throws MalformedURLException,
                              ClassNotFoundException
Loads a class from a codebase URL. If the given codebase is null, then the Class object returned is equivalent to the Class object returned by RMIClassLoader.loadClass(name).
Parameters:
codebase - the URL to load the class from
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException - if the codebase paramater contains an invalid non-null URL
ClassNotFoundException - if a definition for the class could not be found at the specified URL
Since:
JDK1.1

loadClass

public static Class loadClass(String codebase,
                              String name)
                       throws MalformedURLException,
                              ClassNotFoundException
Loads a class from a codebase URL path. If the given codebase is null, then the Class object returned is equivalent to the Class object returned by RMIClassLoader.loadClass(name).
Parameters:
codebase - the list of space-separated URLs to load the class from
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException - if the codebase paramater contains an invalid non-null URL
ClassNotFoundException - if a definition for the class could not be found at the specified location
Since:
1.2

getClassLoader

public static ClassLoader getClassLoader(String codebase)
                                  throws MalformedURLException,
                                         SecurityException
Returns a class loader that loads classes from the given codebase URL path. The class loader returned is the class loader that the #loadClass(String,String) method would use to load classes from the given codebase. If a class loader with the same codebase URL path already exists for RMI runtime, it will be returned; otherwise, a new class loader will be created. If the given codebase is null, it returns the class loader used to load classes via the #loadClass(String) method.
Parameters:
codebase - the list of space-separated URLs which the the class loader will load classes from
Returns:
a class loader that loads classes from the given codebase URL path
Throws:
MalformedURLException - if the codebase paramater contains an invalid non-null URL
SecurityException - if the caller does not have permission to connect to all of the URLs in codebase URL path
Since:
1.3

getClassAnnotation

public static String getClassAnnotation(Class cl)
Returns the class annotation (representing the location for a class) that RMI will use to annotate the call stream when marshalling objects of the given class.
Parameters:
cl - the class to obtain the annotation for
Returns:
a string to be used to annotate the class when marshalled
Since:
1.2

getSecurityContext

public static Object getSecurityContext(ClassLoader loader)
Deprecated. no replacement. As of the Java 2 platform v1.2, RMI no longer uses this method to obtain a class loader's security context.

Returns the security context of the given class loader.
Parameters:
loader - a class loader from which to get the security context
Returns:
the security context
Since:
JDK1.1
See Also:
SecurityManager.getSecurityContext()

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.