org.gcube.common.core.contexts
Class GCUBERemotePortTypeContext<PORTTYPE extends Remote>

java.lang.Object
  extended by org.gcube.common.core.contexts.GCUBEContext
      extended by org.gcube.common.core.contexts.GCUBERemotePortTypeContext<PORTTYPE>
Type Parameters:
PORTTYPE - the type of the stub of the remote port-type.

public class GCUBERemotePortTypeContext<PORTTYPE extends Remote>
extends GCUBEContext

Contexts for remote port-types accessed through a locally available distribution of their stubs.

If the distribution is gCube-compliant (e.g. was produced with gCore building facilities), the contexts expose the configuration of the remote port-type and its service, and in fact use it to achieve transparent setting of scoping and security for gCube calls to the port-type.

Normally, clients do not work directly with the contexts, but request a gCube proxy to the conventional port-type stub, which can offer the transparencies mentioned above. Contexts are instead created implicitly, in the process of creating stub proxies. They are then shared across all future requests for proxies of the same remote port-types.

Author:
Fabio Simeoni (University of Strathclyde), Manuele Simi (ISTI-CNR)

Field Summary
protected static String BUILD_PROPERTIES_FILE_NAME
          Standard name of the build property file of the remote port-type.
static String CALLER_HEADER_NAME
          Name of the scope call header.
static String CALLER_NS
          Namespace of scope-related headers
static String CLASS_HEADER_NAME
          Name of the service class call header.
protected static Map<Class<? extends Remote>,GCUBERemotePortTypeContext<?>> contexts
          Cache of remote port-type contexts.
protected  org.apache.axis.deployment.wsdd.WSDDService deploymentDescriptor
          The deployment descriptor of the remote port-type.
protected static String JNDI_FILE_NAME
          Standard name of the JNDI configuration file of the remote port-type.
protected static String JNDI_NAME_BUILD_PROPERTY
          Standard name of the build property which identifies the JNDI configuration of the remote port-type.
protected static String JNDI_STUBS_ROOT_CONTEXT
          Root Context for remote port-type configurations.
static String NAME_HEADER_NAME
          Name of the service name call header.
protected  Class<? extends Remote> portTypeClass
          The class of the stub of the remote port-type.
protected  String portTypeJNDIName
          The JNDI name of the remote port-type.
static String SCOPE_HEADER_NAME
          Name of the scope call header.
static String SCOPE_NS
          Namespace of scope-related headers
protected  org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor securityDescriptor
          The security descriptor of the remote port-type.
protected  GCUBEService service
          The local resource which models the service of the remote port-type.
protected  String serviceJNDIName
          The JNDI name of the service of the remote port-type.
protected static String WSDD_FILE_NAME
          Standard name of the WSDD configuration file of the remote port-type.
 
Fields inherited from class org.gcube.common.core.contexts.GCUBEContext
logger, timers
 
Method Summary
 org.apache.axis.deployment.wsdd.WSDDService getDeploymentDescriptor()
          Returns the deployment descriptor of the remote port-type.
 Object getProperty(String prop, boolean... required)
          Resolve a configuration property against the naming service.
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub)
          Returns a gCube proxy to a conventional stub of a remote port-type.
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEScope scope, GCUBESecurityManager... securityManager)
          Deprecated. as to 1.6.0 sets the current scope and redirects to getProxy(Remote) ignoring the GCUBESecurityManager parameter
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEScope scope, int callTimeout, GCUBESecurityManager... securityManager)
          Deprecated. as to 1.6.0 sets the current scope and redirects to #getProxy(Remote, int), ignoring the GCUBESecurityManager parameter
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEScopeManager scopeManager, GCUBESecurityManager... securityManager)
          Deprecated. as to 1.6.0 redirects to getProxy(Remote) ignoring GCUBEScopeManager and GCUBESecurityManager parameters
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEScopeManager scopeManager, int callTimeout, GCUBESecurityManager... securityManager)
          Deprecated. as to 1.6.0 redirects to #getProxy(Remote, int) ignoring GCUBEScopeManager and GCUBESecurityManager parameters
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEServiceContext context)
          Returns a gCube proxy to a conventional stub of a remote port-type.
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, GCUBEServiceContext context, int callTimeout)
          Returns a gCube proxy to a conventional stub of a remote port-type.
static
<PORTTYPE extends Remote>
PORTTYPE
getProxy(PORTTYPE portTypeStub, int callTimeout, GCUBEServiceContext... context)
          Returns a gCube proxy to a conventional stub of a remote port-type.
 InputStream getResource(String resourceName)
          Returns a classpath resource given its path.
 org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor getSecurityDescriptor()
          Returns the security descriptor of the remote port-type.
 GCUBEService getService()
          Returns the GCUBEService resource of the service of the remote port-type.
 Object getServiceProperty(String prop)
          Returns the value of an arbitrary JNDI property (resource or environment) of the service of the remote port-type.
protected  void parseJNDIConfig(InputStream config)
          Loads a JNDI configuration file into the JNDI context reserved to remote port-types.
 
Methods inherited from class org.gcube.common.core.contexts.GCUBEContext
debugContext, getFile, getJNDIContext, getName, getTiming, printContext, resetTimer, setJNDIContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_HEADER_NAME

public static final String CLASS_HEADER_NAME
Name of the service class call header.

See Also:
Constant Field Values

NAME_HEADER_NAME

public static final String NAME_HEADER_NAME
Name of the service name call header.

See Also:
Constant Field Values

SCOPE_HEADER_NAME

public static final String SCOPE_HEADER_NAME
Name of the scope call header.

See Also:
Constant Field Values

SCOPE_NS

public static final String SCOPE_NS
Namespace of scope-related headers

See Also:
Constant Field Values

JNDI_STUBS_ROOT_CONTEXT

protected static String JNDI_STUBS_ROOT_CONTEXT
Root Context for remote port-type configurations.


JNDI_FILE_NAME

protected static String JNDI_FILE_NAME
Standard name of the JNDI configuration file of the remote port-type.


WSDD_FILE_NAME

protected static String WSDD_FILE_NAME
Standard name of the WSDD configuration file of the remote port-type.


BUILD_PROPERTIES_FILE_NAME

protected static String BUILD_PROPERTIES_FILE_NAME
Standard name of the build property file of the remote port-type.


JNDI_NAME_BUILD_PROPERTY

protected static String JNDI_NAME_BUILD_PROPERTY
Standard name of the build property which identifies the JNDI configuration of the remote port-type.


CALLER_HEADER_NAME

public static final String CALLER_HEADER_NAME
Name of the scope call header.

See Also:
Constant Field Values

CALLER_NS

public static final String CALLER_NS
Namespace of scope-related headers

See Also:
Constant Field Values

contexts

protected static Map<Class<? extends Remote>,GCUBERemotePortTypeContext<?>> contexts
Cache of remote port-type contexts.


portTypeClass

protected Class<? extends Remote> portTypeClass
The class of the stub of the remote port-type.


service

protected GCUBEService service
The local resource which models the service of the remote port-type.


serviceJNDIName

protected String serviceJNDIName
The JNDI name of the service of the remote port-type.


portTypeJNDIName

protected String portTypeJNDIName
The JNDI name of the remote port-type.


deploymentDescriptor

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


securityDescriptor

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

Method Detail

getProxy

public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                          GCUBEServiceContext context)
                                        throws Exception
Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the context of a given GCUBEServiceContext.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
context - the service context.
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                          GCUBEServiceContext context,
                                                          int callTimeout)
                                        throws Exception
Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the context of a given GCUBEServiceContext.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
context - the service context.
callTimeout - the timeout per each call
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

@Deprecated
public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                                     GCUBEScope scope,
                                                                     GCUBESecurityManager... securityManager)
                                        throws Exception
Deprecated. as to 1.6.0 sets the current scope and redirects to getProxy(Remote) ignoring the GCUBESecurityManager parameter

Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in a given GCUBEScope and in the context of a given GCUBESecurityManager.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
scope - the scope.
securityManager - the security manager.
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

@Deprecated
public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                                     GCUBEScope scope,
                                                                     int callTimeout,
                                                                     GCUBESecurityManager... securityManager)
                                        throws Exception
Deprecated. as to 1.6.0 sets the current scope and redirects to #getProxy(Remote, int), ignoring the GCUBESecurityManager parameter

Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in a given GCUBEScope and in the context of a given GCUBESecurityManager. Note: the proxy so-created

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
scope - the scope.
callTimeout - the timeout per each call
securityManager - the security manager.
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

@Deprecated
public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                                     GCUBEScopeManager scopeManager,
                                                                     GCUBESecurityManager... securityManager)
                                        throws Exception
Deprecated. as to 1.6.0 redirects to getProxy(Remote) ignoring GCUBEScopeManager and GCUBESecurityManager parameters

Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the context of a given GCUBEScopeManager and a given GCUBESecurityManager.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
scopeManager - the scope manager.
securityManager - the security manager.
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

@Deprecated
public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                                     GCUBEScopeManager scopeManager,
                                                                     int callTimeout,
                                                                     GCUBESecurityManager... securityManager)
                                        throws Exception
Deprecated. as to 1.6.0 redirects to #getProxy(Remote, int) ignoring GCUBEScopeManager and GCUBESecurityManager parameters

Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the context of a given GCUBEScopeManager and a given GCUBESecurityManager.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
scopeManager - the scope manager.
callTimeout - the timeout per each call
securityManager - the security manager.
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub)
                                        throws Exception
Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the current scope.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
callTimeout - the timeout per each call
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getProxy

public static <PORTTYPE extends Remote> PORTTYPE getProxy(PORTTYPE portTypeStub,
                                                          int callTimeout,
                                                          GCUBEServiceContext... context)
                                        throws Exception
Returns a gCube proxy to a conventional stub of a remote port-type. The proxy is expected to be used for gCube calls in the current scope.

Type Parameters:
PORTTYPE - the type of the port-type stub.
Parameters:
portTypeStub - the original port-type stub.
callTimeout - the timeout per each call
Returns:
the gCube proxy to the stub.
Throws:
Exception - if a proxy for the stub could not be returned.

getResource

public InputStream getResource(String resourceName)
Returns a classpath resource given its path. By default, a relative path is resolved with respect to the context implementation.

Overrides:
getResource in class GCUBEContext
Returns:
the resource, or null if the path could not be resolved.

getServiceProperty

public Object getServiceProperty(String prop)
Returns the value of an arbitrary JNDI property (resource or environment) of the service of the remote port-type.

Parameters:
prop - the property.
Returns:
the value of the property.

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.

getService

public GCUBEService getService()
Returns the GCUBEService resource of the service of the remote port-type.

Returns:
the resource.

getDeploymentDescriptor

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

Returns:
the deployment descriptor.

getSecurityDescriptor

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

Returns:
the security descriptor.

parseJNDIConfig

protected void parseJNDIConfig(InputStream config)
                        throws Exception
Loads a JNDI configuration file into the JNDI context reserved to remote port-types.

Parameters:
config - the file as a stream.
Throws:
Exception - if the configuration could not be loaded.


Copyright © 2013. All Rights Reserved.