GigaSpaces XAP 10.0.1 API

com.sun.jini.start
Class ClassLoaderUtil

java.lang.Object
  extended by com.sun.jini.start.ClassLoaderUtil

public class ClassLoaderUtil
extends Object

This class provides useful utilities for creating and manipulating class loaders.

Author:
Sun Microsystems, Inc.

Method Summary
static void displayClassLoaderTree(ClassLoader classloader)
          Utility method that displays the class loader delegation tree for the given class loader.
static void displayContextClassLoaderTree()
          Utility method that displays the class loader delegation tree for the current context class loader.
static URL[] getClasspathURLs(String classpath)
          Utility method that converts the components of a String representing a classpath into file URL(s).
static URL[] getCodebaseURLs(String codebase)
          Utility method that converts the components of a String representing a codebase into standard URL(s).
static URL[] getImportCodebaseURLs(String importCodebase)
          Utility method that converts the components of a String representing a codebase or classpath into URL(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClasspathURLs

public static URL[] getClasspathURLs(String classpath)
                              throws IOException,
                                     MalformedURLException
Utility method that converts the components of a String representing a classpath into file URL(s).

Parameters:
classpath - String containing components separated by path separators that represent the components making up a classpath
Returns:
a URL[] where each element of the array corresponds to one of the components in the classpath parameter. The path components are (potentially) expanded via File.getCanonicalFile() before converting to a URL format.
Throws:
MalformedURLException - If the path cannot be parsed as a URL
java.net.IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
IOException

getCodebaseURLs

public static URL[] getCodebaseURLs(String codebase)
                             throws MalformedURLException
Utility method that converts the components of a String representing a codebase into standard URL(s).

Parameters:
codebase - String containing components separated by spaces in which each component is in URL format.
Returns:
a URL[] where each element of the array corresponds to one of the components in the codebase parameter
Throws:
MalformedURLException

getImportCodebaseURLs

public static URL[] getImportCodebaseURLs(String importCodebase)
                                   throws IOException,
                                          MalformedURLException
Utility method that converts the components of a String representing a codebase or classpath into URL(s).

Parameters:
importCodebase - String assumed (in order) to be either 1) a space delimited set of URL(s) representing a codebase or 2) a File.pathSeparator delimited set of class paths.
Returns:
a URL[] where each element of the array corresponds to one of the components in the importCodebase parameter
Throws:
MalformedURLException - If the path cannot be parsed as a URL
java.net.IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
IOException

displayContextClassLoaderTree

public static void displayContextClassLoaderTree()
Utility method that displays the class loader delegation tree for the current context class loader. For each class loader in the tree, this method displays the locations from which that class loader will retrieve and load requested classes.

This method can be useful when debugging problems related to the receipt of exceptions such as ClassNotFoundException.


displayClassLoaderTree

public static void displayClassLoaderTree(ClassLoader classloader)
Utility method that displays the class loader delegation tree for the given class loader. For each class loader in the tree, this method displays the locations from which that class loader will retrieve and load requested classes.

This method can be useful when debugging problems related to the receipt of exceptions such as ClassNotFoundException.

Parameters:
classloader - ClassLoader instance whose delegation tree is to be displayed

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.