Rio Project 4.2 API Documentation



org.rioproject.core.jsb
Interface ComponentLoader

All Known Implementing Classes:
CommonClassLoader

public interface ComponentLoader

The ComponentLoader provides a mechanism for the ServiceBean to load classes and resources (such as native libraries) making them (and the resources it uses) available to all services

Author:
Dennis Reedy

Method Summary
 void addComponent(String name, URL[] urls)
          Registers a class name, and the code source which is used as the search path to load the class.
 Object load(String name)
          Creates an Object which has been added to the ComponentLoader using the addSystemComponent method, or is in the classpath of the ComponentLoader.
 boolean testComponentExistence(String name)
          Test whether a named component (Class) exists.
 boolean testResourceExistence(String name)
          Test whether a named resource exists.
 

Method Detail

load

Object load(String name)
            throws ClassNotFoundException,
                   IllegalAccessException,
                   InstantiationException
Creates an Object which has been added to the ComponentLoader using the addSystemComponent method, or is in the classpath of the ComponentLoader. The Object is loaded from the registered code source.

Parameters:
name - The name of the class. The resulting class will be loaded and a new instance of the class created using a zero-arg contructor.
Returns:
The instantiated Object
Throws:
IllegalAccessException - - If the Class or its nullary constructor is not accessible.
InstantiationException - - If this Class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ClassNotFoundException - - If the class cannot be located by the class loader or it has not been registered

addComponent

void addComponent(String name,
                  URL[] urls)
Registers a class name, and the code source which is used as the search path to load the class.

Parameters:
name - The name of the class
urls - Codebase for the class identified by the name parameter

testComponentExistence

boolean testComponentExistence(String name)
Test whether a named component (Class) exists.

Parameters:
name - The component name
Returns:
true If the requested component can be located, false otherwise.

testResourceExistence

boolean testResourceExistence(String name)
Test whether a named resource exists. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

The name of a resource is a '/ '-separated path name that identifies the resource.

Parameters:
name - The resource name
Returns:
true If the requested resource can be located, false otherwise.

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.