AutoArchive._infrastructure.service¶
Support framework for registering and accessing services.
Modules¶
iservice_component¶
IServiceComponent interface.
- class AutoArchive._infrastructure.service.iservice_component.IServiceComponent(applicationContext, serviceAccessor)[source]¶
Bases:
objectInterface for service components.
- Parameters:
serviceAccessor (
IServiceAccessor) – Can be used to get/register services.applicationContext (
ApplicationContext) – Application context.
iservice¶
- class AutoArchive._infrastructure.service.iservice.IService(wokDir: str = None)[source]¶
Bases:
objectInterface for component’s services.
See also:
ServiceAccessor.- Parameters:
workDir – Path to a writable directory which shall be used as a persistent storage.
iservice_identification¶
IServiceIdentification interface.
_service_accessor¶
- class AutoArchive._infrastructure.service._service_accessor.ServiceAccessor(workDir: str)[source]¶
Bases:
objectAccess to services.
A service can be made available by registering via this interface. Registered classes has to implement
IService.- Parameters:
workDir – Path to a writable directory which shall be used as a persistent storage.
- getOrCreateService(serviceIdentification: type[IServiceIdentification], providerIdentification: str | None) IService[source]¶
Provides access to registered services interfaces.
See also:
registerInterface().- Parameters:
serviceIdentification (
IServiceIdentification) – Identification of the service that shall be created.providerIdentification (
str) – Service provider identification under which it was registered. For services with single provider which were registered with service provider identificationNoneit shall beNone.
- Returns:
Instance of a service provider of the particular service.
- Return type:
serviceIdentification.interface- Raises:
KeyError – If
serviceIdentificationis not registered.
- getOrCreateServices(serviceIdentification: type[IServiceIdentification]) Iterator[IService][source]¶
- registerService(serviceIdentification: type[__ISI], providerClass: type[IService], providerIdentification: str = None)[source]¶
Registers a service.
See also:
unregisterService(),getOrCreateService().- Parameters:
serviceIdentification (
IServiceIdentification) – Identification of the service that shall be registered.providerClass (
type{serviceIdentification.interface,IService}) – Provider of the service.providerIdentification (
serviceIdentification.providerIdentificationInterface) – Corresponding service provider identification object.
- Raises:
TypeError – If
providerClassdoes not implementserviceIdentification.interface. IfproviderIdentificationdoes not implementserviceIdentification.providerIdentificationInterface.KeyError – If
serviceIdentificationis already registered withproviderClassorproviderIdentification.
- unregisterService(serviceIdentification: type[IServiceIdentification])[source]¶
Unregisters a service with all its providers.
All serviceType instances all destroyed first.
See also:
registerService(),getOrCreateService().- Parameters:
serviceIdentification (
IServiceIdentification) – Identification of the service that shall be registered.- Raises:
KeyError – If
serviceIdentificationis not registered.