blackboard.platform.plugin
Class PlugInManager

java.lang.Object
  extended by 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: #1 $
See Also:
PlugIn

Field Summary
 java.lang.String BUILDING_BLOCKS_CATALOG
          Download URL for system extensions
 
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.
 java.io.File getBundleFile(Id plugInId, BbLocale locale)
           
 java.lang.String getBundleName(Id plugInId)
           
static java.lang.String getCatalogUrl()
          Utility method to calculate the catalog URL from a navigation item.
 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 getContentSystemVersion()
          Returns the current Content System version, or null if the Content System is not installed.
 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 getPlugInLocales(Id plugInId)
           
 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.
 boolean isPlugInLocalized(Id plugInId)
           
 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()
          Reloads plugin info from the database, initializing webapps as necessary.
 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 final java.lang.String BUILDING_BLOCKS_CATALOG
Download URL for system extensions

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.

This method should only called directly from serviceInit() and reInit(). All other invocations should occur as a byproduct of invalidateCaches().

Note that to avoid circular reloads, this method does not invalidate the caches. Also, this method assumes that Context is already set by the caller.

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
Reloads plugin info from the database, initializing webapps as necessary.

Throws:
PersistenceException - Thrown if an error is encountered while loading plugin data.

getServiceInterface

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

Returns:
Class object for the service interface. Just returns the class for this instance.

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.


isPlugInLocalized

public boolean isPlugInLocalized(Id plugInId)

getPlatformVersion

public Version getPlatformVersion()
Returns the current platform version.

Returns:
Version information stored for this Virtual Installation

getContentSystemVersion

public Version getContentSystemVersion()
Returns the current Content System version, or null if the Content System is not installed.

Returns:
Version information stored for this Virtual Installation

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 -
vi -
Returns:

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

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.

Parameters:
vi - The VirtualInstallation that we want to get the plugins directory for
Returns:
File object pointing to the directory in the current virtual installation where the plugins are deployed.

getCatalogUrl

public static java.lang.String getCatalogUrl()
Utility method to calculate the catalog URL from a navigation item.

Returns:
URL associated with admin_plugin_download navigation item

getBundleName

public java.lang.String getBundleName(Id plugInId)
Parameters:
plugInId -
Returns:
Convention-chosen unique name for a plugin's locale-specific bundle

getPlugInLocales

public java.util.List getPlugInLocales(Id plugInId)
Parameters:
PlugInId -
Returns:
String[]

getBundleFile

public java.io.File getBundleFile(Id plugInId,
                                  BbLocale locale)
Parameters:
plugin -
locale -


Copyright © 2003 Blackboard, Inc. All Rights Reserved.