Open main menu

CDOT Wiki β

Changes

OSGi Concepts Services

413 bytes added, 15:38, 21 January 2011
no edit summary
<source lang="java">
package cs.ecl.osgi.simple.declarativeservice.say.internals;
 
 
import java.util.Date;
 
 
import cs.ecl.osgi.simple.declarativeservice.say.Sayable;
 
public class TodaySay implements Sayable {
 
 
public String say() {
return " Declarative Service: Today is " + new Date();
}
}
</source>
 
The relationships between the interface that is exposed to the client and the implementation that is hidden, must be defined in a xml file:
 
<source lang="xml">
<?xml version="1.0"?>
<component name="sayable">
<implementation class="cs.ecl.osgi.simple.declarativeservice.say.internals.TodaySay"/>
<service>
<provide interface="cs.ecl.osgi.simple.declarativeservice.say.Sayable"/>
</service>
</component>
</source>