Namespace: Consultingwerk.Framework
Class 
ServiceContainer Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object
Implements: Consultingwerk.Framework.IOverloadedServiceContainer, Consultingwerk.Framework.IServiceContainer, Consultingwerk.Framework.IServiceContainerDebugging

File:ServiceContainer
Purpose:Provides a container for services, default implementation
of the IServiceContainer interface
Description:General purpose container to manage services by type / class
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Thu Dec 23 13:11:30 CET 2010
Notes:An instance is by default accessible from the
Consultingwerk.Framework.FrameworkSettings class.
Supports also lazy loading of services similar to
http://msdn.microsoft.com/de-de/library/system.componentmodel.design.servicecreatorcallback(v=vs.110).aspx
(SCL-573). To lazy load services, register instances of
the IServiceCreator in the ServiceContainer. Those factory
instances will be used to create the actual service. The
requested service type will be passed as an input parameter
to the IServiceCreator:CreateInstance method, so that the
same IServiceCreator instance might be used as a factory
for multiple service instances
Supports detailed logging when the ServiceContainer:VerboseLogging
static property is turned on (this is not implemented as a custom
log entry type, as the ServiceContainer may be activated prior
to the LogManager:CustomLogEntryTypes have been set)



Top Method Summary
Options Name Purpose
+ Progress.Lang.Object AddNewService (Class, Object) Adds the specified service to the service container.
+ Progress.Lang.Object AddService (Class, Object) Adds the specified service to the service container.
# Progress.Lang.Object CreateService (IServiceCreator, Class) Creates a service at first request
+ DisposeServices () Disposes all services
# LOGICAL FindService (Class) Searches the passed in Service Class in the ttService temp-table
+ Progress.Lang.Object GetMandatoryService (Class) Gets the service object of the specified type.
+ Progress.Lang.Object GetService (Class) Gets the service object of the specified type
+ GetServiceTable (table) Returns the service instances as a ttServiceTable output
+ LOGICAL IsRegistered (Object) Returns if the given object instance is registered as a Service in the service container of the overloading service container
+ Progress.Lang.Object ReloadService (Class) Reloads the Service instance
+ RemoveService (Class) Removes the specified service type from the service container.

Top Property Summary
Options Name Purpose
+ Consultingwerk.Framework.IServiceContainer OverloadingServiceContainer
+ LOGICAL VerboseLogging


Method Detail
Top

PUBLIC Progress.Lang.Object AddNewService (Class, Object)

Purpose: Adds the specified service to the service container.
Notes: If the Service implements the CCS IService Interface, we'll call the
initialize() method. This method is intended to be used by the
get-service.i include file with CCS style services that require to the
initialize()'d

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service to add
poObject Progress.Lang.Object
An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter
Returns Progress.Lang.Object
The reference to the service that was added (poObject). This allows fluid style usage of this routine
Top

PUBLIC Progress.Lang.Object AddService (Class, Object)

Purpose: Adds the specified service to the service container.
Notes:

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service to add
poObject Progress.Lang.Object
An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter
Returns Progress.Lang.Object
The reference to the service that was added (poObject). This allows fluid style usage of this routine
Top

PROTECTED Progress.Lang.Object CreateService (IServiceCreator, Class)

Purpose: Creates a service at first request
Notes: Replaces the reference to the IServiceCreator with the reference to
the actual service in the service table

Parameters:
poCreator Consultingwerk.Framework.IServiceCreator
The IServiceCreator instance
poClass Progress.Lang.Class
The service type to create
Returns Progress.Lang.Object
The reference to the created service instance
Top

PUBLIC DisposeServices ()

Purpose: Disposes all services
Notes: Calls dispose() on CCS IService implementations

Top

PROTECTED LOGICAL FindService (Class)

Purpose: Searches the passed in Service Class in the ttService temp-table
Notes:

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service that should be located
Returns LOGICAL
Logical value indicating if the service is available
Top

PUBLIC Progress.Lang.Object GetMandatoryService (Class)

Purpose: Gets the service object of the specified type.
Notes: Throws an ServiceNotRegisteredException when no service of that type
registered

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service to return
Returns Progress.Lang.Object
The reference to the instance of the service of ? when the service is not registered with the service container
Top

PUBLIC Progress.Lang.Object GetService (Class)

Purpose: Gets the service object of the specified type
Notes: Returns ? when no service of that type is registered

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service to return
Returns Progress.Lang.Object
The reference to the instance of the service of ? when the service is not registered with the service container
Top

PUBLIC GetServiceTable (table)

Purpose: Returns the service instances as a ttServiceTable output
Notes: See Consultingwerk/Framework/ttServiceTable.i

Parameters:
ttServiceTable TEMP-TABLE ttServiceTable
OUTPUT TABLE The temp-table with the service definitions
Top

PUBLIC LOGICAL IsRegistered (Object)

Purpose: Returns if the given object instance is registered as a Service
in the service container of the overloading service container
Notes:

Parameters:
poService Progress.Lang.Object
The Service instance to check
Returns LOGICAL
Logical value indicating if the object instance is registered as a service
Top

PUBLIC Progress.Lang.Object ReloadService (Class)

Purpose: Reloads the Service instance
Notes: Does not actively delete the existing service instance, it will
just be deregistered
- creates a new instance of the currently loaded service using the default constructor
- removes the existing service from the service container
- adds the new service to the service container and calls initialize() when it's a CCS IService

Parameters:
poClass Progress.Lang.Class
as Progress.Lang.Class
Returns Progress.Lang.Object
The reference to the new Service Instance
Top

PUBLIC RemoveService (Class)

Purpose: Removes the specified service type from the service container.
Notes:

Parameters:
poClass Progress.Lang.Class
The reference to the class or interface of the service to remove from the service container.


Property Detail
Top

PUBLIC Consultingwerk.Framework.IServiceContainer OverloadingServiceContainer


Returns Consultingwerk.Framework.IServiceContainer
Top

PUBLIC LOGICAL VerboseLogging


Returns LOGICAL


Temp-Table Detail

Temp-Table ttServiceTable

Defined in:


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       08.12.2024 12:59:14