gov.nasa.arc.brahms.vm.data
Class VMAgent

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.BrahmsObject
      extended by gov.nasa.arc.brahms.common.data.ModelElement
          extended by gov.nasa.arc.brahms.common.data.NamedModelElement
              extended by gov.nasa.arc.brahms.common.data.Concept
                  extended by gov.nasa.arc.brahms.common.data.ActiveConcept
                      extended by gov.nasa.arc.brahms.common.data.ActiveInstance
                          extended by gov.nasa.arc.brahms.common.data.Agent
                              extended by gov.nasa.arc.brahms.vm.data.VMAgent
All Implemented Interfaces:
IConceptInstance, Type, gov.nasa.arc.brahms.common.IConstants, gov.nasa.arc.brahms.vm.ci.ICIActor, IVMInstance, java.io.Serializable

public class VMAgent
extends Agent
implements IVMInstance, gov.nasa.arc.brahms.vm.ci.ICIActor

The VMAgent is an Agent with extensions for use in the Brahms virtual machine. An agent in Brahms is the most central construct in a Brahms model. An agent represents an interactive system, a subject with behavior interacting with the world. An agent can for example represent a person in an organization, but could also represent an animal in a forest. A Brahms model is always about the activities of agents in a work process.

Version:
$Revision: 1.4 $ $Date: 2009/11/23 22:12:30 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
Agent, Serialized Form

Field Summary
static long EXCEPTION_TIMEOUT
          Constant specifying the recommended default time-out after an exception
static int NUM_RETRIES
          Constant specifying the recommended default number of retries
 
Fields inherited from class gov.nasa.arc.brahms.common.data.Concept
ATTRIBUTES_PROPERTY, RELATIONS_PROPERTY
 
Fields inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
NAME_PROPERTY
 
Fields inherited from interface gov.nasa.arc.brahms.common.IConstants
ABORT, ACTIVECLASS, ACTIVECONCEPT, ACTIVEINSTANCE, AGENT, ANONYMOUS, ANYAGENT, AREA, AREADEF, ASSIGNED, ATTRIBUTE, BASEAREADEF, BASECLASS, BASECONCEPTUALCLASS, BASEGROUP, BASELIBRARY, BOOLEAN, BROADCAST, BUILDING, BYTE, CCLOCK, CDATE, CHAR, CITY, CLASS, CLOCK, COLLECTALL, COMMUNICATE, COMPLETE, COMPOSITE, COMPUTER, CONCEPT, CONCEPTUALCLASS, CONCEPTUALCONCEPT, CONCEPTUALOBJECT, CONTINUE, COPY, CREATEAGENT, CREATEAREA, CREATEOBJECT, current, CURRENT, DATAFRAME, DATE, DB, DETECTABLE, DIV, DOUBLE, EMAIL, EMPTY_STRING, END, ENDACTIVITY, ENTAGENT, EQ, EXCEPTION, EXPR, FACE2FACE, FACTFRAME, FALSE, FAX, FLOAT, FOREACH, FORONE, G2, GE, GEOGRAPHYCONCEPT, GESTURE, GET, GROUP, GT, IMPASSE, INT, INVALID, JAVA, JAVA_TYPE, KNOWN_MODIFIER, KNOWNVAL_MODIFIER, LE, LOCAL, LONG, LT, MAP, MINUS, MOD, MOVE, MULT, NE, NEW, NONE, NOT_MODIFIER, NOWORK, O, OA, OBJECT, ONTOLOGY, PAGER, PARAMETER, PATH, PHONE, PLUS, PRIMITIVE, PRIVATE, PROAGENT, PROTECTED, PRSAGENT, PUBLIC, PUT, RECEIVE, RELATION, sACTIVECLASS, sACTIVECONCEPT, sACTIVEINSTANCE, sAGENT, sARCHIVE, sAREA, sAREADEF, sBOOLEAN, sBYTE, sBYTECODEEXT, sCHAR, sCLASS, sCOMPUTER, sCONCEPT, sCONCEPTUALCLASS, sCONCEPTUALCONCEPT, sCONCEPTUALOBJECT, sCOPY, sCURRENT, sDETECTABLE, sDOUBLE, sEMAIL, sEND, SEND, sFACE2FACE, sFAX, sFILEEXT, sFLOAT, sGEOGRAPHYCONCEPT, sGROUP, SHORT, SIMAGENT, sINT, sJAVA_TYPE, sLONG, sMAP, sNEW, sNONE, sNOWORK, sOBJECT, SOURCECODE, sPAGER, sPARAMETER, sPATH, sPHONE, sPRIVATE, sPROJECTEXT, sPROTECTED, sPUBLIC, sSHORT, sSTART, sSTRING, sSYMBOL, START, STRING, sUNKNOWN, sVOID, SYMBOL, TRUE, UDT, UML, UNASSIGNED, UNDEFINED, unknown, UNKNOWN, UNKNOWN_MODIFIER, V, VARIABLE, VOID, WHENEVER, WORKFRAME, WORLD, XML
 
Constructor Summary
VMAgent()
          Constructor, creates a new agent for use in the virtual machine.
VMAgent(java.lang.String name)
          Constructor, creates a new agent with the specified name for use in the virtual machine.
VMAgent(java.lang.String file, int line)
          Constructor, creates a new agent for use in the virtual machine and for which its specification is stored in the specified file at the specified line number.
VMAgent(java.lang.String name, java.lang.String file, int line)
          Constructor, creates a new agent with the specified name for use in the virtual machine and for which its specification is stored in the specified file at the specified line number.
 
Method Summary
 void addJunkFilter(java.lang.String conversationID)
          Adds the specified conversation identifier to the junk filter to ensure that any incoming messages with that conversation identifier are ignored.
 IConceptCtx createContext()
          Creates a new context for this concept for use in a virtual machine.
 void deregister()
          Unregisters the agent from the CI.
 boolean equals(java.lang.Object obj)
          Tests whether two VMAgents are equal.
 gov.nasa.arc.brahms.vm.ci.BrahmsCIActor getActor()
          Returns this agent's Collaborative Infrastructure actor.
 gov.nasa.ci.corba.api.directory.Advertisement getAdvertisement()
          Returns the agent's advertisement.
 gov.nasa.ci.corba.api.Credentials getCredentials()
          Returns the agent's credentials.
 gov.nasa.ci.corba.api.data.IDataDistributionService getDataDistributionService()
          Returns a reference to the data distribution service used to publish data and used to subscribe for data.
 gov.nasa.ci.api.actor.IActorDescriptor getDescriptor()
          Returns the actor's descriptor.
 gov.nasa.ci.corba.api.directory.IDirectoryService getDirectoryService()
          Returns a reference to the directory service used to register/deregister the actor and to lookup other actors.
 java.lang.String getExternalImplementationClass()
          Returns the fully qualified classname for the Java class that provides the agent's implementation if the agent is an external agent.
 java.util.Enumeration getInitialBeliefs(boolean includeParents)
          Returns the agent's initial beliefs.
 java.util.Enumeration getInitialFacts(boolean includeParents)
          Returns the agent's initial facts.
protected  Relation getIsMemberOfRelation()
          Returns the isMemberOf relation as defined by BaseGroup.
 gov.nasa.ci.corba.api.logging.ILoggingService getLoggingService()
          Returns a reference to the logging service used to log debug, informational, warning, error and fatal messages reported by the actor.
 gov.nasa.ci.api.actor.IManagedActor getManagedActor()
          Returns the actor's management interface.
 gov.nasa.ci.corba.api.management.IManagementService getManagementService()
          Returns a reference to the management service used to allow for the remote monitoring and control of the actor.
 gov.nasa.ci.corba.api.time.ITimeService getTimeService()
          Returns a reference to the time service used to provide time information and time notification services.
 gov.nasa.ci.corba.api.transport.ITransportService getTransportService()
          Returns a reference to the transport service used to create and send messages.
 void processMessage(gov.nasa.ci.api.communication.ICommunicativeAct message)
          Invoked when a new ICommunicativeAct was received intended for this actor.
 void register()
          Registers the agent with the CI
 void setAdvertisement(gov.nasa.ci.corba.api.directory.Advertisement advertisement)
          Sets the agent's advertisement.
 void setCredentials(gov.nasa.ci.corba.api.Credentials credentials)
          Sets the agent's credentials.
 void setExternalImplementationClass(java.lang.String className)
          Sets the fully qualified classname for the Java class that provides the agent's implementation if the agent is an external agent.
 
Methods inherited from class gov.nasa.arc.brahms.common.data.Agent
addParent, delete, getActivitiesRecursive, getActivitiesRecursive, getActivityByDescriptorRecursive, getAttributeRecursive, getAttributesRecursive, getInitialBeliefsRecursive, getInitialFactsRecursive, getParent, getParents, getParents, getRelationRecursive, getRelationsRecursive, getThoughtframesRecursive, getWorkframesRecursive, hasParents, isExternal, isInstanceOf, removeParent, setExternal, setID
 
Methods inherited from class gov.nasa.arc.brahms.common.data.ActiveInstance
getLocation, setLocation
 
Methods inherited from class gov.nasa.arc.brahms.common.data.ActiveConcept
addActivity, addInitialBelief, addInitialFact, addThoughtframe, addWorkframe, getActivities, getActivities, getActivities, getActivities, getActivityByDescriptor, getActivityByDescriptor, getAttribute, getAttributes, getCost, getInitialBeliefs, getInitialFacts, getLocalActivityByDescriptor, getRelation, getRelations, getThoughtframe, getThoughtframes, getThoughtframes, getThoughtframes, getTimeUnit, getWorkframe, getWorkframes, getWorkframes, getWorkframes, hasActivities, hasInitialBeliefs, hasInitialFacts, hasThoughtframes, hasWorkframes, removeActivity, removeThoughtframe, removeWorkframe, setCost, setTimeUnit
 
Methods inherited from class gov.nasa.arc.brahms.common.data.Concept
addAttribute, addRelation, compareTypes, getAttribute, getAttributes, getContext, getFullyQualifiedName, getIcon, getModel, getName, getPackage, getRelation, getRelations, getType, hasAttributes, hasRelations, isLocal, isSerializable, removeAttribute, removeRelation, setContext, setIcon, setLocal, setModel, setPackage, setSerializable, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
getDisplayText, getOwner, setDisplayText, setFullyQualifiedName, setName, setOwner
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.vm.data.IVMInstance
getContext, getFullyQualifiedName, getID, getName, isDynamic, isLocal, isSerializable, setDynamic, setSerializable
 
Methods inherited from interface gov.nasa.arc.brahms.common.data.Type
getSerialNumber
 

Field Detail

EXCEPTION_TIMEOUT

public static final long EXCEPTION_TIMEOUT
Constant specifying the recommended default time-out after an exception

See Also:
Constant Field Values

NUM_RETRIES

public static final int NUM_RETRIES
Constant specifying the recommended default number of retries

See Also:
Constant Field Values
Constructor Detail

VMAgent

public VMAgent()
Constructor, creates a new agent for use in the virtual machine.


VMAgent

public VMAgent(java.lang.String name)
Constructor, creates a new agent with the specified name for use in the virtual machine.

Parameters:
name - the name of the agent

VMAgent

public VMAgent(java.lang.String file,
               int line)
Constructor, creates a new agent for use in the virtual machine and for which its specification is stored in the specified file at the specified line number.

Parameters:
file - the file in which the agent is specified
line - the line number at which the agent's specification starts in the file

VMAgent

public VMAgent(java.lang.String name,
               java.lang.String file,
               int line)
Constructor, creates a new agent with the specified name for use in the virtual machine and for which its specification is stored in the specified file at the specified line number.

Parameters:
name - the name of the agent
file - the file in which the agent is specified
line - the line number at which the agent's specification starts in the file
Method Detail

setExternalImplementationClass

public void setExternalImplementationClass(java.lang.String className)
Sets the fully qualified classname for the Java class that provides the agent's implementation if the agent is an external agent. By default the fully qualified name of the agent is used.

Parameters:
className - the fully qualified Java class name

getExternalImplementationClass

public java.lang.String getExternalImplementationClass()
Returns the fully qualified classname for the Java class that provides the agent's implementation if the agent is an external agent. By default the fully qualified name of the agent is used.

Returns:
String the fully qualified Java class name

getActor

public gov.nasa.arc.brahms.vm.ci.BrahmsCIActor getActor()
                                                 throws VMException
Returns this agent's Collaborative Infrastructure actor.

Returns:
BrahmsCIActor this agent's CI actor
Throws:
VMException - if an error occurs creating the CI actor

getDescriptor

public gov.nasa.ci.api.actor.IActorDescriptor getDescriptor()
Returns the actor's descriptor.

Specified by:
getDescriptor in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
IActorDescriptor the descriptor

getCredentials

public gov.nasa.ci.corba.api.Credentials getCredentials()
Returns the agent's credentials.

Specified by:
getCredentials in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
Credentials the agent's credentials

setCredentials

public void setCredentials(gov.nasa.ci.corba.api.Credentials credentials)
Sets the agent's credentials.

Specified by:
setCredentials in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Parameters:
credentials - the agent's Credentials

getAdvertisement

public gov.nasa.ci.corba.api.directory.Advertisement getAdvertisement()
Returns the agent's advertisement.

Specified by:
getAdvertisement in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
Advertisement the agent's advertisement

setAdvertisement

public void setAdvertisement(gov.nasa.ci.corba.api.directory.Advertisement advertisement)
Sets the agent's advertisement.

Specified by:
setAdvertisement in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Parameters:
advertisement - the agent's Advertisement

register

public void register()
              throws ConceptRegistrationException
Registers the agent with the CI

Specified by:
register in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Throws:
ConceptRegistrationException - if there's an error registering the concept

deregister

public void deregister()
                throws VMException
Unregisters the agent from the CI.

Specified by:
deregister in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Throws:
VMException - if an error occurs during the de-registration

processMessage

public void processMessage(gov.nasa.ci.api.communication.ICommunicativeAct message)
Invoked when a new ICommunicativeAct was received intended for this actor.

Specified by:
processMessage in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Parameters:
message - the ICommunicativeAct intended for this actor

addJunkFilter

public void addJunkFilter(java.lang.String conversationID)
Adds the specified conversation identifier to the junk filter to ensure that any incoming messages with that conversation identifier are ignored.

Specified by:
addJunkFilter in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Parameters:
conversationID - the conversation id for the messages that need to be ignored

getManagedActor

public gov.nasa.ci.api.actor.IManagedActor getManagedActor()
Returns the actor's management interface. This interface is only available when the actor is successfully registered with the CI.

Specified by:
getManagedActor in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
IManagedActor the management interface, null if not registered

getDirectoryService

public gov.nasa.ci.corba.api.directory.IDirectoryService getDirectoryService()
                                                                      throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the directory service used to register/deregister the actor and to lookup other actors.

Specified by:
getDirectoryService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
IDirectoryService the directory service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

getTransportService

public gov.nasa.ci.corba.api.transport.ITransportService getTransportService()
                                                                      throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the transport service used to create and send messages.

Specified by:
getTransportService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
ITransportService the transport service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

getDataDistributionService

public gov.nasa.ci.corba.api.data.IDataDistributionService getDataDistributionService()
                                                                               throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the data distribution service used to publish data and used to subscribe for data.

Specified by:
getDataDistributionService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
IDataDistributionService the data distribution service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

getManagementService

public gov.nasa.ci.corba.api.management.IManagementService getManagementService()
                                                                         throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the management service used to allow for the remote monitoring and control of the actor.

Specified by:
getManagementService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
IManagementService the management service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

getTimeService

public gov.nasa.ci.corba.api.time.ITimeService getTimeService()
                                                       throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the time service used to provide time information and time notification services.

Specified by:
getTimeService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
ITimeService the time service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

getLoggingService

public gov.nasa.ci.corba.api.logging.ILoggingService getLoggingService()
                                                                throws gov.nasa.ci.corba.api.ServiceException
Returns a reference to the logging service used to log debug, informational, warning, error and fatal messages reported by the actor.

Specified by:
getLoggingService in interface gov.nasa.arc.brahms.vm.ci.ICIActor
Returns:
ILoggingService the logging service reference
Throws:
gov.nasa.ci.corba.api.ServiceException - if there was an error obtaining the service

createContext

public IConceptCtx createContext()
Creates a new context for this concept for use in a virtual machine.

Note: This method always returns a new instance and does not verify whether one is already created.

Overrides:
createContext in class Agent
Returns:
IConceptCtx the concept's context

getIsMemberOfRelation

protected Relation getIsMemberOfRelation()
Returns the isMemberOf relation as defined by BaseGroup.

Returns:
Relation the isMemberOf relation

getInitialFacts

public java.util.Enumeration getInitialFacts(boolean includeParents)
Returns the agent's initial facts. If the includeParents flag is false it excludes the initial facts defined for its parent classes or superclasses. If the flag is true it includes the initial facts defined for its parent classes or superclasses. This list includes the engine generated facts specifiying the group membership of the agent.

Overrides:
getInitialFacts in class ActiveConcept
Parameters:
includeParents - true if also the initial facts of its parent classes and superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the agent's initial facts

getInitialBeliefs

public java.util.Enumeration getInitialBeliefs(boolean includeParents)
Returns the agent's initial beliefs. If the includeParents flag is false it excludes the initial beliefs defined for its parent classes or superclasses. If the flag is true it includes the initial beliefs defined for its parent classes or superclasses. This list includes the engine generated beliefs specifiying the group membership of the agent.

Overrides:
getInitialBeliefs in class ActiveConcept
Parameters:
includeParents - true if also the initial beliefs of its parent classes and superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the agent's initial beliefs

equals

public boolean equals(java.lang.Object obj)
Tests whether two VMAgents are equal. The VM maintains a single instance of any VMAgent with a given FQN in its static model, so the equality check can be reduced to an identity check

Overrides:
equals in class Concept
Parameters:
obj - the Object to be compared for equality
Returns:
true if the two VMAgents are equal, false otherwise


Copyright © 1997-2012 All Rights Reserved.