org.gcube.common.core.scope
Class GCUBEScopeManagerImpl

java.lang.Object
  extended by org.gcube.common.core.scope.GCUBEScopeManagerImpl
All Implemented Interfaces:
GCUBEScopeManager

public class GCUBEScopeManagerImpl
extends Object
implements GCUBEScopeManager

Default implementation of GCUBEScopeManager.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gcube.common.core.scope.GCUBEScopeManager
GCUBEScopeManager.IllegalScopeException
 
Field Summary
protected  GCUBELog logger
          Object logger.
protected  String name
          The name of the manager.
protected  Map<Thread,GCUBEScope> scopes
          Cache of scope information indexed by thread id.
 
Fields inherited from interface org.gcube.common.core.scope.GCUBEScopeManager
CLASS_HEADER_NAME, DEFAULT, NAME_HEADER_NAME, SCOPE_HEADER_NAME, SCOPE_NS
 
Constructor Summary
GCUBEScopeManagerImpl()
          Creates a new instance.
GCUBEScopeManagerImpl(GCUBELog logger)
          Creates a new instance with a given logger.
 
Method Summary
protected  String getName()
          Returns the name with which the manager should log events.
 GCUBEScope getScope()
          Gets the scope for outgoing calls in the current thread.
 void prepareCall(Remote remote, String clazz, String name, GCUBEScope... scope)
          Sets the scope for an outgoing call to a target gCube service.
protected  void setName(String name)
          Sets the name with which the manager should log events
 void setScope(GCUBEScope scope)
          Sets the scope of outgoing calls in the current thread.
 void setScope(Thread thread, GCUBEScope... scope)
          Sets the scope of outgoing calls in a given thread.
 void setScope(Thread thread, GCUBEScope scope)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected GCUBELog logger
Object logger.


scopes

protected Map<Thread,GCUBEScope> scopes
Cache of scope information indexed by thread id.


name

protected String name
The name of the manager.

Constructor Detail

GCUBEScopeManagerImpl

public GCUBEScopeManagerImpl()
Creates a new instance.


GCUBEScopeManagerImpl

public GCUBEScopeManagerImpl(GCUBELog logger)
Creates a new instance with a given logger.

Parameters:
logger - the logger.
Method Detail

getName

protected String getName()
Returns the name with which the manager should log events. If it is not overridden, the manager logs for itself.

Returns:
the name.

setName

protected void setName(String name)
Sets the name with which the manager should log events

Parameters:
name - the name

setScope

public void setScope(GCUBEScope scope)
Sets the scope of outgoing calls in the current thread.

Specified by:
setScope in interface GCUBEScopeManager
Parameters:
scope - the scope.

setScope

public void setScope(Thread thread,
                     GCUBEScope scope)
              throws GCUBEScopeManager.IllegalScopeException
Throws:
GCUBEScopeManager.IllegalScopeException

setScope

public void setScope(Thread thread,
                     GCUBEScope... scope)
Sets the scope of outgoing calls in a given thread.

Specified by:
setScope in interface GCUBEScopeManager
Parameters:
thread - the thread.
scope - (optional) the scope. If omitted, it defaults to the scope of the current thread.

getScope

public GCUBEScope getScope()
Gets the scope for outgoing calls in the current thread.

Specified by:
getScope in interface GCUBEScopeManager
Returns:
the scope;

prepareCall

public void prepareCall(Remote remote,
                        String clazz,
                        String name,
                        GCUBEScope... scope)
Sets the scope for an outgoing call to a target gCube service.

Specified by:
prepareCall in interface GCUBEScopeManager
Parameters:
remote - the stub of the target port-type.
clazz - the gCube class of the target service.
name - the gCube name of the target service.
scope - (optional) the scope of the call. If omitted, the scope associated with the current thread will be used.
See Also:
GCUBERemotePortTypeContext.getProxy(Remote, org.gcube.common.core.contexts.GCUBEServiceContext), GCUBERemotePortTypeContext.getProxy(Remote, GCUBEScope, org.gcube.common.core.security.GCUBESecurityManager...), GCUBERemotePortTypeContext.getProxy(Remote, GCUBEScopeManager, org.gcube.common.core.security.GCUBESecurityManager...)


Copyright © 2012. All Rights Reserved.