|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Webservice implements this interface if it needs to be initialized and destroyed by the container. A typical usage is to read a webservice instance configuration:
public class MyService implements Initializable { public void init(ServiceInstance serviceInstance) { MyConf conf = (MyConf)serviceInstance.getConfigurable().narrow(MyConf.class); ... = conf.get...; ... public void destroy() { ... } }Web service configuration can be in the deployment descriptor which is deployed to WSO2 SOA Enablement Server together with the webservice. In this case the container calls
init(ServiceInstance)
with configuration from the deployment
descriptor when it's instantiated.
If the webservice instance is created at runtime (non persistent deployment)
we can create webservice configuration at runtime also with
Configurator.newRuntimeConfigurable()
. Then webservice
initialization looks like:
Configurable conf = Configurator.newRuntimeConfigurable(); ((MyConf)conf.narrow(MyConf.class)).set...; ServiceInstance instance = ServiceInstance.create(new MyService()); instance.setConfigurable(conf); // the following line causes the initialization Registry.publish(ServiceEndpoint.create("/MyService", instance));
ServiceInstance
Method Summary | |
void |
destroy()
Called just before the web service is destroyed by the container. |
void |
init(ServiceInstance serviceInstance)
This method is called after a web service is loaded into the container during setting service state to enabled . |
Method Detail |
public void init(ServiceInstance serviceInstance)
enabled
. This may occur during the first
service call, explicit setting of service state to enabled
or during wasp initalization depending on preload
attribute in service instance
configuration (only persistently deployed services).
serviceInstance
- service instancepublic void destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |