A Component is responsible for the management of a set of service Provider(s). The number of providers managed by a component is implementation dependent. The reference implementation maintains providers relative to the associated lifestyle and collection policies. For example, a component declaring the SINGLETON collection policy will have a 0..1 Provider association. The lifetime of the provider will be a function of the associated collection policy and usage contitions.
A Provider exposes the following functions:
- access to the concrete service instance with support for isolution of the instance within a proxy exposing only the service interfaces
- access to the provider state and as a consequence the available mangement transitions and dynamic operations
The following snipet of code demonstrates the creation of a service provider using a part uri and the subsequent resolution of the provider instance.
Controller controller = Controller.STANDARD; URI uri = new URI( "artifact:part:acme/acme-widget#1.1" ); Component component = controller.createComponent( uri ); Provider provider = component.getProvider(); Widget widget = (Widget) provider.getValue( true );