org.openejb.util
Class SafeToolkit

java.lang.Object
  extended by org.openejb.util.SafeToolkit

public class SafeToolkit
extends Object


Field Summary
static HashMap codebases
           
static Messages messages
           
 
Constructor Summary
protected SafeToolkit(String systemLocation)
          Creates a new SafeToolkit dedicated to the specified system location.
 
Method Summary
 Class forName(String className)
          Attempts to find and load the specified class.
 Class forName(String className, String codebase)
          Attempts to find and load the specified class, using the specified codebase.
static ClassLoader getClassLoader(String codebase)
          Ensures that a class loader for each code base used in the system is created at most one time.
static ClassLoader getCodebaseClassLoader(String codebase)
          Ensures that a class loader for each code base used in the system is created at most one time.
static ClassLoader getContextClassLoader()
           
 SafeProperties getSafeProperties(Properties props)
          Returns a new SafeProperties instance dedicated to this toolkit.
static SafeToolkit getToolkit(String systemLocation)
          Returns an instance of a SafeToolkit dedicated to the specified system location.
static Class loadClass(String className, String codebase)
          Loads the class using the class loader for the specific codebase.
static Class loadClass(String className, String codebase, boolean cache)
           
 Object newInstance(Class clazz)
          Attempts to instaniate the specified class.
 Object newInstance(String className)
          Attempts to find and load the specified class then instaniate it.
 Object newInstance(String className, String codebase)
          Attempts to find and load the specified class then instaniate it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

public static final Messages messages

codebases

public static final HashMap codebases
Constructor Detail

SafeToolkit

protected SafeToolkit(String systemLocation)
Creates a new SafeToolkit dedicated to the specified system location.

Method Detail

getToolkit

public static SafeToolkit getToolkit(String systemLocation)
Returns an instance of a SafeToolkit dedicated to the specified system location.


forName

public Class forName(String className)
              throws OpenEJBException
Attempts to find and load the specified class.

Parameters:
className - the name of the class to be loaded.
Returns:
the specified class.
Throws:
OpenEJBException - if the class cannot be found.

forName

public Class forName(String className,
                     String codebase)
              throws OpenEJBException
Attempts to find and load the specified class, using the specified codebase. If the codebase is null, the bootstrap classloader is used.

Parameters:
className - the name of the class to be loaded.
codebase - the codebase to load the class from.
Returns:
the specified class.
Throws:
OpenEJBException - if the class cannot be found.

newInstance

public Object newInstance(String className)
                   throws OpenEJBException
Attempts to find and load the specified class then instaniate it.

Parameters:
className - the name of the class to be instantiated.
Returns:
an instance of the specified class.
Throws:
OpenEJBException - if the class cannot be found or is not accessible .

newInstance

public Object newInstance(String className,
                          String codebase)
                   throws OpenEJBException
Attempts to find and load the specified class then instaniate it.

Parameters:
className - the name of the class to be instantiated.
Returns:
an instance of the specified class.
Throws:
OpenEJBException - if the class cannot be found or is not accessible .

newInstance

public Object newInstance(Class clazz)
                   throws OpenEJBException
Attempts to instaniate the specified class.

Parameters:
clazz - the name of the class to be instantiated.
Returns:
an instance of the specified class.
Throws:
OpenEJBException - if the class is not accessible .

getSafeProperties

public SafeProperties getSafeProperties(Properties props)
                                 throws OpenEJBException
Returns a new SafeProperties instance dedicated to this toolkit.

Parameters:
props - properties
Returns:
a new SafeProperties instance.
Throws:
OpenEJBException - the properties object passed in is null.

loadClass

public static Class loadClass(String className,
                              String codebase)
                       throws OpenEJBException
Loads the class using the class loader for the specific codebase. If the codebase is null, the bootstrap classloader is used.

Parameters:
className - class name
codebase -
Returns:
class object
Throws:
OpenEJBException

loadClass

public static Class loadClass(String className,
                              String codebase,
                              boolean cache)
                       throws OpenEJBException
Throws:
OpenEJBException

getCodebaseClassLoader

public static ClassLoader getCodebaseClassLoader(String codebase)
                                          throws OpenEJBException
Ensures that a class loader for each code base used in the system is created at most one time. The default bootsrap classloader is used if codebase is null.

Parameters:
codebase -
Returns:
ClassLoader
Throws:
OpenEJBException

getClassLoader

public static ClassLoader getClassLoader(String codebase)
                                  throws OpenEJBException
Ensures that a class loader for each code base used in the system is created at most one time. The default bootsrap classloader is used if codebase is null.

Parameters:
codebase -
Returns:
ClassLoader
Throws:
OpenEJBException

getContextClassLoader

public static ClassLoader getContextClassLoader()


Copyright © 1999-2010 OpenEJB. All Rights Reserved.