站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

ClassLoaderUtils (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.loading
Class ClassLoaderUtils

java.lang.Object
  extended byorg.jboss.mx.loading.ClassLoaderUtils

public class ClassLoaderUtils
extends Object

Utility methods for class loader to package names, etc.

Version:
$Revision: 1.19 $
Author:
Scott.Stark@jboss.org

Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static Set clonePackageSet(Object toClone)
          Clone a package set
static void displayClassInfo(Class clazz, StringBuffer results)
          Format a string buffer containing the Class, Interfaces, CodeSource, and ClassLoader information for the given object clazz.
static URLClassLoader[] getClassLoaderStack(ClassLoader cl)
          Get all of the URLClassLoaders from cl on up the hierarchy
static URL[] getClassLoaderURLs(ClassLoader cl)
          Use reflection to access a URL[] getURLs or URL[] getClasspath method so that non-URLClassLoader class loaders, or class loaders that override getURLs to return null or empty, can provide the true classpath info.
static String getJarClassName(String className)
          Translates a dot class name (java.lang.String) into a path form suitable for a jar entry (java/lang/String.class)
static String getPackageName(String className)
          Parse a class name into its package prefix.
static String getResourceName(String className)
          Parse a class name into its resource form.
static Set newPackageSet()
          Create a new package set
static String[] updateClassNamesMap(RepositoryClassLoader cl, Map classNamesMap)
          Given a UCL this method determine what classes it contains and create a mapping from the class names to the cl.
static String[] updateClassNamesMap(RepositoryClassLoader cl, Map classNamesMap, URL url, String[] prevClassNames)
          Augment the class names associated with a UCL.
static String[] updatePackageMap(RepositoryClassLoader cl, Map packagesMap)
          Given a UCL this method determine what packages it contains and create a mapping from the package names to the cl.
static String[] updatePackageMap(RepositoryClassLoader cl, Map packagesMap, URL url, String[] prevPkgNames)
          Augment the package name associated with a UCL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderUtils

public ClassLoaderUtils()
Method Detail

displayClassInfo

public static void displayClassInfo(Class clazz,
                                    StringBuffer results)
Format a string buffer containing the Class, Interfaces, CodeSource, and ClassLoader information for the given object clazz.

Parameters:
clazz - the Class
results - - the buffer to write the info to

getClassLoaderURLs

public static URL[] getClassLoaderURLs(ClassLoader cl)
Use reflection to access a URL[] getURLs or URL[] getClasspath method so that non-URLClassLoader class loaders, or class loaders that override getURLs to return null or empty, can provide the true classpath info.


getClassLoaderStack

public static URLClassLoader[] getClassLoaderStack(ClassLoader cl)
Get all of the URLClassLoaders from cl on up the hierarchy

Parameters:
cl - the class loader to start from
Returns:
The possibly empty array of URLClassLoaders from cl through its parent class loaders

getJarClassName

public static String getJarClassName(String className)
Translates a dot class name (java.lang.String) into a path form suitable for a jar entry (java/lang/String.class)

Parameters:
className - java.lang.String
Returns:
java/lang/String.class

getPackageName

public static String getPackageName(String className)
Parse a class name into its package prefix. This has to handle array classes whose name is prefixed with [L.


getResourceName

public static String getResourceName(String className)
Parse a class name into its resource form. This has to handle array classes whose name is prefixed with [L.


newPackageSet

public static Set newPackageSet()
Create a new package set

Returns:
the new package set

clonePackageSet

public static Set clonePackageSet(Object toClone)
Clone a package set

Returns:
the cloned package set

updatePackageMap

public static String[] updatePackageMap(RepositoryClassLoader cl,
                                        Map packagesMap)
                                 throws Exception
Given a UCL this method determine what packages it contains and create a mapping from the package names to the cl.

Parameters:
cl - the UCL that loads from url
packagesMap - the Map to update
Returns:
the updated unique set of package names
Throws:
Exception

updatePackageMap

public static String[] updatePackageMap(RepositoryClassLoader cl,
                                        Map packagesMap,
                                        URL url,
                                        String[] prevPkgNames)
                                 throws Exception
Augment the package name associated with a UCL.

Parameters:
cl - the UCL that loads from url
packagesMap - the Map to update
url - the URL to parse for package names
prevPkgNames - the set of pckage names already associated with cl
Returns:
the updated unique set of package names
Throws:
Exception

updateClassNamesMap

public static String[] updateClassNamesMap(RepositoryClassLoader cl,
                                           Map classNamesMap)
                                    throws Exception
Given a UCL this method determine what classes it contains and create a mapping from the class names to the cl.

Parameters:
cl - the UCL that loads from url
classNamesMap - the Map to update
Returns:
the class names directly visible to the cl
Throws:
Exception

updateClassNamesMap

public static String[] updateClassNamesMap(RepositoryClassLoader cl,
                                           Map classNamesMap,
                                           URL url,
                                           String[] prevClassNames)
                                    throws Exception
Augment the class names associated with a UCL.

Parameters:
cl - the UCL that loads from url
classNamesMap - the Map to update
url - the URL to parse for class names
prevClassNames - the set of pckage names already associated with cl
Returns:
the updated list of class names
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.