org.gcube.common.core.scope
Class GCUBEScope

java.lang.Object
  extended by org.gcube.common.core.scope.GCUBEScope
Direct Known Subclasses:
VO, VRE

public abstract class GCUBEScope
extends Object

Models a scope within a gCube infrastructure:

1) scopes are named, typed, and may be enclosed in another scopes. Three levels of nesting are possible: the type of root scopes is INFRASTRUCTURE, the type of scopes below infrastructures is VO, and the type of scopes below that is VRE.
2) scopes are generated from linear expressions of the form /[string]/[string]/[string], where each separator introduces a level of scope and each string names the scope.

Author:
Andrea Manzi (CNR), Fabio Simeoni (University of Strathclyde)

Nested Class Summary
static class GCUBEScope.MalformedScopeExpressionException
          Raised when parsing malformed scope expressions.
static class GCUBEScope.ScopeExpression
          Helper class to parse scope expressions.
static class GCUBEScope.Type
          Scope types *
 
Field Summary
protected static char pathSeparator
          Scope separators used in linear syntax.
protected  ServiceMap serviceMap
          The map of service endpoints associated with the scope.
 
Constructor Summary
protected GCUBEScope(String name)
          Used internally to creates a new scope with a given name.
 
Method Summary
 boolean equals(Object object)
          
 GCUBEScope getEnclosingScope()
          Returns the enclosing scope, if any.
 GCUBEScope getInfrastructure()
          Returns the infrastructure of this scope.
 String getName()
          Returns the name of the scope.
static GCUBEScope getScope(String exp)
          Returns a scope from its linear expression.
abstract  ServiceMap getServiceMap()
          Returns the map of service endpoints associated with the scope.
 GCUBEScope.Type getType()
          Returns the type of the scope.
 int hashCode()
          
 boolean isEnclosedIn(GCUBEScope scope)
           
 boolean isInfrastructure()
          Indicates whether the scope is the whole infrastructure.
 void makeCurrent()
          Used internally to creates a new scope with a given name.
protected  void setEnclosingScope(GCUBEScope enclosingScope)
          Used internally to set the enclosing scope of the scope.
 void setServiceMap(ServiceMap map)
          Sets the map of service endpoint associated with the scope.
 String toString()
          Returns the linear expression of the scope.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

pathSeparator

protected static char pathSeparator
Scope separators used in linear syntax.


serviceMap

protected ServiceMap serviceMap
The map of service endpoints associated with the scope.

Constructor Detail

GCUBEScope

protected GCUBEScope(String name)
Used internally to creates a new scope with a given name.

Parameters:
name - the name.
Method Detail

getScope

public static GCUBEScope getScope(String exp)
                           throws GCUBEScope.MalformedScopeExpressionException
Returns a scope from its linear expression.

Parameters:
exp - the expressions.
Returns:
the scope.
Throws:
GCUBEScope.MalformedScopeExpressionException - if the expression is malformed.

makeCurrent

public void makeCurrent()
Used internally to creates a new scope with a given name.

Parameters:
name - the name.

getInfrastructure

public GCUBEScope getInfrastructure()
Returns the infrastructure of this scope.

Returns:
the infrastructure.

getName

public String getName()
Returns the name of the scope.

Returns:
the name.

getEnclosingScope

public GCUBEScope getEnclosingScope()
Returns the enclosing scope, if any.

Returns:
the enclosing scope, or null if the scope is the whole infrastructure.

isInfrastructure

public boolean isInfrastructure()
Indicates whether the scope is the whole infrastructure.

Returns:
true if it is, false otherwise.

setEnclosingScope

protected void setEnclosingScope(GCUBEScope enclosingScope)
Used internally to set the enclosing scope of the scope.

Parameters:
enclosingScope - the enclosing scope.

getType

public GCUBEScope.Type getType()
Returns the type of the scope.

Returns:
the type.

toString

public String toString()
Returns the linear expression of the scope.

Overrides:
toString in class Object

equals

public boolean equals(Object object)

Overrides:
equals in class Object

isEnclosedIn

public boolean isEnclosedIn(GCUBEScope scope)

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getServiceMap

public abstract ServiceMap getServiceMap()
                                  throws GCUBEScopeNotSupportedException
Returns the map of service endpoints associated with the scope.

Returns:
the map
Throws:
GCUBEScopeNotSupportedException - if no service map is associated with the scope.

setServiceMap

public void setServiceMap(ServiceMap map)
Sets the map of service endpoint associated with the scope.

Parameters:
map - the service map.


Copyright © 2013. All Rights Reserved.