org.almendra.janet.cas.node
Class AbstractApplication

java.lang.Object
  extended by org.almendra.janet.cas.node.AbstractApplication
All Implemented Interfaces:
INamedObject, ILoggable, IObjectSpaceProvider
Direct Known Subclasses:
Application, SystemApplication

public abstract class AbstractApplication
extends java.lang.Object
implements INamedObject, ILoggable, IObjectSpaceProvider


Field Summary
protected  OrderedMap capabilities
           
protected  IEventRegistry eventRegistry
           
protected  java.util.List exportedEvents
           
static java.lang.String LOG_EVENT_REGISTERED_AGENT
           
protected  Logger logger
           
protected  java.lang.String name
           
protected  Node node
           
protected  int numOfSchedulers
           
protected  IObjectSpace objectSpace
           
protected  boolean started
           
 
Constructor Summary
AbstractApplication()
          Creates a new AbstractApplication object.
AbstractApplication(Logger logger, Node node, java.lang.String name)
           
AbstractApplication(java.lang.String name)
           
 
Method Summary
 void addCapabilities(java.util.List newCapabilities)
           
 void addCapability(Capability capability)
           
 void addExportedEventDescriptors(java.util.List eventDescriptors)
           
 boolean checkValidity()
           
 ApplicationAccessor getAccessor()
           
 IAgentProxy getAgent(AgentPath path)
           
protected  IAgentProxy getAgent(AgentPath path, boolean restrictedAccess)
           
 int getAgentCount(java.lang.String nodeName, java.lang.String capabilityPath)
           
 IAgentDispatcher getAgentDispatcher(AgentPath agentPath)
           
 IAgentDispatcher getAgentDispatcher(AgentPath agentPath, boolean restrictedAccess)
           
 java.util.List getAgentPaths(java.lang.String capabilityName)
           
 java.util.List getAgentPaths(java.lang.String capabilityName, java.lang.String agentName)
           
 java.util.List getAllAgentPaths()
           
 java.util.List getAllAgentPaths(CapabilityPath path)
           
 java.util.List getAllAgentPaths(LocalAgentPath localPath)
           
 IAgentProxy getAllAgents(LocalAgentPath localPath)
           
 IAgentProxy getAllAgentsWithCapability(java.lang.String capabilityName, java.lang.String agentName)
           
 java.util.List getAllCrossAgentPaths(LocalAgentPath localPath)
           
 IAgentProxy getAllCrossAgents(java.util.List agentPaths)
           
 java.util.List getAllCrossAgents(LocalAgentPath localPath)
           
 java.util.List getAllForeignAgentPaths(LocalAgentPath localPath)
           
 IAgentProxy getAllForeignAgents(LocalAgentPath localPath)
           
 java.util.List getAllForeignNodeNames()
           
 java.util.List getAllForeignNodeNamesWithCentral()
           
protected  java.util.List getAllLocalAgentNames()
           
 java.util.List getAllNodeNames()
           
 java.util.List getAllNodeNamesWithCapability(LocalCapabilityPath path, java.util.List nodeNamesToConsider)
           
protected  java.util.List getAllQualifiedAgentNames()
           
 java.util.Set getCapabilities()
           
 Capability getCapability(java.lang.String capabilityName)
           
 AgentProxy getCrossAgent(AgentPath path)
           
 ILocalEventRegistry getEventRegistry()
           
 java.util.List getExportedEvents()
           
 java.util.List getForeignNodeNames()
           
 IAgentProxy getLocalAgent(java.lang.String capabilityName, java.lang.String agentName)
           
 AgentPath getLocalAgentPath(java.lang.String capabilityName, java.lang.String agentName)
           
 Logger getLogger()
           
 java.util.List getMonitorMask()
           
 java.util.Map getMonitorMaskDefaultValues()
           
 java.lang.String getName()
          All objects that have a user-defined name must implement this method.
protected  java.lang.String getNameDescriptor()
           
 Node getNode()
           
protected  ILocalEventRegistry getNodeEventRegistryEnvelope()
           
protected  java.lang.String getNodeLabel()
           
 java.lang.String getNodeName()
           
 java.util.List getNodeNames()
          Return a list with all the nodes that have an application with the same name registered including the owner node of this application.
 IObjectSpace getNodeObjectSpace()
           
 int getNumberOfSchedulers()
           
 IObjectSpace getObjectSpace()
           
protected  AgentPath getSystemAgentPath(java.lang.String nodeName)
          Answer the path to the system agent of node .
 boolean hasAgent(AgentPath ackAgentPath)
           
 boolean hasAgent(java.lang.String capabilityName, java.lang.String agentName)
           
 boolean hasCapabilities(java.util.Set capabilities)
           
 boolean hasCapability(Capability capability)
           
 boolean hasCapability(java.lang.String nodeName, java.lang.String applicationName, java.lang.String capabilityName)
           
 boolean hasForeignAgents(LocalAgentPath localPath)
           
protected  boolean isStarted()
           
 boolean isSystemApplication()
           
protected  void primRegisterEvents()
           
protected  void primStart()
           
protected  void primStartInitialCommands()
           
protected  void primStop()
           
 java.util.List registeredLogEvents()
          Return list of events that may occur for an object.
 void setAndInitLogger(Logger parentLogger)
           
 void setName(java.lang.String string)
           
 void setNode(Node node)
           
protected  void setStarted(boolean started)
           
 boolean start()
          Start all the agents of the capability if not already started.
 boolean stop()
          Stop all the agents of the capability if started.
 java.util.List toForeignDescriptor()
           
 TreeNode toTreeDescriptor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_EVENT_REGISTERED_AGENT

public static final java.lang.String LOG_EVENT_REGISTERED_AGENT
See Also:
Constant Field Values

capabilities

protected OrderedMap capabilities

objectSpace

protected IObjectSpace objectSpace

eventRegistry

protected IEventRegistry eventRegistry

exportedEvents

protected java.util.List exportedEvents

logger

protected Logger logger

name

protected java.lang.String name

node

protected Node node

started

protected boolean started

numOfSchedulers

protected int numOfSchedulers
Constructor Detail

AbstractApplication

public AbstractApplication()
Creates a new AbstractApplication object.


AbstractApplication

public AbstractApplication(Logger logger,
                           Node node,
                           java.lang.String name)

AbstractApplication

public AbstractApplication(java.lang.String name)
Method Detail

addCapabilities

public void addCapabilities(java.util.List newCapabilities)

addCapability

public void addCapability(Capability capability)
Parameters:
capability -

addExportedEventDescriptors

public void addExportedEventDescriptors(java.util.List eventDescriptors)
Parameters:
list -

checkValidity

public boolean checkValidity()
                      throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getCapabilities

public java.util.Set getCapabilities()
Returns:

getEventRegistry

public ILocalEventRegistry getEventRegistry()

getExportedEvents

public java.util.List getExportedEvents()
Returns:
Returns the exportedEvents.

hasCapability

public boolean hasCapability(Capability capability)
Parameters:
capability -
Returns:

hasCapability

public boolean hasCapability(java.lang.String nodeName,
                             java.lang.String applicationName,
                             java.lang.String capabilityName)
Parameters:
capability -
Returns:

getAgentDispatcher

public IAgentDispatcher getAgentDispatcher(AgentPath agentPath)
                                    throws NoSuchAgentException,
                                           IllegalAgentAccessException
Parameters:
agentPath -
Returns:
Throws:
NoSuchAgentException
IllegalAgentAccessException

getAgentDispatcher

public IAgentDispatcher getAgentDispatcher(AgentPath agentPath,
                                           boolean restrictedAccess)
                                    throws NoSuchAgentException,
                                           IllegalAgentAccessException
Parameters:
agentPath -
Returns:
Throws:
NoSuchAgentException
IllegalAgentAccessException

hasCapabilities

public boolean hasCapabilities(java.util.Set capabilities)
Parameters:
capabilities -
Returns:

isStarted

protected boolean isStarted()
Returns:

primRegisterEvents

protected void primRegisterEvents()

getNodeEventRegistryEnvelope

protected ILocalEventRegistry getNodeEventRegistryEnvelope()
Returns:

primStart

protected void primStart()

primStop

protected void primStop()

registeredLogEvents

public java.util.List registeredLogEvents()
Description copied from interface: ILoggable
Return list of events that may occur for an object.

Specified by:
registeredLogEvents in interface ILoggable
Returns:

setAndInitLogger

public void setAndInitLogger(Logger parentLogger)

setName

public void setName(java.lang.String string)
Parameters:
string -

setNode

public void setNode(Node node)
Parameters:
node - The node to set.

setStarted

protected void setStarted(boolean started)
Parameters:
b -

start

public boolean start()
Start all the agents of the capability if not already started.

Returns:

stop

public boolean stop()
Stop all the agents of the capability if started.

Returns:

getAllNodeNames

public java.util.List getAllNodeNames()
Returns:

getAllQualifiedAgentNames

protected java.util.List getAllQualifiedAgentNames()

getAllForeignNodeNames

public java.util.List getAllForeignNodeNames()
Returns:

getAllForeignNodeNamesWithCentral

public java.util.List getAllForeignNodeNamesWithCentral()
Returns:

getAllLocalAgentNames

protected java.util.List getAllLocalAgentNames()

getAgentPaths

public java.util.List getAgentPaths(java.lang.String capabilityName,
                                    java.lang.String agentName)

getAllAgentPaths

public java.util.List getAllAgentPaths(CapabilityPath path)

getAgentCount

public int getAgentCount(java.lang.String nodeName,
                         java.lang.String capabilityPath)

getAgentPaths

public java.util.List getAgentPaths(java.lang.String capabilityName)

getAllAgentsWithCapability

public IAgentProxy getAllAgentsWithCapability(java.lang.String capabilityName,
                                              java.lang.String agentName)

getCapability

public Capability getCapability(java.lang.String capabilityName)

getObjectSpace

public IObjectSpace getObjectSpace()
Specified by:
getObjectSpace in interface IObjectSpaceProvider
Returns:
Returns the objectSpace.

getNodeObjectSpace

public IObjectSpace getNodeObjectSpace()
Returns:
Returns the objectSpace.

getLogger

public Logger getLogger()
Returns:
Returns the logger.

getName

public java.lang.String getName()
Description copied from interface: INamedObject
All objects that have a user-defined name must implement this method.

Specified by:
getName in interface INamedObject
Returns:
name

getNode

public Node getNode()
Returns:
Returns the node.

getSystemAgentPath

protected AgentPath getSystemAgentPath(java.lang.String nodeName)
Answer the path to the system agent of node .

Parameters:
nodeName -
Returns:

getAllAgentPaths

public java.util.List getAllAgentPaths()

getNameDescriptor

protected java.lang.String getNameDescriptor()

getLocalAgentPath

public AgentPath getLocalAgentPath(java.lang.String capabilityName,
                                   java.lang.String agentName)
                            throws NoSuchAgentException
Throws:
NoSuchAgentException

hasAgent

public boolean hasAgent(java.lang.String capabilityName,
                        java.lang.String agentName)
Parameters:
capabilityName -
agentName -
Returns:

getLocalAgent

public IAgentProxy getLocalAgent(java.lang.String capabilityName,
                                 java.lang.String agentName)
                          throws java.lang.IllegalArgumentException,
                                 NoSuchAgentException,
                                 IllegalAgentAccessException
Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException

getAgent

public IAgentProxy getAgent(AgentPath path)
                     throws NoSuchAgentException,
                            IllegalAgentAccessException
Throws:
NoSuchAgentException
IllegalAgentAccessException

getAgent

protected IAgentProxy getAgent(AgentPath path,
                               boolean restrictedAccess)
                        throws NoSuchAgentException,
                               IllegalAgentAccessException
Throws:
NoSuchAgentException
IllegalAgentAccessException

getCrossAgent

public AgentProxy getCrossAgent(AgentPath path)
                         throws NoSuchAgentException,
                                IllegalAgentAccessException,
                                InsufficientPrivilegeException
Throws:
NoSuchAgentException
IllegalAgentAccessException
InsufficientPrivilegeException

getForeignNodeNames

public java.util.List getForeignNodeNames()
Returns:

getNodeNames

public java.util.List getNodeNames()
Return a list with all the nodes that have an application with the same name registered including the owner node of this application.

Returns:

getAllCrossAgentPaths

public java.util.List getAllCrossAgentPaths(LocalAgentPath localPath)
Parameters:
path -
Returns:

getAllCrossAgents

public IAgentProxy getAllCrossAgents(java.util.List agentPaths)
                              throws NoSuchAgentException,
                                     IllegalAgentAccessException,
                                     InsufficientPrivilegeException
Throws:
NoSuchAgentException
IllegalAgentAccessException
InsufficientPrivilegeException

getAllCrossAgents

public java.util.List getAllCrossAgents(LocalAgentPath localPath)
Parameters:
path -
Returns:

getAllAgentPaths

public java.util.List getAllAgentPaths(LocalAgentPath localPath)

getAllAgents

public IAgentProxy getAllAgents(LocalAgentPath localPath)
Parameters:
path -
Returns:

getAllForeignAgents

public IAgentProxy getAllForeignAgents(LocalAgentPath localPath)
                                throws java.lang.IllegalArgumentException,
                                       NoSuchAgentException,
                                       IllegalAgentAccessException
Parameters:
string -
string2 -
Returns:
Throws:
java.lang.IllegalArgumentException
NoSuchAgentException
IllegalAgentAccessException

hasForeignAgents

public boolean hasForeignAgents(LocalAgentPath localPath)

getAllForeignAgentPaths

public java.util.List getAllForeignAgentPaths(LocalAgentPath localPath)
                                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

hasAgent

public boolean hasAgent(AgentPath ackAgentPath)
Parameters:
ackAgentPath -
Returns:

isSystemApplication

public boolean isSystemApplication()
Returns:

getNodeName

public java.lang.String getNodeName()

getAccessor

public ApplicationAccessor getAccessor()

getNodeLabel

protected java.lang.String getNodeLabel()

primStartInitialCommands

protected void primStartInitialCommands()

toForeignDescriptor

public java.util.List toForeignDescriptor()
Returns:

toTreeDescriptor

public TreeNode toTreeDescriptor()

getMonitorMaskDefaultValues

public java.util.Map getMonitorMaskDefaultValues()

getMonitorMask

public java.util.List getMonitorMask()

getNumberOfSchedulers

public int getNumberOfSchedulers()
Returns:

getAllNodeNamesWithCapability

public java.util.List getAllNodeNamesWithCapability(LocalCapabilityPath path,
                                                    java.util.List nodeNamesToConsider)
Parameters:
path -
Returns: