org.gcube.common.core.contexts
Class GCUBEPortTypeContext

java.lang.Object
  extended by org.gcube.common.core.contexts.GCUBEContext
      extended by org.gcube.common.core.contexts.GCUBEPortTypeContext
Direct Known Subclasses:
GCUBEStatefulPortTypeContext

public abstract class GCUBEPortTypeContext
extends GCUBEContext

Partial implementation of contexts for port-types.

If useful, the creation of a port-type context may be cached, e.g. using the pattern illustrated for GCUBEServiceContext.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
protected  class GCUBEPortTypeContext.PTConsumer
          A Consumer for port-type registration to RI scope removal events.
 
Field Summary
protected  org.apache.axis.deployment.wsdd.WSDDService deploymentDescriptor
          The deployment descriptor of the port-type.
protected  String name
          The name of the port-type.
protected  org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor securityDescriptor
          The security descriptor of the port-type.
protected static String WSDD_FILE_NAME
          The name of the deployment descriptor.
protected static String WSSD_WSDD_NAME
          The name of the security descriptor parameter in the deployment descriptor.
 
Fields inherited from class org.gcube.common.core.contexts.GCUBEContext
logger, timers
 
Constructor Summary
GCUBEPortTypeContext()
           
 
Method Summary
 org.apache.axis.deployment.wsdd.WSDDService getDeploymentDescriptor()
          Returns the deployment descriptor of the port-type.
 org.apache.axis.message.addressing.EndpointReferenceType getEPR()
          Returns an (unqualified) EPR to the port-type.
 File getFile(String path, boolean... writeMode)
          Gives read or write access to a File.
abstract  String getJNDIName()
          Return the name of the port-type in the JNDI configuration
 String getName()
          Returns a name for the port-type to use in log entries.
abstract  String getNamespace()
          Returns the namespace of the port-type.
 File getPersistentFile(String path, boolean... writeMode)
          Gives read or write access to a File that will persist across redployments of the Running Instance.
 Object getProperty(String prop, boolean... required)
          Resolve a configuration property against the naming service.
 org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor getSecurityDescriptor()
          Returns the security descriptor of the port-type.
abstract  GCUBEServiceContext getServiceContext()
          Returns the name of the service of the port-type.
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 org.gcube.common.core.contexts.GCUBEContext
debugContext, getJNDIContext, getResource, getTiming, printContext, resetTimer, setJNDIContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WSDD_FILE_NAME

protected static String WSDD_FILE_NAME
The name of the deployment descriptor.


WSSD_WSDD_NAME

protected static String WSSD_WSDD_NAME
The name of the security descriptor parameter in the deployment descriptor.


name

protected String name
The name of the port-type.


deploymentDescriptor

protected org.apache.axis.deployment.wsdd.WSDDService deploymentDescriptor
The deployment descriptor of the port-type.


securityDescriptor

protected org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor securityDescriptor
The security descriptor of the port-type.

Constructor Detail

GCUBEPortTypeContext

public GCUBEPortTypeContext()
Method Detail

getEPR

public org.apache.axis.message.addressing.EndpointReferenceType getEPR()
                                                                throws Exception
Returns an (unqualified) EPR to the port-type.

Returns:
the EPR.
Throws:
Exception - if the EPR could not be derived.

getName

public String getName()
Returns a name for the port-type to use in log entries. By default, it derives a name from the JNDI name of the port-type.

Overrides:
getName in class GCUBEContext
Returns:
the name.
See Also:
getJNDIName()

getProperty

public Object getProperty(String prop,
                          boolean... required)
                   throws RuntimeException
Resolve a configuration property against the naming service. Resolution is relative to the root JNDI context of the naming service and the JNDI name associated with the context.

Overrides:
getProperty in class GCUBEContext
Parameters:
prop - the property.
required - (optional) true if the property is required, false or omitted if property is optional. The only implication is a different handling of failure and logging. Failure in resolving optional properties results in a runtime exception and fatal log entry, whereas failure in resolving optional properties results in a null result and warning in the log.
Returns:
the value of the property, or null if the property was optional and could not be resolved.
Throws:
RuntimeException - if the property is required but cannot be resolved.

getDeploymentDescriptor

public org.apache.axis.deployment.wsdd.WSDDService getDeploymentDescriptor()
Returns the deployment descriptor of the port-type.

Returns:
the deployment descriptor.

getSecurityDescriptor

public org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor getSecurityDescriptor()
Returns the security descriptor of the port-type.

Returns:
the security descriptor.

getFile

public File getFile(String path,
                    boolean... writeMode)
Gives read or write access to a File. Write access induces backups and read access relies on backups to recover from failures.

Overrides:
getFile in class GCUBEContext
Parameters:
path - the file path.
writeMode - (optional) the access mode, true for write access and false for read access (default).
Returns:
the file.

getPersistentFile

public File getPersistentFile(String path,
                              boolean... writeMode)
                       throws IllegalArgumentException
Gives read or write access to a File that will persist across redployments of the Running Instance.

Parameters:
path - the file path.
writeMode - (optional) the access mode, true for write access and false for read access (default).
Returns:
the file.
Throws:
IllegalArgumentException - if access is in write mode and the path is to a folder.
See Also:
GCUBEServiceContext.getPersistentFile(String, boolean...)

getJNDIName

public abstract String getJNDIName()
Return the name of the port-type in the JNDI configuration

Returns:
the JNDI name.

getNamespace

public abstract String getNamespace()
Returns the namespace of the port-type.

Returns:
the namespace.

getServiceContext

public abstract GCUBEServiceContext getServiceContext()
Returns the name of the service of the port-type.

Returns:
the name.

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.

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.

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.

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.

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.


Copyright © 2012. All Rights Reserved.