org.resoa.node.core
Class NodeDomainRelationManager<T>

java.lang.Object
  extended by org.resoa.node.core.NodeDomainRelationManager<T>
Type Parameters:
T - The type of managed domain

public class NodeDomainRelationManager<T>
extends java.lang.Object

NodeDomainRelationManager class manages the n:m relation of Resoa nodes and service Domains, deployed in the grid. One domain can be hosted by several nodes, and a node might act as a container for several domains. NodeDomainRelation Manager is the class for managing this relation, it takes the relevant information out of the ResoaInfo.xml and identifies the nodes, it must hold connections to.


Nested Class Summary
static interface NodeDomainRelationManager.DomainCache<T>
          The interface, the class which caches the domain handles must implement
 
Field Summary
protected  java.util.concurrent.locks.ReentrantLock lock
           
protected  javolution.util.FastMap<java.lang.String,ResoaNodeHandle> nodeHandles
          Cache for all grid nodes, which connections might be established to.
 
Constructor Summary
NodeDomainRelationManager()
          Constructor initializes internal objects and maps
 
Method Summary
 void disconnectInactiveNodes()
          Disconnect inactive nodes
 java.util.List<java.lang.String> getConnectedProfiles()
          Returns a List of connected profiles
 java.util.List<ResoaNodeHandle> getControllerNodes(java.util.List<ResoaNodeHandle> connections, boolean initializedOnly)
          Returns list of all controller nodes
 java.util.List<org.resoa.stack.config.StackProfile> getGrantedProfiles()
           
 java.util.List<ResoaNodeHandle> getGridConnectionList(java.util.List<ResoaNodeHandle> connections)
          Returns a list of all node handles, where connections should be established
 org.resoa.topology.ResoaComponent getLocalResoaComponent()
           
 ResoaNodeHandle getNodeHandle(java.lang.String profileName)
          Get a ResoeNodeHandle
 java.util.List<ResoaNodeHandle> getNodeHandles(org.resoa.grid.ResoaNodeType type)
          Get all registered ResoeNodeHandle
 org.resoa.topology.ResoaInfo getResoaInfo()
          resoaInfo getter
 org.resoa.grid.GridSession getResoaSession(java.lang.String domain)
          Returns an active Resoa session for a dedicated domain.
 java.util.List<ResoaNodeHandle> getResoaSessions(java.lang.String domain)
          Returns list of all nodes which serve for a domainID
 void init(NodeDomainRelationManager.DomainCache<?> domains, java.util.List<org.resoa.stack.config.StackProfile> initialControllers)
          Initializes with gateway and domain cache instance
 org.resoa.grid.ResoaInfoState newResoaInfo(org.resoa.topology.ResoaInfo newResoaInfo)
          Processes a new arrived resoaInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected java.util.concurrent.locks.ReentrantLock lock

nodeHandles

protected javolution.util.FastMap<java.lang.String,ResoaNodeHandle> nodeHandles
Cache for all grid nodes, which connections might be established to. Key is profile name

Constructor Detail

NodeDomainRelationManager

public NodeDomainRelationManager()
Constructor initializes internal objects and maps

Method Detail

init

public void init(NodeDomainRelationManager.DomainCache<?> domains,
                 java.util.List<org.resoa.stack.config.StackProfile> initialControllers)
Initializes with gateway and domain cache instance

Parameters:
domains -
initialControllers -

getLocalResoaComponent

public org.resoa.topology.ResoaComponent getLocalResoaComponent()
Returns:
the localComponent

getNodeHandle

public ResoaNodeHandle getNodeHandle(java.lang.String profileName)
Get a ResoeNodeHandle

Parameters:
profileName -
Returns:
the node handle or null

getNodeHandles

public java.util.List<ResoaNodeHandle> getNodeHandles(org.resoa.grid.ResoaNodeType type)
Get all registered ResoeNodeHandle

Returns:
a list of node handles

getResoaSessions

public java.util.List<ResoaNodeHandle> getResoaSessions(java.lang.String domain)
Returns list of all nodes which serve for a domainID

Parameters:
domain - the id if the domain
Returns:
a List of active node handles, serving the domain

getConnectedProfiles

public java.util.List<java.lang.String> getConnectedProfiles()
Returns a List of connected profiles

Returns:
a List of connected profiles

getControllerNodes

public java.util.List<ResoaNodeHandle> getControllerNodes(java.util.List<ResoaNodeHandle> connections,
                                                          boolean initializedOnly)
Returns list of all controller nodes

Parameters:
connections - an existing list or null
Returns:
list of all controller nodes handles

getGridConnectionList

public java.util.List<ResoaNodeHandle> getGridConnectionList(java.util.List<ResoaNodeHandle> connections)
Returns a list of all node handles, where connections should be established

Parameters:
connections - an existing list or null
Returns:
the list of node handles, where connections should be established

getResoaSession

public org.resoa.grid.GridSession getResoaSession(java.lang.String domain)
Returns an active Resoa session for a dedicated domain. Randomly chooses one from available list

Parameters:
domain - the domain
Returns:
an active stack session of a node, serving the domain

getGrantedProfiles

public java.util.List<org.resoa.stack.config.StackProfile> getGrantedProfiles()
Returns:
the list with granted stack profiles

disconnectInactiveNodes

public void disconnectInactiveNodes()
Disconnect inactive nodes


getResoaInfo

public org.resoa.topology.ResoaInfo getResoaInfo()
resoaInfo getter

Returns:
the resoaInfo

newResoaInfo

public org.resoa.grid.ResoaInfoState newResoaInfo(org.resoa.topology.ResoaInfo newResoaInfo)
Processes a new arrived resoaInfo. Updates the granted node list and the deployment information of the node.

Parameters:
newResoaInfo - the new ResoaInfo
Returns:
A list of identified nodes, a connection must be hold to


Read more about license conditions at www.resoa.org.