org.almendra.janet.cas.node
Class Capability

java.lang.Object
  extended by org.almendra.janet.cas.node.Capability
All Implemented Interfaces:
INamedObject, ILoggable

public class Capability
extends java.lang.Object
implements INamedObject, ILoggable

Author:
Oliver Plohmann

Field Summary
protected  java.util.List agentDescriptors
           
protected  java.util.List agentsSharingScheduler
           
protected  AbstractApplication application
           
protected  java.lang.String descriptorFilePathName
           
protected  java.lang.String executeWhenAppStarted
           
protected  java.util.Map interpreters
           
protected  java.lang.String name
           
protected  int numberOfSchedulers
           
protected  java.util.List registeredAgentNames
           
 
Constructor Summary
Capability(AbstractApplication application, java.lang.String capabilityName)
           
Capability(AbstractApplication application, java.lang.String capabilityName, java.lang.String agentName)
           
Capability(AbstractApplication application, java.lang.String capabilityName, java.lang.String[] agentNames)
           
 
Method Summary
 void add(IInterpreter interpreter)
           
protected  void addAgentNames(java.util.List list)
           
 void addInterpreters(java.util.List interpreters)
           
protected  void checkApplication(AbstractApplication application)
           
protected  void checkCapability(java.lang.String capabilityName)
           
protected  void checkInterpreter(IInterpreter interpreter)
           
 boolean checkValidity()
           
protected  AgentPath createAgent(java.lang.String agentName, ApplicationScheduler scheduler)
           
protected  ApplicationScheduler createApplicationScheduler()
           
protected  SystemScheduler createSubordinateSystemScheduler()
           
 void deregisterAgent(java.lang.String agentName)
           
 java.util.List getAgentDescriptors()
           
 StringVector getAgentNames()
           
 java.lang.String getAgentNamesString()
           
 AgentPath getAgentPath(java.lang.String agentName)
           
protected  AgentPath getAgentPathToNewAgent(java.lang.String agentName)
           
 java.util.List getAgentsSharingSchedulerWith(java.lang.String agentName)
          Answer the names of agents that use the same schedulerAnchor as agentName.
 AbstractApplication getApplication()
           
 java.lang.String getDescriptorFilePathName()
           
 java.lang.String getExecuteWhenAppStarted()
           
 IInterpreter getInterpreter(java.lang.String qualifiedCommandName)
           
 java.util.List getInterpreters()
           
 java.lang.String getName()
          All objects that have a user-defined name must implement this method.
 Node getNode()
           
 int getNumberOfSchedulers()
           
 java.lang.String getQualifiedName()
           
 java.util.List getRegisteredAgentNames()
           
 boolean hasAgent(java.lang.String agentName)
           
 boolean hasInterpreters()
           
protected  boolean isSchedulerShared(java.lang.String agentName)
           
 AgentPath registerAgent(java.lang.String agentName)
           
 AgentPath registerAgent(java.lang.String agentName, boolean autoincrement)
           
 java.util.List registeredLogEvents()
          Return list of events that may occur for an object.
 void setAgentDescriptors(java.util.List agentDescriptors)
           
 void setDescriptorFilePathName(java.lang.String descriptorFilePathName)
           
 void setExecuteWhenAppStarted(java.lang.String executeWhenAppStarted)
           
 void setSharedSchedulers(java.util.List sharedSchedulers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interpreters

protected java.util.Map interpreters

application

protected AbstractApplication application

name

protected java.lang.String name

descriptorFilePathName

protected java.lang.String descriptorFilePathName

agentDescriptors

protected java.util.List agentDescriptors

agentsSharingScheduler

protected java.util.List agentsSharingScheduler

numberOfSchedulers

protected int numberOfSchedulers

executeWhenAppStarted

protected java.lang.String executeWhenAppStarted

registeredAgentNames

protected java.util.List registeredAgentNames
Constructor Detail

Capability

public Capability(AbstractApplication application,
                  java.lang.String capabilityName)
           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Capability

public Capability(AbstractApplication application,
                  java.lang.String capabilityName,
                  java.lang.String[] agentNames)
           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Capability

public Capability(AbstractApplication application,
                  java.lang.String capabilityName,
                  java.lang.String agentName)
           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

checkApplication

protected void checkApplication(AbstractApplication application)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

checkCapability

protected void checkCapability(java.lang.String capabilityName)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

checkInterpreter

protected void checkInterpreter(IInterpreter interpreter)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

checkValidity

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

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

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:

add

public void add(IInterpreter interpreter)
         throws java.lang.IllegalArgumentException,
                DescriptorParseException
Throws:
java.lang.IllegalArgumentException
DescriptorParseException

hasInterpreters

public boolean hasInterpreters()

getInterpreter

public IInterpreter getInterpreter(java.lang.String qualifiedCommandName)
Returns:

getInterpreters

public java.util.List getInterpreters()

getNode

public Node getNode()

setSharedSchedulers

public void setSharedSchedulers(java.util.List sharedSchedulers)
                         throws java.lang.IllegalArgumentException
Parameters:
list -
Throws:
java.lang.IllegalArgumentException

getAgentsSharingSchedulerWith

public java.util.List getAgentsSharingSchedulerWith(java.lang.String agentName)
Answer the names of agents that use the same schedulerAnchor as agentName. Return an ampty list if none.

Parameters:
agentName -
Returns:

getQualifiedName

public java.lang.String getQualifiedName()
Returns:

getNumberOfSchedulers

public int getNumberOfSchedulers()
Returns:

isSchedulerShared

protected boolean isSchedulerShared(java.lang.String agentName)
Parameters:
agentName -
Returns:

getApplication

public AbstractApplication getApplication()
Returns:
Returns the application.

getAgentNames

public StringVector getAgentNames()
Returns:
Returns the agentNames.

addInterpreters

public void addInterpreters(java.util.List interpreters)
                     throws java.lang.IllegalArgumentException,
                            DescriptorParseException
Parameters:
list -
Throws:
java.lang.IllegalArgumentException
DescriptorParseException

getExecuteWhenAppStarted

public java.lang.String getExecuteWhenAppStarted()
Returns:
Returns the executeWhenAppStarted.

setExecuteWhenAppStarted

public void setExecuteWhenAppStarted(java.lang.String executeWhenAppStarted)
Parameters:
executeWhenAppStarted - The executeWhenAppStarted to set.

addAgentNames

protected void addAgentNames(java.util.List list)
Parameters:
list -

getAgentDescriptors

public java.util.List getAgentDescriptors()
Returns:
Returns the agentDescriptors.

setAgentDescriptors

public void setAgentDescriptors(java.util.List agentDescriptors)
Parameters:
agentDescriptors - The agentDescriptors to set.

getAgentPath

public AgentPath getAgentPath(java.lang.String agentName)
                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getAgentNamesString

public java.lang.String getAgentNamesString()
Returns:

registerAgent

public AgentPath registerAgent(java.lang.String agentName)
                        throws AlreadyRegisteredException,
                               java.rmi.RemoteException
Throws:
AlreadyRegisteredException
java.rmi.RemoteException

registerAgent

public AgentPath registerAgent(java.lang.String agentName,
                               boolean autoincrement)
                        throws AlreadyRegisteredException,
                               java.rmi.RemoteException
Parameters:
agentName -
autoincrement - If an agent with the name agentName already exists, return agentName with an appended incremented counter
Returns:
Throws:
AlreadyRegisteredException
java.rmi.RemoteException

getAgentPathToNewAgent

protected AgentPath getAgentPathToNewAgent(java.lang.String agentName)
Parameters:
agentName -
Returns:

deregisterAgent

public void deregisterAgent(java.lang.String agentName)

createSubordinateSystemScheduler

protected SystemScheduler createSubordinateSystemScheduler()

createApplicationScheduler

protected ApplicationScheduler createApplicationScheduler()

createAgent

protected AgentPath createAgent(java.lang.String agentName,
                                ApplicationScheduler scheduler)

hasAgent

public boolean hasAgent(java.lang.String agentName)

getRegisteredAgentNames

public java.util.List getRegisteredAgentNames()
Returns:
Returns the registeredAgentNames.

getDescriptorFilePathName

public java.lang.String getDescriptorFilePathName()
Returns:
Returns the descriptorFilePathName.

setDescriptorFilePathName

public void setDescriptorFilePathName(java.lang.String descriptorFilePathName)
Parameters:
descriptorFilePathName - The descriptorFilePathName to set.