This example shows a very simple service that returns the actual Date. Notice three files are necessaries to write the service: ServiceInterface, ServiceImplementation and deployment.props file.
The service interface shows the public methods that will be accessible for others[1]. In this case there will be only one method named getDate.
package demo.date public interface DateInterface { Date getDate (); }
Remember that the implementation is instantiated in the Servent where deployed and it will run in the same Servent. Remote clients will call this DBEServices as RPCs.
Our service implementation must implement the org.dbe.servrent.Adapter interface so two more methods (init and destroy) must be implemented. We have nothing to do in the initialization not in the destroy so will leave these methods in blank.
package demo.date import org.dbe.servent.Adapter public class DateServiceImpl implements DateInterface, Adapter { public Date getDate () { return new Date (); } public void init (ServiceContext context) { /* nop */ } public void destroy () { /* nop */ } }
Finally we only need to write the deployment file. One one parameter is really needed (adapter), but it is also useful to indicate the applicationName.
applicationName=Simple Date Service adapter=demo.date.DateServiceImpl
[1] | When DBE service factory is used this interface is created automatically from SDL |