In SCA applications you can implement a component in a
composite by using a second composite. This allows the recursive composition.
Before you begin
The example in this topic uses the SCA AccountServices sample
as a starting point. For links to the sample, see
"Related information" at
the end of this topic.
About this task
The following steps show a simple example of recursive composition
in SCA tools:
Procedure
- In an existing SCA application, create a new composite.
Right-click the namespace node and select . The
composite might have the same namespace as the existing composite.
You can change the namespace if you need to.
- Select the service in the original composite that is the
general service provided by the composite.
- Right-click the name of the service that you selected,
and click Promote. The result of
promoting a component service is that it becomes a service available
on the composite level. Note that you can achieve the same result
manually by adding a service to the composite via the palette or action
bar and then creating a wire between the composite service and the
component service.
- Save the original composite.
- Open the new composite that your created in the first step
of this task.
- With the palette or action bar, add a new component to
the composite.
- Right-click the new component and select . The Composite Selection Dialog opens.
- In the Composite Selection Dialog,
choose the original composite in the application.
- Add a service to the new component. Then, right-click the
service and select Show Properties View. In
the Properties view, select the Core tab. Note
that the default name of the service is service.
- Save the project. If the project now shows an
error and the Problems tab has the message The
"service" service is not defined by the implementation,
this is because the service name that you use on a component that
is implemented by a composite needs to match the name of the service
provided by the original composite.
- If you received the error mentioned in the previous step,
in the properties for the new service change the name to match the
service provided by the implementing composite, and save the project. The error is resolved.
Results
You now have an SCA application created that uses recursive
composition.