csheets.ext
Class ExtensionManager

java.lang.Object
  extended by csheets.ext.ExtensionManager

public class ExtensionManager
extends Object

The class that manages extensions to the CleanSheets application.

Author:
Einar Pehrson

Nested Class Summary
static class ExtensionManager.Loader
          The class loader used to load extensions.
 
Method Summary
 Extension getExtension(String name)
          Returns the extension with the given name.
 Extension[] getExtensions()
          Returns the extensions that have been loaded.
static ExtensionManager getInstance()
          Returns the singleton instance.
 ClassLoader getLoader()
          Returns the class loader used to load extensions.
 Extension load(Class extensionClass)
          Instantiates the given extension class.
 Extension load(String className)
          Loads the extension with the given class name.
 Extension load(String className, URL url)
          Adds the given url to the class path, and loads the extension with the given class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ExtensionManager getInstance()
Returns the singleton instance.

Returns:
the singleton instance

getExtensions

public Extension[] getExtensions()
Returns the extensions that have been loaded.

Returns:
the extensions that have been loaded

getExtension

public Extension getExtension(String name)
Returns the extension with the given name.

Returns:
the extension with the given name or null if none was found

load

public Extension load(String className,
                      URL url)
Adds the given url to the class path, and loads the extension with the given class name.

Parameters:
className - the complete class name of a class that extends the abstract Extension class
url - the URL of the JAR-file or directory that contains the class
Returns:
the extension that was loaded, or null if none was found.

load

public Extension load(String className)
Loads the extension with the given class name.

Parameters:
className - the complete class name of a class that extends the abstract Extension class
Returns:
the extension that was loaded, or null if none was found.

load

public Extension load(Class extensionClass)
Instantiates the given extension class.

Parameters:
extensionClass - a class that extends the abstract Extension class
Returns:
the extension that was loaded, or null if none was found.

getLoader

public ClassLoader getLoader()
Returns the class loader used to load extensions.

Returns:
the class loader used to load extensions