Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A composite component type is described in the metadata.xml file of an iPOJO bundle which means that iPOJO creates a factory service for the composite, like all iPOJO components. Also like all iPOJO components, it is possible to create an instance of the composite in the metadata file by declaring an instance, such as:

Code Block
<instance component="Hello" name="hello-composition"/>

To avoid packaging issues, all referenced service specifications are imported by the bundle containing the composite.

...

Run Time

Imagine at runtime run time you have:

  • Two factories that can create Hello service provider instances.
  • A factory that can create Dispatcher service provider instances.
  • A factory that can create Directory service provider instances.
  • Several existing Person service instances.

When you deploy the example composition and create an instance of it, iPOJO will manage your application:all aspects of it are automatically managed by iPOJO:

  • All available Person services from the parent composite are imported into the composite.
  • One Hello service
  • The composite will import all available services.
  • The composite will instantiate a Hello provider, one Directory service provider, and one SayHello Dispatcher service provider are instantiated inside the composite.
  • The composite will provides the HelloDispatcher service.
    The service providing is made by delegating service invocation on services contained in the composition. If the mapping cannot be infered, the composition is considered as invalid and cannot be started.HelloDispatcher service method calls are wired to the constituent sub-services and it is provided into the parent composite.

If the factory which creates the

...

Hello provider disappears (i.e., its instances become invalid), the composite will automatically

...

switch to the second one to

...

validate the composite service. If the second

...

Hello provider disappears too, then the composite will be

...

invalidated (i.e., the

...

provided service will be

...

revoked)

...

and it will wait for

...

new

...

factory

...

providing Hello service

...

instances, which may themselves also be composite implementations.

When a person service appears this service Person service appears in the parent composite, it is automatically inserted inside into the composite. Likewise, as well as if a person service disappear this service Person service disappears from the parent composite, it is automatically removed from the composite.

You can see a A flash demo of this composition hereis available.

Composition Features

Service Import

...

Code Block
<import specification="...Hello" optional="true" aggregate="true" filter="(language=en)"/>

Service Providing

If the mapping cannot be infered, the composition is considered as invalid and cannot be started.

The composite can provide services from the composite to the parent composite. Each service providing is described by an 'provides' element in the composite description. A 'provides' needs to specify provided specification.

...