blackboard.platform.plugin
Class PlugInManager

java.lang.Object
  |
  +--blackboard.platform.plugin.PlugInManager

public class PlugInManager
extends java.lang.Object

The PlugInManager is responsible for maintaining plugin definitions for the system. It acts as a broker for application code to access plugin definitions, and organizes plugins based on which virtual installation they were installed to.

Additionally, the PlugInManager is responsible for initializing system permissions for PlugIns as they are loaded into the system.

Within a virtual installation, plugins are uniquely identified by their unique handle, a combination of two pieces of information: the vendor id, and the handle. An example would be something like bb-webeq. However, file system and URL references include the bbuid associated with the virtual installation. E.g., bb-webeq-[vid] is the URL.

File system is laid out a little differently from the URL, /vi/[vid]/plugins/bb-webeq/webapp for the executable code, and /plugins/bbuid/bb-webeq/config for configuration data.

Since:
Blackboard 5.5
Version:
$Revision: 7 $
See Also:
PlugIn

Field Summary
static java.lang.String BUILDING_BLOCKS_CATALOG
           
 
Constructor Summary
PlugInManager()
           
 
Method Summary
 void deactivatePlugIn(Id id)
          Sets plugins status to inactive and unregisters the webapp
 void disablePlugIn(Id id)
          Disables the plugin specified by Id.
 void enablePlugIn(Id id)
          Enables the specified plugin.
 java.util.List getAvailableContentHandlers()
          Deprecated. a filtering iterator is the preferred method for getting this information
 java.util.List getAvailablePlugIns()
          Deprecated. plugin availability can be determined either through a filtering interator, or by examining the available property directly.
 ContentHandler getContentHandler(java.lang.String handle)
          Returns the ContentHandler for the given handle in the current virtual installation.
 java.util.List getContentHandlers()
          Returns a list of installed content handlers.
 Version getPlatformVersion()
          Returns the current platform version.
 PlugIn getPlugIn(Id id)
          Returns the PlugIn identified by the specified Id.
protected  PlugIn getPlugIn(Id id, VirtualInstallation vi)
          Simply returns the identified plugin for the specified virtual installation
 PlugIn getPlugIn(java.lang.String vid, java.lang.String handle)
          Returns the plug-in for the given vendor id and handle.
 java.io.File getPlugInDir(PlugIn plugIn)
          Gets the root directory for a plugin
 java.util.List getPlugIns()
          Returns a list of installed plug-ins.
 java.io.File getPlugInsConfigDirectory()
          Deprecated. due to virtual installation layout changes, this method is no longer valid. Use PlugInConfig instead.
 java.io.File getPlugInsDirectory(VirtualInstallation vi)
          Returns the plug-ins directory.
 java.lang.Class getServiceInterface()
          Returns the Class for this interface implementation.
 java.io.File getTempDirectory()
          Returns the upload temp space.
 void refreshCachedInfo()
          Loads the plugin and content handler definitions into an in-memory cache.
 void registerModule(Module module, java.sql.Connection conn)
          Registers the specified module in the database.
 void reInit()
           
protected  void removeNavigationItemCache()
          Internal method to update all relevant loaders to refresh caches
 void removePlugIn(Id id)
          Deletes the specified plugin.
 void serviceInit(ConfigurationService config)
          Initialization method called by framework at system startup.
 void serviceShutdown()
          Implementation method required for service implementations.
 void serviceStartup()
          Implementation method required for service implementations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILDING_BLOCKS_CATALOG

public static final java.lang.String BUILDING_BLOCKS_CATALOG
See Also:
Constant Field Values
Constructor Detail

PlugInManager

public PlugInManager()
Method Detail

serviceInit

public void serviceInit(ConfigurationService config)
                 throws InitializationException
Initialization method called by framework at system startup. This method simply loads the list of installed plug-ins and content handlers.

Parameters:
config - configuration service for application
Throws:
InitializationException - thrown if the it cannot access required services, or cannot load the plugin data into the cache

refreshCachedInfo

public void refreshCachedInfo()
                       throws InitializationException
Loads the plugin and content handler definitions into an in-memory cache. The cache is organized per virtual installation.

Throws:
InitializationException - thrown if the data cannot be loaded for any reason. This should result in a fatal startup error.

reInit

public void reInit()
            throws PersistenceException
PersistenceException

getServiceInterface

public java.lang.Class getServiceInterface()
Returns the Class for this interface implementation.


serviceShutdown

public void serviceShutdown()
Implementation method required for service implementations. No action is performed.


serviceStartup

public void serviceStartup()
Implementation method required for service implementations. No action is performed.


getPlugInsConfigDirectory

public java.io.File getPlugInsConfigDirectory()
Deprecated. due to virtual installation layout changes, this method is no longer valid. Use PlugInConfig instead.

Returns the plug-ins config directory.

Returns:
null. See below.

getTempDirectory

public java.io.File getTempDirectory()
Returns the upload temp space.


getPlatformVersion

public Version getPlatformVersion()
Returns the current platform version.


getPlugIn

public PlugIn getPlugIn(java.lang.String vid,
                        java.lang.String handle)
Returns the plug-in for the given vendor id and handle.

Parameters:
vid - the vendor id. Typically this is a four character alphanumeric key
handle - a unique key assigned by the vendor. Typically this is simply an alphanumeric key.
Returns:
the PlugIn matching the vendor id and handle within the current VirtualInstallation. If no VirtualInstallation is detected, null is returned.

getPlugIn

public PlugIn getPlugIn(Id id)
Returns the PlugIn identified by the specified Id. The object is retrieved from the current VirtualInstallation cache. If no Virtual Installation is currently set, null is returned.

Parameters:
id - Id of the plugin to return
Returns:
PlugIn object for the current Virtual Installation. null if Virtual Installation is not set, or if there is no matching PlugIn.

getPlugIn

protected PlugIn getPlugIn(Id id,
                           VirtualInstallation vi)
Simply returns the identified plugin for the specified virtual installation

Parameters:
id - Id of the plugin to retrieve.
vi - Virtual Installation containing plugin
Returns:
PlugIn object specified by id and vi arguments

getPlugIns

public java.util.List getPlugIns()
Returns a list of installed plug-ins. The list is alphabetically ordered.

Returns:
the list of all plugins installed in the VirtualInstallation. If no VirtualInstallation is detected, null is returned.

getAvailablePlugIns

public java.util.List getAvailablePlugIns()
Deprecated. plugin availability can be determined either through a filtering interator, or by examining the available property directly.

Returns a list of available, installed plug-ins. The list is alphabetically ordered.


getContentHandler

public ContentHandler getContentHandler(java.lang.String handle)
Returns the ContentHandler for the given handle in the current virtual installation.

Parameters:
handle - the unique string handle for the plugin
Returns:
ContentHandler installed in the current virtual installation. If a virtual installation is not obtained from context, null is returned.

getContentHandlers

public java.util.List getContentHandlers()
Returns a list of installed content handlers. The list is alphabetically ordered.

Returns:
list of installed content handler objects for the current virtual installation if there is no current virtual installation (i.e., context has not been set), null is returned

getAvailableContentHandlers

public java.util.List getAvailableContentHandlers()
Deprecated. a filtering iterator is the preferred method for getting this information

Returns a list of available, installed content handlers. The list is alphabetically ordered.


removePlugIn

public void removePlugIn(Id id)
                  throws PersistenceException
Deletes the specified plugin. This also removes all related entities, including applications, content handlers, links, modules, etc. Code that calls this must have the 'plugin.remove' runtime permission.

Parameters:
id - plugin to remove
Throws:
PersistenceException - thrown if the database cannot be updated. The plugin remains enabled.

disablePlugIn

public void disablePlugIn(Id id)
                   throws PersistenceException
Disables the plugin specified by Id. This will also disable all associated data objects, including applications, content handlers, modules, etc.

Parameters:
id - plugin to disable.
Throws:
PersistenceException

enablePlugIn

public void enablePlugIn(Id id)
                  throws PersistenceException
Enables the specified plugin. This also enables all associated data, including applications, content handlers, modules, etc.

Parameters:
id - plugin to enable
Throws:
PersistenceException

deactivatePlugIn

public void deactivatePlugIn(Id id)
                      throws PersistenceException
Sets plugins status to inactive and unregisters the webapp

Parameters:
id - plugin to deactivate
Throws:
PersistenceException

registerModule

public void registerModule(Module module,
                           java.sql.Connection conn)
                    throws PersistenceException
Registers the specified module in the database.

Parameters:
module - Module to persist
conn - Database connection. Caller is assumed to control the transaction.
Throws:
PersistenceException

removeNavigationItemCache

protected void removeNavigationItemCache()
Internal method to update all relevant loaders to refresh caches


getPlugInDir

public java.io.File getPlugInDir(PlugIn plugIn)
Gets the root directory for a plugin

Parameters:
plugIn - plugin to retrieve directory
Returns:
root directory

getPlugInsDirectory

public java.io.File getPlugInsDirectory(VirtualInstallation vi)
Returns the plug-ins directory.



Copyright © 2003 Blackboard, Inc. All Rights Reserved.