public class ObjectAgent extends java.lang.Object implements LocalAgent, LocalAgentFactoryUser, AlternateAncestorUser, LocalSubItemsAgent
Modifier and Type | Field and Description |
---|---|
protected LocalAgent |
alternateAncestor |
protected java.lang.String |
alternateAncestorClassname
AlternateAncestorUser implementation.
|
protected LocalAgentFactory |
factory
LocalAgentFactoryUser implementation.
|
static java.lang.String |
objectType
"Object" (Subclasses will override)
The generic object type supported by this Agent helper class.
|
Constructor and Description |
---|
ObjectAgent()
Constructor for ObjectAgent.
|
Modifier and Type | Method and Description |
---|---|
LocalAgent |
getAlternateAncestor()
AlternateAncestorUser interface.
|
java.lang.String |
getAlternateAncestorClassname()
AlternateAncestorUser interface.
|
protected LocalAgent |
getAncestorAgent()
Used internally by processAncestor and subclasses to attempt to retrieve the
alternateAncestor locally or via any stored LocalAgentFactory.
|
java.lang.String |
getCaption(java.lang.Object object)
Retrieve the Caption of the object if one exits.
|
int |
getChildCount(java.lang.Object parent)
Return the number of children available in the provided parent.
|
java.lang.Object[] |
getChildren(java.lang.Object parent)
Return an array representing the children of the provided parent object.
|
java.lang.String |
getClassName(java.lang.Object object)
Return the Class name of the object.
|
java.lang.String |
getID(java.lang.Object object)
Retrieve the ID of the object if the object has an ID.
|
int |
getLevel(java.lang.Object object)
Return the Z-Order level of the object (generally for a top level window).
|
LocalAgentFactory |
getLocalAgentFactory()
LocalAgentFactoryUser Interface.
|
java.lang.Object |
getMatchingPathObject(java.lang.Object theObject,
java.lang.String thePath)
Mechanism to retrieve a subitem/object identified
by the provided Path.
|
java.lang.String |
getName(java.lang.Object object)
Retrieve the name of the object if the object is named.
|
java.lang.String |
getProperty(java.lang.Object object,
java.lang.String property)
Retrieve the property value of the object if the object has the property.
|
java.lang.String[] |
getPropertyNames(java.lang.Object object)
Retrieve the list of available properties for the object.
|
java.lang.String[][] |
getStringData(java.lang.Object object,
java.lang.Object dataInfo)
Return whatever data is extractable (normally visible) from the object.
|
java.lang.Object |
getSubItemAtIndex(java.lang.Object object,
int index)
Return the subitem at the specified index from the given object.
|
java.lang.String[] |
getSuperClassNames(java.lang.Object object)
Return the array of all superclass names for the object.
|
java.lang.String |
getText(java.lang.Object object)
Retrieve the displayed text value of the object if the object has a text value.
|
boolean |
isMatchingPath(java.lang.Object theObject,
java.lang.String thePath)
Mechanism to determine if the object contains a subitem/object identified
by the provided Path.
|
boolean |
isShowing(java.lang.Object object)
Return true if the object is showing/visible.
|
boolean |
isValid(java.lang.Object object)
Return true if the object is still valid/finadable in the JVM.
|
TestRecordData |
process(java.lang.Object object,
TestRecordData testRecordData)
Process the action provided in the testRecordData.
|
TestRecordData |
processAncestor(java.lang.Object object,
TestRecordData testRecordData)
Attempts to retrieve the alternateAncestor if defined and execute process on that.
|
void |
setAlternateAncestor(LocalAgent ancestor)
AlternateAncestorUser interface.
|
void |
setAlternateAncestorClassname(java.lang.String ancestorClassname)
AlternateAncestorUser interface.
|
void |
setLocalAgentFactory(LocalAgentFactory factory)
LocalAgentFactoryUser Interface.
|
public static final java.lang.String objectType
protected LocalAgentFactory factory
protected java.lang.String alternateAncestorClassname
protected LocalAgent alternateAncestor
public int getChildCount(java.lang.Object parent)
LocalAgent
getChildCount
in interface LocalAgent
parent
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("ChildCount
- Unsupported");LocalAgent.getChildCount(Object)
public java.lang.Object[] getChildren(java.lang.Object parent)
LocalAgent
getChildren
in interface LocalAgent
parent
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("Children
- Unsupported");LocalAgent.getChildren(Object)
public java.lang.String getCaption(java.lang.Object object)
LocalAgent
getCaption
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("Caption
- Unsupported");LocalAgent.getCaption(Object)
public java.lang.String getName(java.lang.Object object)
LocalAgent
getName
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("Name
- Unsupported");LocalAgent.getName(Object)
public java.lang.String getID(java.lang.Object object)
LocalAgent
getID
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("ID
- Unsupported");LocalAgent.getID(Object)
public java.lang.String getText(java.lang.Object object)
LocalAgent
getText
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("Text
- Unsupported");LocalAgent.getText(Object)
public java.lang.String[] getPropertyNames(java.lang.Object object)
LocalAgent
getPropertyNames
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.LocalAgent.getPropertyNames(Object)
public java.lang.String getProperty(java.lang.Object object, java.lang.String property)
LocalAgent
getProperty
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.property
- -- case-sensitive name of the property to retrieveSAFSInvalidActionArgumentRuntimeException(property)
SAFSObjectNotFoundRuntimeException("Invalid
- object")LocalAgent.getProperty(Object, String)
public java.lang.String getClassName(java.lang.Object object)
LocalAgent
getClassName
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSObjectNotFoundRuntimeException("Invalid
- object")LocalAgent.getClassName(Object)
public int getLevel(java.lang.Object object)
LocalAgent
getLevel
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSActionUnsupportedRuntimeException("Level
- Unsupported");LocalAgent.getLevel(Object)
public boolean isShowing(java.lang.Object object)
LocalAgent
isShowing
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.new
- SAFSActionUnsupportedRuntimeException("Showing Unsupported");LocalAgent.isShowing(Object)
public boolean isValid(java.lang.Object object)
isValid
in interface LocalAgent
object
- An object from getTopLevelWindows or from a previous call to getChildren.public java.lang.String[] getSuperClassNames(java.lang.Object object)
LocalAgent
getSuperClassNames
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.SAFSObjectNotFoundRuntimeException("Invalid
- Object")LocalAgent.getSuperClassNames(Object)
public java.lang.Object getSubItemAtIndex(java.lang.Object object, int index) throws java.lang.Exception
LocalSubItemsAgent
getSubItemAtIndex
in interface LocalSubItemsAgent
object
- reference from which to locate the subitem.index
- of the subitem to retrieve.java.lang.Exception
public java.lang.Object getMatchingPathObject(java.lang.Object theObject, java.lang.String thePath) throws java.lang.Exception
LocalAgent
Ex:
File->Exit
Root->Branch->Leaf
getMatchingPathObject
in interface LocalAgent
getMatchingPathObject
in interface LocalSubItemsAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.thePath
- SAFSSubItemsAgentUnsupportedRuntimeException("MatchingPathObject
- Unsupported")java.lang.Exception
LocalAgent.getMatchingPathObject(Object, String)
public boolean isMatchingPath(java.lang.Object theObject, java.lang.String thePath) throws java.lang.Exception
LocalAgent
Ex:
File->Exit
Root->Branch->Leaf
isMatchingPath
in interface LocalAgent
isMatchingPath
in interface LocalSubItemsAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.thePath
- SAFSSubItemsAgentUnsupportedRuntimeException("MatchingPath
- Unsupported")java.lang.Exception
LocalAgent.isMatchingPath(Object, String)
public java.lang.String[][] getStringData(java.lang.Object object, java.lang.Object dataInfo)
LocalAgent
getStringData
in interface LocalAgent
object
- -- the actual object or component to be checked -- not a pseudo reference.dataInfo
- SAFSActionUnsupportedRuntimeException("StringData
- Unsupported")LocalAgent.getStringData(Object, Object)
public void setLocalAgentFactory(LocalAgentFactory factory)
setLocalAgentFactory
in interface LocalAgentFactoryUser
public LocalAgentFactory getLocalAgentFactory()
getLocalAgentFactory
in interface LocalAgentFactoryUser
public LocalAgent getAlternateAncestor()
getAlternateAncestor
in interface AlternateAncestorUser
public void setAlternateAncestor(LocalAgent ancestor)
setAlternateAncestor
in interface AlternateAncestorUser
public java.lang.String getAlternateAncestorClassname()
getAlternateAncestorClassname
in interface AlternateAncestorUser
public void setAlternateAncestorClassname(java.lang.String ancestorClassname)
setAlternateAncestorClassname
in interface AlternateAncestorUser
protected LocalAgent getAncestorAgent()
public TestRecordData process(java.lang.Object object, TestRecordData testRecordData)
Subclasses in the org.safs.jvmagent package should always attempt to processAncestor
if they themselves do not handle the command in the testRecordData. This is shown
below:
if (testRecordData.getStatusCode() == StatusCodes.SCRIPT_NOT_EXECUTED)
processAncestor(object, testRecordData);
Subclasses in other packages like org.safs.abbot should typically always call
super.process() if they themselves do not handle the command in the testRecordData.
This is shown below:
if (testRecordData.getStatusCode() == StatusCodes.SCRIPT_NOT_EXECUTED)
super.process(object, testRecordData);
In this way, the proper order of processing in-package classes and superclasses
is maintained.
An Agent may throw various types of Agent-specific RuntimeExceptions depending upon failure modes.
process
in interface LocalAgent
testRecordData
- provides all the information needed by the Agent to perform the action and
to get/set the process statuscode.SAFSObjectNotFoundRuntimeException("Invalid
- object")SAFSObjectNotFoundRuntimeException("Invalid
- testRecordData")public TestRecordData processAncestor(java.lang.Object object, TestRecordData testRecordData)
processAncestor
in interface AlternateAncestorUser
Copyright © SAS Institute. All Rights Reserved.