Chapter 4. Services

A DBEService (aka. Adapter or Service) is a very simple or a more complex class written in Java. DBEServices must be deployed in the Servent in order to run and become accessible by other DBEServices or DBEClients.

A DBEService is simply a class implementation that, of course, can use other classes or interfaces. Actually the DBEService is also named Adapter because we though the most of them will be used to adapt the brand new DBE business model to old fashioned legacy systems already running in the most of the companies.

The DBEService can also implement all the service logic if there is not another remote system or if we can do a new application. Threads and Tasks can be used at the moment, but we can not promise this will be allowed in later versions because of security restrictions.

DBEServices must not implement a special communication method for the remote invocation process. Public DBEservice methods will be extracted at runtime and a new endpoint will be created in the servent to attend remote invocations. DBEClients will be able to communicate with this DBEService automatically.

Methods, then, will run in where deployed and they must be though and implemented as simple methods.

4.1. DBEService class

DBEService class has not strong implementation restrictions (it must not extend any special class) but it must implement an interface called org.dbe.servent.Adapter. The DBEService implementation must extend at leas a DBEService interface too. All methods from this interface will be parsed so, can be accessible. All public methods declared in the DBEService implementation class that are not declared in the DBEService interface will not be parsed and will not public accessible. Because of serialization needs we must assure all parameters implement the java.io.Serializable class.

Usually in a DBE development this DBEService interface will be obtained directly form the SDL definition. User will only need to implement that interface. Using this SDL2Java process we can (must) be sure the org.dbe.servent.Adapter class will be implemented and the parameters will be serializable.

The org.dbe.servent.Adapter interface has only two methods: init and destroy. The init method is called by the Servent just after instantiate the DBEService and is useful for initialization task.

org.dbe.servent.Adapter interface

public interface Adapter {

    /**

    * Initializes the adapter. The "server provider" can initialize any

    * resource here.

    * @param props The Properties with the initialization parameters

    */

    void init(ServiceContext context);

    /**

    * Executed just before destroy the adapter. The "server provider" can

    *destroy any resource here.

    *

    */ void destroy();

}