|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.script.Step
public abstract class Step
Provides access to one step (line) from a script. A Step is the basic unit of execution. Custom Step classes
All custom Step
classes must supply a Constructor
with the
signature <init>(${link Resolver},
. If
the step has contents (e.g. Map
)Sequence
), then it should also
provide a Constructor
with the signature
<init>(
.
Resolver
, Element
, Map
)
The XML tag for a given Step
will be used to auto-generate the
Step
class name, e.g. the tag <aphrodite/> causes the
parser to create an instance of class abbot.script.Aphrodite
,
using one of the Constructor
s described above.
All derived classes should include an entry in the
schema, or validation must be turned
off by setting the System property
abbot.script.validate=false
.
You can make the custom Aphrodite
step do just about anything
by overriding the runStep()
method.
See the source for any Step
implementation in this package for
examples.
Field Summary |
---|
Fields inherited from interface abbot.script.XMLConstants |
---|
TAG_ACTION, TAG_APPLETVIEWER, TAG_ARCHIVE, TAG_ARGS, TAG_ASSERT, TAG_AWT, TAG_AWTTESTSCRIPT, TAG_BORDER_TITLE, TAG_CALL, TAG_CLASS, TAG_CLASSPATH, TAG_CODE, TAG_CODEBASE, TAG_COMMENT, TAG_COMPONENT, TAG_COUNT, TAG_DELEGATE, TAG_DESC, TAG_DOCBASE, TAG_EVENT, TAG_EXPR, TAG_FILENAME, TAG_FIXTURE, TAG_FORKED, TAG_HEIGHT, TAG_HORDER, TAG_ICON, TAG_ID, TAG_INDEX, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LABEL, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARAMS, TAG_PARENT, TAG_POLL_INTERVAL, TAG_PROPERTY, TAG_ROOT, TAG_SAMPLE, TAG_SCRIPT, TAG_SEQUENCE, TAG_SLOW, TAG_STOP_ON_ERROR, TAG_STOP_ON_FAILURE, TAG_TAG, TAG_TERMINATE, TAG_TEXT, TAG_THREADED, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_VMARGS, TAG_VORDER, TAG_WAIT, TAG_WEIGHTED, TAG_WIDTH, TAG_WINDOW, TAG_X, TAG_Y |
Constructor Summary | |
---|---|
Step(Resolver resolver,
Map attributes)
|
|
Step(Resolver resolver,
String description)
|
Method Summary | |
---|---|
protected Element |
addAttributes(Element el)
Add an attribute to the given XML Element. |
protected Element |
addContent(Element el)
Override if the step actually has some contents. |
protected static Map |
createAttributeMap(Element el)
Convert the attributes in the given XML Element into a Map of name/value pairs. |
static Step |
createStep(Resolver resolver,
Element el)
Factory method, equivalent to a "fromXML" for step creation. |
static Step |
createStep(Resolver resolver,
String str)
Create a new step from an in-line XML string. |
Map |
getAttributes()
Attributes to save in script. |
abstract String |
getDefaultDescription()
Return a reasonable default description for this script step. |
String |
getDescription()
|
Resolver |
getResolver()
|
abstract String |
getUsage()
Provide a usage String for this step. |
abstract String |
getXMLTag()
Define the XML tag to use for this script step. |
protected void |
parseStepAttributes(Map attributes)
Only exposed so that Script may invoke it on load from disk. |
Class |
resolveClass(String className)
Returns the Class corresponding to the given class name. |
protected ComponentTester |
resolveTester(String className)
Look up an appropriate ComponentTester given an arbitrary Component-derived class. |
void |
run()
Main run method. |
protected abstract void |
runStep()
Implement the step's behavior here. |
void |
setDescription(String desc)
|
protected void |
setScriptError(Throwable thr)
For use by subclasses when an error is encountered during parsing. |
protected String |
simpleClassName(Class cls)
|
String |
toEditableString()
Convert this Step into a String suitable for editing. |
String |
toString()
Return a description of this script step. |
Element |
toXML()
Convert the object to XML. |
static String |
toXMLString(XMLifiable obj)
Provide a one-line XML string representation. |
protected void |
usage()
Throw an invalid script exception describing the proper script usage. |
protected void |
usage(String details)
Store an invalid script exception describing the proper script usage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Step(Resolver resolver, Map attributes)
public Step(Resolver resolver, String description)
Method Detail |
---|
protected final void parseStepAttributes(Map attributes)
public final void run() throws Throwable
Throwable
protected abstract void runStep() throws Throwable
Throwable
public String getDescription()
public void setDescription(String desc)
public abstract String getXMLTag()
public abstract String getUsage()
public abstract String getDefaultDescription()
protected void setScriptError(Throwable thr)
protected void usage()
protected void usage(String details)
public Map getAttributes()
public Resolver getResolver()
protected Element addContent(Element el)
protected Element addAttributes(Element el)
public String toEditableString()
toEditableString
in interface XMLifiable
public static String toXMLString(XMLifiable obj)
public Element toXML()
toXML
in interface XMLifiable
public static Step createStep(Resolver resolver, String str) throws InvalidScriptException, IOException
InvalidScriptException
IOException
protected static Map createAttributeMap(Element el)
public static Step createStep(Resolver resolver, Element el) throws InvalidScriptException
InvalidScriptException
protected String simpleClassName(Class cls)
public String toString()
toString
in class Object
public Class resolveClass(String className) throws ClassNotFoundException
ClassNotFoundException
protected ComponentTester resolveTester(String className) throws ClassNotFoundException
ClassNotFoundException
- If the given class can't be found.
IllegalArgumentException
- If the tester cannot be instantiated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |