org.gcube.common.core.porttypes
Class GCUBEPortType

java.lang.Object
  extended by org.gcube.common.core.porttypes.GCUBEPortType
All Implemented Interfaces:
javax.xml.rpc.server.ServiceLifecycle

public abstract class GCUBEPortType
extends Object
implements javax.xml.rpc.server.ServiceLifecycle

Partial implementation for port-types of gCube Services. It ensures correct initialisation of the service and defines callbacks for lifetime events of Running Instances.

Author:
Fabio Simeoni (University of Strathclyde)

Field Summary
protected  boolean initialized
          Marks the initialisation of the port-type.
protected  GCUBELog logger
          Object logger.
 
Constructor Summary
GCUBEPortType()
           
 
Method Summary
 void destroy()
          Invoked at container shutdown if the port-type has Application scope, after processing each request if the port-type has Request scope, and at the end of each session if the port-type has Session scope.
protected abstract  GCUBEServiceContext getServiceContext()
          Returns the service context.
 void init(Object arg0)
          Invoked at container startup if the port-type has Application scope, before processing each request if the port-type has Request scope, and at the beginning of each session if the port-type has Session scope.
protected  void onFailure()
          Invoked when the Running Instance fails.
protected  void onInitialisation()
          Invoked when the Running Instance has completed initialisation.
protected  void onReady()
          Invoked when the Running Instance is ready to operate.
protected  void onStateChange()
          Invoked upon a change to the RI's stateful resources, if any.
protected  void onUpdate()
          Invoked when the Runnning Instance is updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final GCUBELog logger
Object logger.


initialized

protected boolean initialized
Marks the initialisation of the port-type.

Constructor Detail

GCUBEPortType

public GCUBEPortType()
Method Detail

init

public final void init(Object arg0)
                throws javax.xml.rpc.ServiceException
Invoked at container startup if the port-type has Application scope, before processing each request if the port-type has Request scope, and at the beginning of each session if the port-type has Session scope.

Triggers the initialisation of the service.

Specified by:
init in interface javax.xml.rpc.server.ServiceLifecycle
Throws:
javax.xml.rpc.ServiceException - if the prto-type could not be initialised

getServiceContext

protected abstract GCUBEServiceContext getServiceContext()
Returns the service context.

Returns:
the context.

destroy

public void destroy()
Invoked at container shutdown if the port-type has Application scope, after processing each request if the port-type has Request scope, and at the end of each session if the port-type has Session scope.

By default, it does nothing. If required, override to free system resources.

Specified by:
destroy in interface javax.xml.rpc.server.ServiceLifecycle

onInitialisation

protected void onInitialisation()
                         throws Exception
Invoked when the Running Instance has completed initialisation. If needed, override in accordance with service semantics.

Throws:
Exception - if the callback did not complete successfully and the service ought to fail as a result.

onReady

protected void onReady()
                throws Exception
Invoked when the Running Instance is ready to operate. If needed, override in accordance with service semantics.

Throws:
Exception - if the callback did not complete successfully and the service ought to fail as a result.

onFailure

protected void onFailure()
                  throws Exception
Invoked when the Running Instance fails. If needed, override in accordance with service semantics.

Throws:
Exception - if the callback did not complete successfully and the service ought to fail as a result.

onUpdate

protected void onUpdate()
                 throws Exception
Invoked when the Runnning Instance is updated. If needed, override in accordance with service semantics.

Throws:
Exception - if the callback did not complete successfully and the service ought to fail as a result.

onStateChange

protected void onStateChange()
                      throws Exception
Invoked upon a change to the RI's stateful resources, if any. If needed, override in accordance with service semantics.

Throws:
Exception - if the callback did not complete successfully and the service ought to fail as a result.


Copyright © 2013. All Rights Reserved.