|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICodeProcessor
responsible for processing any code within a validation document. A ICodeProcessor may be implemented as one type:
org.eclipse.actf.validation.valdoc.scripting.AbstractCodeInterpreter
which is responsible for interpreting code in a variety of scripting
languages
Field Summary | |
---|---|
static String |
DEFAULT_CODEPROCESSOR_FACTORY
|
static String |
FACTORY_PROCESSOR_KEY
|
static String |
SCRIPTLANG_ID
pool id for script languages pool - value is 'scriptlang' |
Method Summary | |
---|---|
void |
addScript(String code)
add the specified code as a script for this processor. |
void |
addScript(String scriptName,
InputStream scriptStream)
add the code in the given stream to be executed later by this processor |
void |
addScript(String scriptName,
String scriptCode)
add the script code with the specified script name to this processor for later execution |
void |
addScripts(Map scriptMap)
add the given scripts to this processor for later execution or compilation. |
Object |
evaluateArguments(String arg,
Class returnType)
attempt to evaluate the given string as an argument of the specified type |
Object[] |
evaluateArguments(String args,
Class[] paramTypes)
attempt to evaluate the given string as a set of arguments of objects corresponding to the specified types. |
String |
getClasspath()
returns the classpath being used from within script code or to compile source code generated during argument evaluation. |
Object |
getEnvironment()
used to retreave the environment of this processor so as to be passed to the setEnvironment(Object) of a newly instantiated
processor |
char |
getExpressionDelimiter()
get the default expression delimiter for the language. |
String |
getInitCode()
get the initialization code for this processor. |
String |
getLanguage()
get the language identifier for this processor |
IModel |
getModel()
return model used by this processor |
String |
getScript(String scriptName)
get the code associated with the given script name |
boolean |
isCompilerProcessor()
tests whether or not this processor is a compiler. |
String[] |
makeExpressionList(String str)
split the specified string into "expressions" bounded by the delimiter returned by getExpressionDelimiter . |
String |
prepareCode(String code)
prepare code for execution or compilation (e.g. by resolving entity references or removing CDATA tags) |
boolean |
processCode(String[] params)
process the code according to the implementation of this processor (i.e. |
void |
setClasspath(String cp)
set the classpath for this processor. |
void |
setEnvironment(Object env)
set the environment for this processor. |
void |
setIdVisibility(String visibility)
set the visibility for symbols in the XML document. |
void |
setLanguage(String lang)
set the language identifier for this processor. |
void |
setLocal(String name,
Object obj,
String vParam)
declare a new identifier to this processor for use in scripts. |
void |
setModel(IModel model)
set the model for this processor |
Field Detail |
---|
static final String SCRIPTLANG_ID
static final String FACTORY_PROCESSOR_KEY
static final String DEFAULT_CODEPROCESSOR_FACTORY
Method Detail |
---|
void setModel(IModel model)
model
- --
modelIModel getModel()
String getClasspath()
setClasspath(String)
void setClasspath(String cp)
import
statements.
The classpath for a processor isnot necessarily the same as that used by ACTF validation engines. A default value is supplied in the ValidationConstants.CODE_PROCESSOR_CLASSPATH_KEY property in the raven.xml file.
cp
- -
classpath to usevoid setLanguage(String lang)
lang
- --
language identifier for this processorString getLanguage()
void setEnvironment(Object env)
getEnvironment()
.
env
- --
environment of another processor retreaved via
getEnvironment()
Object getEnvironment()
setEnvironment(Object)
of a newly instantiated
processor
setEnvironment(Object)
void setIdVisibility(String visibility) throws IllegalArgumentException
The setLocal
method of implementations of this interface
should take care to set the environment according to the constraints of
this property.
Note: Not utilized in ACTF
visibility
- --
one of "ALL", "NONE", or "<reg_expression>"
IllegalArgumentException
- if argument cannot be processedvoid addScript(String code)
code
- --
code to be added to this processorvoid addScript(String scriptName, String scriptCode)
scriptName
- --
name or id of scriptscriptCode
- --
code to be executedvoid addScript(String scriptName, InputStream scriptStream)
scriptName
- --
name of scriptscriptStream
- --
stream containing code for scriptvoid addScripts(Map scriptMap)
scriptMap
- --
map keyed by script names with values containing code to be
executedString getScript(String scriptName)
scriptName
- --
name of script for which code is desired
null
if name is
not validString getInitCode()
void setLocal(String name, Object obj, String vParam)
By specifying an override parameter "either "true" or "false"), the following behavior should result:
Note: Only first two parameters relevant to ACTF; always pass 'true' to vParam.
name
- --
identifier for this objectobj
- --
object being declared (may be null
)vParam
- --
either "true" or "false", the rib:visible attribute value (may
also be null
, in which case the behavior
specified via setIdVisibility
will be adoptedsetIdVisibility(String)
char getExpressionDelimiter()
String[] makeExpressionList(String str) throws IllegalArgumentException
getExpressionDelimiter
. Although what
constitutes an expression is language-dependent, this method will insure
that each String in the given list is consistent and complete. The
following tokens can be recognized:
"...", '...'
(...)
or expressions
containing parenthesized expressions (e.g.
new java.awt.Dimension(150, 150)
[item1, item2, ...]
{name="Mike Squillace", ...}
or
new String[] {"a", "b", ...}
The default implementation in both
org.eclipse.actf.validation.valdoc.scripting.AbstractCodeInterpreter
and
org.eclipse.actf.validation.valdoc.scripting.BaseCodeCompiler
implement
this method in the manner described above.
str
- --
string to be split
IllegalArgumentException
- if symbol mismatch occursString prepareCode(String code)
code
- --
code to be prepared
Object evaluateArguments(String arg, Class returnType) throws EvaluationException
arg
- --
argument to be evaluatedreturnType
- --
desired type of returned object
EvaluationException
- if evaluation was not successfulObject[] evaluateArguments(String args, Class[] paramTypes) throws EvaluationException
args
- --
arguments to be evaluatedparamTypes
- --
desired types of returned objects
EvaluationException
- if evaluation was not successfulboolean isCompilerProcessor()
true
if this processor is a compiler
implementation, false
otherwiseboolean processCode(String[] params)
This method may perform one of two processes:
params
- --
parameters for execution or for compilation
true
for success,
false
otherwise)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |