Hi All;

Currently we have an interface called Service and which has few methods
that are used to manage session (or else user can add those method into
service impl class w.o implementing the interface). And that interface
has the following methods ;

- startUp
- init
- setOperationContext
- destroy

Three of them are for managing service life cycle ;
- init – will be called when the session start
- setOperationContext – immediately before calling actual java method
- destroy – will be call when the session finishes

Remember all those method work if and only if you use Axis2 default
message receiver or you code gen.

The method startUp is not session related method , which is useful when
you want to initialize database connections , create thread etc ... at
the time when you deploy the service. In the mean time interface name
Service is bit confusing to me AFAIK it should be ServiceLifeCycle. And
having method like startUp in that interface confuses the users.

So how about the following changes ;
- Rename Service interface into ServiceLifeCycle
- Then remove startUp method from that interface.

There should be a some other interface (like Module interface) and which
should be optional as well , to have the method startUp. If someone want
to open DB connection or anything at the time of service deploying ,
then he need to implement that interface (and for me which is identical
to Module interface). So with this change service element inside the
services.xml will be change to following

<service name=”foo” *class=”implementation class of the interface ”*>
<parameter name="ServiceClass">ServiceClass</parameter>
</service>

Here the class attribute is optional , so if someone want to have
loadonStartup feature then he need to implement the Service interface
(new one) and put the impl name as the class attribute. This is very
useful if your service implementation class is not java (if you are
writing a groovy serice).

So new Service interface will be look like follows;
public interface Service{
//will be called when service is deployed
public void startUp(ConfigurationContext configctx, AxisService service);
//will be called when Axis2 server showdown or when service removed from
the system
public void shutDown(ConfigurationContext configctx, AxisService service);
}

And ServiceLifeCycle interface will look like below;

public interface ServiceLifeCycle {
public void init(ServiceContext sc);
public void setOperationContext(OperationContext operationContext);
void destroy(ServiceContext sc);
}


I am +1 on doing this for Axis2 1.1 :)

Suggestions ........

Thanks
Deepal



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to