Namespace: Consultingwerk.Framework
Class 
ServiceContainer Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object
Implements: 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



Top Method Summary
Options Name Purpose
+ 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
# 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
+ RemoveService (Class) Removes the specified service type from the service container.


Method Detail
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 refrence to the created service instance
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 TABLE
OUTPUT TABLE The temp-table with the service definitions
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.


©2006-2016 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       26.08.2016 08:29:02