org.resoa.node.core
Class RESTGateway

java.lang.Object
  extended by org.resoa.node.core.ResoaBaseGateway
      extended by org.resoa.node.core.ResoaServiceGateway
          extended by org.resoa.node.core.RESTGateway
All Implemented Interfaces:
org.resoa.grid.ResoaGateway, NodeDomainRelationManager.DomainCache<java.lang.String>, org.resoa.stack.Callbacks.SessionState, org.resoa.stack.StackChannelProcessor

public abstract class RESTGateway
extends ResoaServiceGateway
implements NodeDomainRelationManager.DomainCache<java.lang.String>

This is the gateway implementation, used by REST nodes. The full rest node logic is added inside the resoa.rest project. Domain cache is the list of service domains, all deployed web applications depend on


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
protected  javolution.util.FastMap<java.lang.String,org.resoa.stack.StackChannelProcessor> domainMessageProcessors
           
protected  org.resoa.topology.RESTNode localNode
           
 
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
protected RESTGateway()
          Constructor for Gateway without Resoa Grid Functionality
  RESTGateway(java.lang.String configPath)
          Constructor
 
Method Summary
protected  void clearApplications(boolean restartHTTP)
          WebDomian deployment event
 org.resoa.topology.RestSession createRestSession(java.util.List<org.resoa.topology.Permission> perm, java.lang.String userID, java.lang.String dns, int timeOut, org.resoa.grid.GridSession requestor)
          Creates a RESTSession handle
protected  org.resoa.topology.RESTNode getLocalNode(org.resoa.topology.ResoaInfo resoaInfo)
          Retrieve the local RESTNode handle out of ResoaInfo
 org.resoa.grid.ResoaPersistence getPersistor()
           
 boolean isDeployed(java.lang.String domain, java.lang.String serviceName)
           
 void onMessage(java.lang.Object stackChannel, org.resoa.grid.Message msg)
          Gets invoked on message arrival from stack.
protected  ResoaNodeHandle onSessionInitialized(org.resoa.grid.GridSession session)
          Gets invoked on session initialized.
 void onTransactionDelay(java.lang.Object channel, org.resoa.grid.Message msg)
           
protected  void onWebDomainDeployment(org.resoa.topology.WebDomainInfo domainInfo)
          WebDomian deployment event
 org.resoa.topology.ResoaComponent processLocalDeployment(org.resoa.topology.ResoaInfo resoaInfo, javolution.util.FastMap<java.lang.String,java.lang.String> descriptors, boolean isUpdate)
          Get the service deployment map. key is domain name
 void registerDomainMessageProcessor(java.lang.String domain, org.resoa.stack.StackChannelProcessor processor)
          Registers an StackMessageProcessor for a package.
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, getRestSession, getServiceImplementation, initializeServices, marshallRequest, performControllerTransaction, performTransaction, processResoaResponse, readChannel, removeRestSession, requestRestSessionFromController, sendMessage, unmarshallTransactionResult, writeChannel
 
Methods inherited from class org.resoa.node.core.ResoaBaseGateway
addMessageToPending, afterGridConnection, beforeGridConnection, beforeNodeStop, connectToInitialController, connectToNode, getConfigurationPath, getConnectedProfiles, getControllerSession, getDomainNodes, getErrorCodeFromException, getGridConnectionsNodes, getLocalProfile, getLogger, getNodeHandle, getNodeState, getNodeType, getStack, getTransactionState, indicateTransactionError, isAccessPoint, isRunning, removeIdleSessions, sendPendingMessage, sessionDisconnected, 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
connectToInitialController, getConfigurationPath, getLocalProfile, getLogger, getNodeState, getNodeType, isRunning, removeIdleSessions, setGatewayRunner, stop, updateResoaInfo
 
Methods inherited from interface org.resoa.stack.Callbacks.SessionState
sessionDisconnected, sessionInitialized
 

Field Detail

localNode

protected org.resoa.topology.RESTNode localNode

domainMessageProcessors

protected javolution.util.FastMap<java.lang.String,org.resoa.stack.StackChannelProcessor> domainMessageProcessors
Constructor Detail

RESTGateway

public RESTGateway(java.lang.String configPath)
            throws org.resoa.exception.ResoaException
Constructor

Parameters:
configPath -
Throws:
org.resoa.exception.ResoaException

RESTGateway

protected RESTGateway()
Constructor for Gateway without Resoa Grid Functionality

Method Detail

registerDomainMessageProcessor

public void registerDomainMessageProcessor(java.lang.String domain,
                                           org.resoa.stack.StackChannelProcessor processor)
Registers an StackMessageProcessor for a package. You might use this feature for managing delayed transactions or any other message broadcast to RestClients

Parameters:
domain - the domain of services, to listen for
processor - the processor instance

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

onMessage

public void onMessage(java.lang.Object stackChannel,
                      org.resoa.grid.Message msg)
Description copied from class: ResoaServiceGateway
Gets invoked on message arrival from stack. Passes messages to service executions

Specified by:
onMessage in interface org.resoa.stack.StackChannelProcessor
Overrides:
onMessage in class ResoaServiceGateway
Parameters:
stackChannel - the channel object
msg - message the message

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

processLocalDeployment

public org.resoa.topology.ResoaComponent processLocalDeployment(org.resoa.topology.ResoaInfo resoaInfo,
                                                                javolution.util.FastMap<java.lang.String,java.lang.String> 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<java.lang.String>
descriptors - the cache for service descriptors
isUpdate - true, if the processing is caused by a runtime update
Returns:
the local resoa component instance

clearApplications

protected void clearApplications(boolean restartHTTP)
WebDomian deployment event

Parameters:
restartHTTP - true, if the HTTP server should restart

onWebDomainDeployment

protected void onWebDomainDeployment(org.resoa.topology.WebDomainInfo domainInfo)
WebDomian deployment event

Parameters:
domainInfo -

getLocalNode

protected org.resoa.topology.RESTNode getLocalNode(org.resoa.topology.ResoaInfo resoaInfo)
Retrieve the local RESTNode handle out of ResoaInfo

Parameters:
resoaInfo -
Returns:
the local RESTNode handle

isDeployed

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

onTransactionDelay

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

createRestSession

public org.resoa.topology.RestSession createRestSession(java.util.List<org.resoa.topology.Permission> perm,
                                                        java.lang.String userID,
                                                        java.lang.String dns,
                                                        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
dns - the user agent
timeOut - the timeout
requestor - the base stack session
Returns:
the newly generated RestSession or null if failed

getPersistor

public org.resoa.grid.ResoaPersistence getPersistor()
Specified by:
getPersistor in interface org.resoa.grid.ResoaGateway


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