blackboard.platform
Class BbServiceManager

java.lang.Object
  extended by blackboard.platform.BbServiceManager

public class BbServiceManager
extends java.lang.Object

Central manager and broker for platform services. This object is responsible for initialization of all other services, and is used by all Blackboard and third party code to locate service instances.

Currently defined services:

For brokering, all services are registered via a Class "key" that corresponds to their service interface. In addition, only the base service interface is returned, so a cast is required. Thus, requests for a service instance typically follow the idiom LogService log = (LogService)BbServiceManager.lookupService( LogManager.class ). For several services, however, there are well-defined, strongly typed accessors. E.g., getSessionManagerService().

Since:
Bb 5.5
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Constructor Summary
BbServiceManager()
           
 
Method Summary
static BundleManager getBundleManager()
          Convenience wrapper to return BundleManager.
static ConfigurationService getConfigurationService()
          Convenience wrapper to return ConfigurationService.
static ContextManager getContextManager()
          Convenience wrapper to return ContextManager.
static DataValidationService getDataValidationService()
          Deprecated. DataValidationService implementation is incomplete and unstable at this time.
static FileSystemService getFileSystemService()
          Convenience wrapper to return FileSystemService.
 java.lang.Throwable getInitFailReason()
          Returns the exception that was thrown on startup, causing the service manager to abort initialization.
static JdbcService getJdbcService()
          Convenience wrapper to return JdbcService.
static LicenseManager getLicenseManager()
          Method to access the LicenseManager.
static LocaleManager getLocaleManager()
          Convenience wrapper to return LocaleManager.
static LogService getLogService()
          Convenience wrapper to return LogService.
static PersistenceService getPersistenceService()
          Convenience wrapper to return PersistenceService.
static PlugInManager getPluginManager()
          Convenience wrapper to return PlugInManager.
static BbSessionManagerService getSessionManagerService()
          Convenience wrapper to return BbSessionManagerService.
static VirtualInstallationManager getVirtualInstallationManager()
          Convenience wrapper to return VirtualInstallationManager.
static void init(java.io.File blackboardRootDir, java.util.Properties config)
          Init method that does not depend on file system structure.
static void init(java.io.File blackboardRootDir, java.util.Properties config, boolean validateReleaseLevel)
           
static void init(java.lang.String serviceConfigFilePath)
          Standard init method that should be called by bootstrap mechanism.
static void init(java.lang.String serviceConfigFilePath, boolean validateReleaseLevel)
           
static void init(java.lang.String serviceConfigFilePath, java.util.Properties config)
          Standard init method that overloads default properties for configuration service.
static void init(java.lang.String serviceConfigFilePath, java.util.Properties config, boolean validateReleaseLevel)
           
static void initFromSystemProps()
          Called internally to bootstrap service manager from the "bbservices_config" system property if services are accessed without being pre-initialized by a standard bootstrap class.
static boolean isServiceInitialized(java.lang.String serviceName)
           
static CorePlatformService lookupService(java.lang.Class serviceInterface)
          Principal brokering method for use by third party programmers; takes the service interface and locates the correct service implementation.
static CorePlatformService lookupService(java.lang.String serviceInterfaceName)
          Actual broker method for service lookups.
static void registerService(java.lang.Class serviceInterface, java.lang.Class implClass)
          Registers service, binding it to the specified service name.
static void registerService(java.lang.Class serviceInterface, java.lang.Object implementationInstance)
          Not implemented.
static void registerService(java.lang.String serviceInterfaceName, java.lang.String implClassName)
          Registers service, binding it to the specified service name.
static CorePlatformService safeLookupService(java.lang.Class serviceInterface)
          This method is functional identical to lookupService( Class ), but throws runtime exceptions instead of checked exceptions.
static void shutdown()
          Initiates a graceful shutdown of all services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BbServiceManager

public BbServiceManager()
Method Detail

isServiceInitialized

public static boolean isServiceInitialized(java.lang.String serviceName)

initFromSystemProps

public static void initFromSystemProps()
                                throws InitializationException
Called internally to bootstrap service manager from the "bbservices_config" system property if services are accessed without being pre-initialized by a standard bootstrap class. Note: This method is primarily intended for Blackboard internal use. It should be considered unstable and unsuitable for third party development.

Throws:
InitializationException

init

public static void init(java.lang.String serviceConfigFilePath)
                 throws InitializationException
Standard init method that should be called by bootstrap mechanism. Note: This method is primarily intended for Blackboard internal use. It should be considered unstable and unsuitable for third party development.

Throws:
InitializationException

init

public static void init(java.lang.String serviceConfigFilePath,
                        boolean validateReleaseLevel)
                 throws InitializationException
Throws:
InitializationException

init

public static void init(java.lang.String serviceConfigFilePath,
                        java.util.Properties config)
                 throws InitializationException
Standard init method that overloads default properties for configuration service. Note: This method is primarily intended for Blackboard internal use. It should be considered unstable and unsuitable for third party development.

Throws:
InitializationException

init

public static void init(java.lang.String serviceConfigFilePath,
                        java.util.Properties config,
                        boolean validateReleaseLevel)
                 throws InitializationException
Throws:
InitializationException

init

public static void init(java.io.File blackboardRootDir,
                        java.util.Properties config)
                 throws InitializationException
Init method that does not depend on file system structure. Note: This method is primarily intended for Blackboard internal use. It should be considered unstable and unsuitable for third party development.

Throws:
InitializationException

init

public static void init(java.io.File blackboardRootDir,
                        java.util.Properties config,
                        boolean validateReleaseLevel)
                 throws InitializationException
Throws:
InitializationException

getInitFailReason

public java.lang.Throwable getInitFailReason()
Returns the exception that was thrown on startup, causing the service manager to abort initialization. Returns null if startup was successful or init() has not been called.


lookupService

public static CorePlatformService lookupService(java.lang.Class serviceInterface)
                                         throws BbServiceException,
                                                InitializationException
Principal brokering method for use by third party programmers; takes the service interface and locates the correct service implementation.

Parameters:
serviceInterface - Class representing the interface to find.
Returns:
Delegates to lookupService( String )
Throws:
BbServiceException - Thrown if a service corresponding to the requested service interface cannot be found.
InitializationException - Thrown if the system has not fully initialized for any reason.

lookupService

public static CorePlatformService lookupService(java.lang.String serviceInterfaceName)
                                         throws BbServiceException,
                                                InitializationException
Actual broker method for service lookups. Service lookups are typically performed on a String representation of the class name. This method will attempt to initialize from system properties if the system is not yet initialized.

Parameters:
serviceInterfaceName - Name of the service interface to look up
Returns:
CorePlatformService instance if service is found. Result must be cast to service desired.
Throws:
BbServiceException - Thrown if the requested service cannot be found
InitializationException - Thrown if the system has failed to initialize for any reason.

registerService

public static void registerService(java.lang.String serviceInterfaceName,
                                   java.lang.String implClassName)
                            throws BbServiceException,
                                   InitializationException
Registers service, binding it to the specified service name. Note that run-time registering is not currently possible, because the service's life cycle methods would not be called.

Parameters:
serviceInterfaceName - Name to bind the service as. Typically the fully qualified class name is used.
implClassName - Class name that implements the service.
Throws:
BbServiceException
InitializationException

registerService

public static void registerService(java.lang.Class serviceInterface,
                                   java.lang.Class implClass)
                            throws BbServiceException,
                                   InitializationException
Registers service, binding it to the specified service name. Note that run-time registering is not currently possible, because the service's life cycle methods would not be called.

Parameters:
serviceInterface - Class that wraps the service interface
implClass - Class that implements the service interface.
Throws:
BbServiceException
InitializationException

registerService

public static void registerService(java.lang.Class serviceInterface,
                                   java.lang.Object implementationInstance)
                            throws BbServiceException,
                                   InitializationException
Not implemented.

Throws:
BbServiceException
InitializationException

getLicenseManager

public static LicenseManager getLicenseManager()
Method to access the LicenseManager. Note that the LicenseManager is not brokered via the standard mechanism, but is always initialized and available. Thus, calls to lookupService( LicenseManager.class ) will fail.

Returns:
Initialized instance of the LicenseManager

getConfigurationService

public static ConfigurationService getConfigurationService()
                                                    throws RuntimeBbServiceException
Convenience wrapper to return ConfigurationService. Delegates to safeLookupService( ConfigurationService.class )

Returns:
Initialized instance of ConfigurationService
Throws:
RuntimeBbServiceException

getSessionManagerService

public static BbSessionManagerService getSessionManagerService()
                                                        throws RuntimeBbServiceException
Convenience wrapper to return BbSessionManagerService. Delegates to safeLookupService( BbSessionManagerService.class )

Returns:
Initialized instance of BbSessionManagerService
Throws:
RuntimeBbServiceException

getJdbcService

public static JdbcService getJdbcService()
                                  throws RuntimeBbServiceException
Convenience wrapper to return JdbcService. Delegates to safeLookupService( JdbcService.class )

Returns:
Initialized instance of JdbcService
Throws:
RuntimeBbServiceException

getPersistenceService

public static PersistenceService getPersistenceService()
                                                throws RuntimeBbServiceException
Convenience wrapper to return PersistenceService. Delegates to safeLookupService( PersistenceService.class )

Returns:
Initialized instance of PersistenceService
Throws:
RuntimeBbServiceException

getLogService

public static LogService getLogService()
                                throws RuntimeBbServiceException
Convenience wrapper to return LogService. Delegates to safeLookupService( LogService.class )

Returns:
Initialized instance of LogService
Throws:
RuntimeBbServiceException

getLocaleManager

public static LocaleManager getLocaleManager()
                                      throws RuntimeBbServiceException
Convenience wrapper to return LocaleManager. Delegates to safeLookupService( LocaleManager.class )

Returns:
Initialized instance of LocaleManager
Throws:
RuntimeBbServiceException

getBundleManager

public static BundleManager getBundleManager()
                                      throws RuntimeBbServiceException
Convenience wrapper to return BundleManager. Delegates to safeLookupService( BundleManager.class )

Returns:
Initialized instance of BundleManager
Throws:
RuntimeBbServiceException

getPluginManager

public static PlugInManager getPluginManager()
                                      throws RuntimeBbServiceException
Convenience wrapper to return PlugInManager. Delegates to safeLookupService( PlugInManager )

Returns:
Initialized instance of PlugInManager
Throws:
RuntimeBbServiceException

getFileSystemService

public static FileSystemService getFileSystemService()
                                              throws RuntimeBbServiceException
Convenience wrapper to return FileSystemService. Delegates to safeLookupService( FileSystemService )

Returns:
Initialized instance of FileSystemService
Throws:
RuntimeBbServiceException

getContextManager

public static ContextManager getContextManager()
                                        throws RuntimeBbServiceException
Convenience wrapper to return ContextManager. Delegates to safeLookupService( ContextManager )

Returns:
Initialized instance of ContextManager
Throws:
RuntimeBbServiceException

getDataValidationService

public static DataValidationService getDataValidationService()
                                                      throws RuntimeBbServiceException
Deprecated. DataValidationService implementation is incomplete and unstable at this time.

Convenience wrapper to return DataValidationService. Delegates to safeLookupService( DataValidationService.class )

Returns:
Initialized instance of DataValidationService
Throws:
RuntimeBbServiceException

getVirtualInstallationManager

public static VirtualInstallationManager getVirtualInstallationManager()
Convenience wrapper to return VirtualInstallationManager. Delegates to safeLookupService( VirtualInstallationManager.class )

Returns:
initialized instance of VirtualInstallationManager

shutdown

public static void shutdown()
Initiates a graceful shutdown of all services.


safeLookupService

public static CorePlatformService safeLookupService(java.lang.Class serviceInterface)
                                             throws RuntimeBbServiceException
This method is functional identical to lookupService( Class ), but throws runtime exceptions instead of checked exceptions.

Parameters:
serviceInterface - Service to lookup
Throws:
RuntimeBbServiceException


Copyright © 2003 Blackboard, Inc. All Rights Reserved.