pip_services3_container.refer.RunReferencesDecorator module

pip_services3_container.refer.RunReferencesDecorator

Run references decorator implementation.

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_container.refer.RunReferencesDecorator.RunReferencesDecorator(next_references: pip_services3_commons.refer.IReferences.IReferences, top_references: pip_services3_commons.refer.IReferences.IReferences)

Bases: pip_services3_container.refer.ReferencesDecorator.ReferencesDecorator, pip_services3_commons.run.IOpenable.IOpenable

References decorator that automatically opens to newly added components that implement IOpenable interface and closes removed components that implement IClosable interface.

close(correlation_id: Optional[str])

Closes component and frees used resources.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

is_open()bool

Checks if the component is opened.

Returns

true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

put(locator: Any = None, component: Any = None)

Puts a new component into this component map.

Parameters
  • locator – a locator to find the component by.

  • component – a component component to be added.

remove(locator: Any) → Any

Removes a previously added component that matches specified locator. If many references match the locator, it removes only the first one. When all references shall be removed, use removeAll() method instead.

Parameters

locator – a locator to remove component

Returns

the removed component component.

remove_all(locator: Any) → List[Any]

Removes all component references that match the specified locator.

Parameters

locator – the locator to remove references by.

Returns

a list, containing all removed references.