gov.nasa.arc.brahms.common.rt
Class ActivityCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, IRuntimeConstants, java.io.Serializable
Direct Known Subclasses:
CompositeActivityCtx, PrimitiveActivityCtx, VMActivityCtx

public class ActivityCtx
extends BrahmsObjectCtx
implements IActivityCtx

The ActivityCtx maintains the context of an activity being or to be executed by an active instance. The context maintains the start and end times for an activity, the duration, priority, and status.

Version:
$Revision: 1.1 $ $Date: 2007/10/10 14:12:44 $ $Author: rvhoof $
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, DETECTABLE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE
 
Constructor Summary
ActivityCtx(Activity act)
          Constructor, creates a new context for the specified Activity.
 
Method Summary
 DetectableCtx getCompletionCause()
          Returns the cause of the activities completion if not normal completion, throws an exception is no cause is set.
 ParameterCtx getDisplayText()
          Returns the activities display text.
 IWorkframeCtx getParentFrame()
          Returns the frame context in which this activity is executed, serving as the parent of the activity.
 IActiveInstanceCtx getPerformedBy()
          Returns the active instance performing the activity.
 ParameterCtx getPriority()
          Returns the activities priority.
 ActivityRef getReferencedBy()
          Returns the activity reference referencing this activity and causing the creation of this context.
 ActivityStateCtx getState()
          Returns the current state of the activity context.
 int getStatus()
          Returns the activities current status.
 void setCompletionCause(DetectableCtx detectable)
          Sets the cause of the activities completion if not normal completion, throws an exception is no cause is set.
 void setDisplayText(ParameterCtx p)
          Sets the activities display text.
 void setParentFrame(IWorkframeCtx parent)
          Sets the frame context in which this activity is executed, serving as the parent of the activity.
 void setPerformedBy(IActiveInstanceCtx ai)
          Sets the active instance performing the activity.
 void setPriority(ParameterCtx p)
          Sets the activities priority.
 void setReferencedBy(ActivityRef referencedBy)
          Sets the activity reference referencing this activity and causing the creation of this context.
 void setState(ActivityStateCtx state)
          Sets the current state of the activity context.
 void setState(ActivityStateCtx state, boolean maintainHistory)
          Sets the current state of the activity context.
 void setStatus(int status)
          Sets the activities current status.
 java.lang.String toString()
          Returns the fully qualified name of the activity this is a context for and the context id.
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setContextFor, setEndTime, setID, setStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

ActivityCtx

public ActivityCtx(Activity act)
Constructor, creates a new context for the specified Activity.

Parameters:
act - the Activity for which to create a context
Method Detail

setReferencedBy

public void setReferencedBy(ActivityRef referencedBy)
Sets the activity reference referencing this activity and causing the creation of this context.

Specified by:
setReferencedBy in interface IActivityCtx
Parameters:
referencedBy - the ActivityRef referencing this activity

getReferencedBy

public ActivityRef getReferencedBy()
Returns the activity reference referencing this activity and causing the creation of this context.

Specified by:
getReferencedBy in interface IActivityCtx
Returns:
ActivityRef the activity reference referencing this activity

setParentFrame

public void setParentFrame(IWorkframeCtx parent)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the frame context in which this activity is executed, serving as the parent of the activity.

Specified by:
setParentFrame in interface IActivityCtx
Parameters:
parent - the IWorkframeCtx in which the activity is executed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - in case of an internal error

getParentFrame

public IWorkframeCtx getParentFrame()
                             throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the frame context in which this activity is executed, serving as the parent of the activity.

Specified by:
getParentFrame in interface IActivityCtx
Returns:
IWorkframeCtx the frame context in which the activity is executed, null if not set
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - in case of an internal error

setPerformedBy

public void setPerformedBy(IActiveInstanceCtx ai)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the active instance performing the activity.

Specified by:
setPerformedBy in interface IActivityCtx
Parameters:
ai - the active instance performing the activity.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null active instance is specified

getPerformedBy

public IActiveInstanceCtx getPerformedBy()
                                  throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the active instance performing the activity.

Specified by:
getPerformedBy in interface IActivityCtx
Returns:
IActiveInstanceCtx the active instance performing the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no active instance is specified

setDisplayText

public void setDisplayText(ParameterCtx p)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the activities display text. The display text is set through a parameter context containing either the actual value or a reference to a variable containing the display text value.

Specified by:
setDisplayText in interface IActivityCtx
Parameters:
p - the ParameterCtx defining the display text of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null display text is defined

getDisplayText

public ParameterCtx getDisplayText()
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the activities display text. The display text is set through a parameter context containing either the actual value or a reference to a variable containing the display text value.

Specified by:
getDisplayText in interface IActivityCtx
Returns:
ParameterCtx the display text of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no display text is defined

setPriority

public void setPriority(ParameterCtx p)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the activities priority. The priority is set through a parameter context containing either the actual value or a reference to a variable containing the priority value.

Parameters:
p - the ParameterCtx defining the priority of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null priority us defined

getPriority

public ParameterCtx getPriority()
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the activities priority. The priority is set through a parameter context containing either the actual value or a reference to a variable containing the priority value.

Specified by:
getPriority in interface IActivityCtx
Returns:
ParameterCtx the priority of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no priority is defined

setStatus

public void setStatus(int status)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the activities current status.

Specified by:
setStatus in interface IActivityCtx
Parameters:
status - the status of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if status is an invalid status
See Also:
IRuntimeConstants

getStatus

public int getStatus()
              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the activities current status.

Specified by:
getStatus in interface IActivityCtx
Returns:
int the status of the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if activity has no status or invalid status
See Also:
IRuntimeConstants

setState

public void setState(ActivityStateCtx state)
Sets the current state of the activity context. No state history is maintained. Any previous state information is discarded.

Parameters:
state - the ActivityStateCtx with the state information

setState

public void setState(ActivityStateCtx state,
                     boolean maintainHistory)
Sets the current state of the activity context. Depending on the maintainHistory indicator a history of the states is maintained by linking the states in a list (maintainHistory == true). If maintainHistory is false no history is maintained and any previous state information is discarded.

Parameters:
state - the ActivityStateCtx with the state information
maintainHistory - true if history must be maintained, false otherwise

getState

public ActivityStateCtx getState()
Returns the current state of the activity context. If a history was maintained the history can be traversed using the states getPreviousState and getNextState methods.

Returns:
ActivityStateCtx the current state of the activity context, null if no state is set

setCompletionCause

public void setCompletionCause(DetectableCtx detectable)
                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the cause of the activities completion if not normal completion, throws an exception is no cause is set. The cause can only be a detectable (aborting or completing a workframe).

Specified by:
setCompletionCause in interface IActivityCtx
Parameters:
detectable - the DetectableCtx referencing the detectable causing the completion
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if detectable is null

getCompletionCause

public DetectableCtx getCompletionCause()
                                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the cause of the activities completion if not normal completion, throws an exception is no cause is set.

Specified by:
getCompletionCause in interface IActivityCtx
Returns:
DetectableCtx the detectable causing the completion
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no cause is set for the activity

toString

public java.lang.String toString()
Returns the fully qualified name of the activity this is a context for and the context id.

Overrides:
toString in class java.lang.Object
Returns:
String string representation of this context


Copyright © 1997-2012 All Rights Reserved.