THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
To illustrate the composition we will design a Hello World application named HelloComposition. This application offers a service writing a Hello message for each imported Person. Each person is published as a service and is used by the composition to write the message. <IMAGE1>
Application Design
...
- an Hello Service : returning a Hello message
- a Directory service : aggregating Person services to create a Directory
- a Say Hello Service : requiring an Hello Service and a Directory Service to write Hello Service to person contained in the Directory.
An "instantiable" service is a service that we can instantiate through a Factory. The following code snippets show the different service specification:Code Block public interface Hello {
...
public void hello(String name); }
Code Block public interface Directory {
...
public Person getPerson(String name);
...
public List<Person> getPersons();
...
public void addPerson(String name, String adress);
...
public void removePerson(String name); }
Code Block public interface Person {
...
public String getName();
...
public String getAddress(); }
Code Block public interface SayService {
...
So to design our application we will use these services to obtain the following applications.public void say(); }
Application Description
To describe our application, we will use the iPOJO ADL:
Code Block |
---|
<composite name="HelloComposition" factory="Hello" architecture="true"> <import specification="org.apache.felix.ipojo.composition.ex1.person.Person" aggregate aggregate="true"/> <export specification="org.apache.felix.ipojo.composition.ex1.say.SayService"/> <service specification="org.apache.felix.ipojo.composition.ex1.hello.Hello"/> <service specification="org.apache.felix.ipojo.composition.ex1.say.SayService"/> <service specification="org.apache.felix.ipojo.composition.ex1.directory.Directory"/> </composite> |
...
Code Block |
---|
<composite name="composite.bar "> <service specification="org.apache.felix.ipojo.test.scenarios.service.Hello"> > <property name="language" value="en"/> </service> </composite> |
...
Code Block |
---|
<composite name="composite.bar " architecture="true"><service specification="org.apache.felix.ipojo.test.scenarios.service.Hello"> > <property name="language" value="en"/> </service></composite> |
...
More documentation on this feature comes soon.