org.resoa.node.core
Class ResoaControllerGateway

java.lang.Object
  extended by org.resoa.node.core.ResoaBaseGateway
      extended by org.resoa.node.core.ResoaServiceGateway
          extended by org.resoa.node.core.ResoaControllerGateway
All Implemented Interfaces:
org.resoa.grid.ResoaGateway, org.resoa.grid.ResoaGateway.ControllerGateway, NodeDomainRelationManager.DomainCache<org.resoa.util.codedom.DomainDescriptor>, org.resoa.stack.Callbacks.SessionState, org.resoa.stack.StackChannelProcessor

public class ResoaControllerGateway
extends ResoaServiceGateway
implements NodeDomainRelationManager.DomainCache<org.resoa.util.codedom.DomainDescriptor>, org.resoa.grid.ResoaGateway.ControllerGateway

ResoaControllerGateway class for controller specific behavior. Some principles of controllers:


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.resoa.grid.ResoaGateway
org.resoa.grid.ResoaGateway.ControllerGateway, org.resoa.grid.ResoaGateway.GatewayRunner
 
Field Summary
 
Fields inherited from class org.resoa.node.core.ResoaServiceGateway
deployedServices, lockServices
 
Fields inherited from class org.resoa.node.core.ResoaBaseGateway
executionExceptions, gatewayRunner, initialControllers, localProfile, lockConnection, lockNodeState, lockResoaUpdate, logger, nodeDomains, nodeType, pendingMessages, permissionExceptions, properties, rcl, requestExceptions, running, security, sessionExceptions, stack
 
Fields inherited from interface org.resoa.grid.ResoaGateway
DOMAIN_PERSISTENCE, DOMAIN_TOPOLOGY, PROP_CONTROLLERDATAPATH, RESOAINFO_FILE, ResoaNodeTimeout, ROLE_CONTROLLER, ROLE_GRID, STACKCONFIG_FILE
 
Constructor Summary
ResoaControllerGateway()
          Default constructor
ResoaControllerGateway(java.lang.String configPath)
          Constructor initializes serviceDomainManager and serviceThreadPool and reads resoaInfo from configPath
 
Method Summary
 void awakeRestSession(org.resoa.topology.RestSession session, org.resoa.grid.GridSession requestor)
          Awake a RestSession within security to prevent timeout
protected  void beforeNodeStop(boolean waitForPoolThreadsEnd)
          Implement service stops
 void cacheRestSession(org.resoa.topology.RestSession session)
          Cache a RestSession within local security
 void connectToInitialController()
          We read ResoaInfo from local and perform the updateResoaInfo
 org.resoa.topology.RestSession createRestSession(java.util.List<org.resoa.topology.Permission> perm, java.lang.String userID, java.lang.String userAgent, int timeOut, org.resoa.grid.GridSession requestor)
          Creates a RESTSession handle
 java.lang.String getControllerStoragePath()
           
 java.util.List<org.resoa.grid.GridSession> getDomainSessions(java.lang.String domain)
           
protected  java.util.List<ResoaNodeHandle> getGridConnectionsNodes()
          Generate a list of nodes, we need to connect to
 org.resoa.grid.GridSession getNodeSession(java.lang.String profileName)
           
 org.resoa.grid.ResoaPersistence getPersistor()
          Returns reference to Resoa persistence
 org.resoa.topology.ResoaInfo getResoaInfo()
           
 org.resoa.topology.RestSession getRestSession(java.lang.String sessionID, boolean awake)
           
 boolean isDeployed(java.lang.String domain, java.lang.String serviceName)
           
 boolean isLeadingController()
          Returns true, if the controller is the leading one in the grid
protected  ResoaNodeHandle onSessionInitialized(org.resoa.grid.GridSession session)
          Gets invoked on session initialized.
 void onTransactionDelay(java.lang.Object channel, org.resoa.grid.Message msg)
           
 org.resoa.topology.ResoaComponent processLocalDeployment(org.resoa.topology.ResoaInfo resoaInfo, javolution.util.FastMap<java.lang.String,org.resoa.util.codedom.DomainDescriptor> descriptors, boolean isUpdate)
          Get the service deployment map. key is domain name
 void removeRestSession(java.lang.String restSessionID, org.resoa.grid.GridSession requestor)
           
 void sessionDisconnected(org.resoa.grid.GridSession session)
           
 void updateLocalResoaInfo(boolean refreshClassLoaderOnly)
          We update the ResoaInfo from local File Only leading Controller can perform this!
protected  void updateMonitoring(org.resoa.topology.NodeState state)
          Update monitoring data within locked state
 
Methods inherited from class org.resoa.node.core.ResoaServiceGateway
broadcastToControllers, broadcastToDomainNodes, createHotBackup, deployServiceDomain, executeService, executeService, getServiceImplementation, initializeServices, marshallRequest, onMessage, performControllerTransaction, performTransaction, processResoaResponse, readChannel, requestRestSessionFromController, sendMessage, unmarshallTransactionResult, writeChannel
 
Methods inherited from class org.resoa.node.core.ResoaBaseGateway
addMessageToPending, afterGridConnection, beforeGridConnection, connectToNode, getConfigurationPath, getConnectedProfiles, getControllerSession, getDomainNodes, getErrorCodeFromException, getLocalProfile, getLogger, getNodeHandle, getNodeState, getNodeType, getStack, getTransactionState, indicateTransactionError, isAccessPoint, isRunning, removeIdleSessions, sendPendingMessage, sessionInitialized, setConfigurationPath, setGatewayRunner, stop, updateResoaInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.resoa.grid.ResoaGateway
broadcastToControllers, broadcastToDomainNodes, executeService, executeService, getConfigurationPath, getLocalProfile, getLogger, getNodeState, getNodeType, getServiceImplementation, isRunning, performTransaction, removeIdleSessions, sendMessage, setGatewayRunner, stop, updateResoaInfo
 
Methods inherited from interface org.resoa.stack.Callbacks.SessionState
sessionInitialized
 

Constructor Detail

ResoaControllerGateway

public ResoaControllerGateway()
                       throws org.resoa.exception.ResoaException
Default constructor

Throws:
org.resoa.exception.ResoaException

ResoaControllerGateway

public ResoaControllerGateway(java.lang.String configPath)
                       throws org.resoa.exception.ResoaException
Constructor initializes serviceDomainManager and serviceThreadPool and reads resoaInfo from configPath

Parameters:
configPath - the config path
Throws:
org.resoa.exception.ResoaException
Method Detail

getResoaInfo

public org.resoa.topology.ResoaInfo getResoaInfo()
Returns:
the resoaInfo

isLeadingController

public boolean isLeadingController()
Returns true, if the controller is the leading one in the grid

Specified by:
isLeadingController in interface org.resoa.grid.ResoaGateway.ControllerGateway
Returns:
true, if the controller is the leading one in the grid

connectToInitialController

public void connectToInitialController()
                                throws org.resoa.exception.ResoaException
We read ResoaInfo from local and perform the updateResoaInfo

Specified by:
connectToInitialController in interface org.resoa.grid.ResoaGateway
Overrides:
connectToInitialController in class ResoaBaseGateway
Throws:
org.resoa.exception.ResoaException

processLocalDeployment

public org.resoa.topology.ResoaComponent processLocalDeployment(org.resoa.topology.ResoaInfo resoaInfo,
                                                                javolution.util.FastMap<java.lang.String,org.resoa.util.codedom.DomainDescriptor> descriptors,
                                                                boolean isUpdate)
Description copied from interface: NodeDomainRelationManager.DomainCache
Get the service deployment map. key is domain name

Specified by:
processLocalDeployment in interface NodeDomainRelationManager.DomainCache<org.resoa.util.codedom.DomainDescriptor>
descriptors - the cache for service descriptors
isUpdate - true, if the processing is caused by a runtime update
Returns:
the local resoa component instance

getNodeSession

public org.resoa.grid.GridSession getNodeSession(java.lang.String profileName)
Specified by:
getNodeSession in interface org.resoa.grid.ResoaGateway.ControllerGateway

getDomainSessions

public java.util.List<org.resoa.grid.GridSession> getDomainSessions(java.lang.String domain)
Specified by:
getDomainSessions in interface org.resoa.grid.ResoaGateway.ControllerGateway

getControllerStoragePath

public java.lang.String getControllerStoragePath()
Specified by:
getControllerStoragePath in interface org.resoa.grid.ResoaGateway.ControllerGateway

getGridConnectionsNodes

protected java.util.List<ResoaNodeHandle> getGridConnectionsNodes()
Description copied from class: ResoaBaseGateway
Generate a list of nodes, we need to connect to

Overrides:
getGridConnectionsNodes in class ResoaBaseGateway
Returns:
a list of nodes, we need to connect to

onSessionInitialized

protected ResoaNodeHandle onSessionInitialized(org.resoa.grid.GridSession session)
Description copied from class: ResoaBaseGateway
Gets invoked on session initialized. It validates the remote node profile.

Overrides:
onSessionInitialized in class ResoaBaseGateway
Parameters:
session - the session
Returns:
the ResoaNodeHandle if node is accepted, or null if the connection refused

sessionDisconnected

public void sessionDisconnected(org.resoa.grid.GridSession session)
Specified by:
sessionDisconnected in interface org.resoa.stack.Callbacks.SessionState
Overrides:
sessionDisconnected in class ResoaBaseGateway

onTransactionDelay

public void onTransactionDelay(java.lang.Object channel,
                               org.resoa.grid.Message msg)
Specified by:
onTransactionDelay in interface org.resoa.stack.StackChannelProcessor

getPersistor

public org.resoa.grid.ResoaPersistence getPersistor()
Returns reference to Resoa persistence

Specified by:
getPersistor in interface org.resoa.grid.ResoaGateway
Returns:
the persistence manager
See Also:
ResoaGateway.getPersistor()

isDeployed

public boolean isDeployed(java.lang.String domain,
                          java.lang.String serviceName)
Specified by:
isDeployed in interface org.resoa.grid.ResoaGateway

updateLocalResoaInfo

public void updateLocalResoaInfo(boolean refreshClassLoaderOnly)
We update the ResoaInfo from local File Only leading Controller can perform this!


createRestSession

public org.resoa.topology.RestSession createRestSession(java.util.List<org.resoa.topology.Permission> perm,
                                                        java.lang.String userID,
                                                        java.lang.String userAgent,
                                                        int timeOut,
                                                        org.resoa.grid.GridSession requestor)
Description copied from class: ResoaServiceGateway
Creates a RESTSession handle

Specified by:
createRestSession in interface org.resoa.grid.ResoaGateway
Overrides:
createRestSession in class ResoaServiceGateway
Parameters:
perm - provide the permissions, associated with this session
userID - the userID of the session
userAgent - the user agent
timeOut - the timeout
requestor - the base stack session
Returns:
the newly generated RestSession or null if failed

getRestSession

public org.resoa.topology.RestSession getRestSession(java.lang.String sessionID,
                                                     boolean awake)
Specified by:
getRestSession in interface org.resoa.grid.ResoaGateway
Overrides:
getRestSession in class ResoaServiceGateway

awakeRestSession

public void awakeRestSession(org.resoa.topology.RestSession session,
                             org.resoa.grid.GridSession requestor)
Awake a RestSession within security to prevent timeout

Parameters:
session -
requestor -

cacheRestSession

public void cacheRestSession(org.resoa.topology.RestSession session)
Cache a RestSession within local security

Parameters:
session - the session

removeRestSession

public void removeRestSession(java.lang.String restSessionID,
                              org.resoa.grid.GridSession requestor)
Specified by:
removeRestSession in interface org.resoa.grid.ResoaGateway
Overrides:
removeRestSession in class ResoaServiceGateway

beforeNodeStop

protected void beforeNodeStop(boolean waitForPoolThreadsEnd)
Description copied from class: ResoaBaseGateway
Implement service stops

Specified by:
beforeNodeStop in class ResoaBaseGateway

updateMonitoring

protected void updateMonitoring(org.resoa.topology.NodeState state)
Description copied from class: ResoaBaseGateway
Update monitoring data within locked state

Specified by:
updateMonitoring in class ResoaBaseGateway


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