|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.validation.valdoc.codeproc.AbstractCodeProcessor
public abstract class AbstractCodeProcessor
This abstract class implements the basic functionality of a ICodeProcessor whether it be a compiler or interpreter processor. This class should not be extended other than by AbstractCodeInterpreter. Those wishing to implement this functionality in other contexts should extend one of the latter two classes.
Field Summary | |
---|---|
protected String |
classpath
|
protected IConfiguration |
configuration
|
protected String |
language
|
protected IModel |
model
|
Fields inherited from interface org.eclipse.actf.validation.valdoc.codeproc.ICodeProcessor |
---|
DEFAULT_CODEPROCESSOR_FACTORY, FACTORY_PROCESSOR_KEY, SCRIPTLANG_ID |
Constructor Summary | |
---|---|
AbstractCodeProcessor(String language,
IModel model)
|
Method Summary | |
---|---|
void |
addScript(String scriptName,
InputStream scriptStream)
add the code in the given stream to be executed later by this processor |
void |
addScripts(Map scriptMap)
add the given scripts to this compiler for later compilation. |
String |
getClasspath()
returns the classpath being used from within script code or to compile source code generated during argument evaluation. |
protected String |
getFileContents(InputStream file)
|
String |
getLanguage()
get the language identifier for this processor |
IModel |
getModel()
return model used by this processor |
protected boolean |
isIdVisible(String id,
String vParam)
should be called from within setLocal to determine whether
or not the id to be declared is visible. |
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. |
void |
setClasspath(String cp)
set the classpath 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 |
setModel(IModel model)
set the model for this processor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.actf.validation.valdoc.codeproc.ICodeProcessor |
---|
addScript, addScript, evaluateArguments, evaluateArguments, getEnvironment, getExpressionDelimiter, getInitCode, getScript, isCompilerProcessor, processCode, setEnvironment, setLocal |
Field Detail |
---|
protected IConfiguration configuration
protected IModel model
protected String language
protected String classpath
Constructor Detail |
---|
public AbstractCodeProcessor(String language, IModel model)
Method Detail |
---|
public void setModel(IModel model)
setModel
in interface ICodeProcessor
model
- --
modelpublic IModel getModel()
getModel
in interface ICodeProcessor
public 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.
setClasspath
in interface ICodeProcessor
cp
- -
classpath to usepublic String getClasspath()
getClasspath
in interface ICodeProcessor
ICodeProcessor.setClasspath(String)
public void setLanguage(String lang)
setLanguage
in interface ICodeProcessor
lang
- --
language identifier for this processorpublic String getLanguage()
getLanguage
in interface ICodeProcessor
public void addScript(String scriptName, InputStream scriptStream)
addScript
in interface ICodeProcessor
scriptName
- --
name of scriptscriptStream
- --
stream containing code for scriptpublic void addScripts(Map scriptMap)
addScripts
in interface ICodeProcessor
scriptMap
- --
map keyed by script names with values containing code to be
executedpublic String prepareCode(String code)
prepareCode
in interface ICodeProcessor
code
- --
code to be prepared for execution
public 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
setIdVisibility
in interface ICodeProcessor
visibility
- --
one of "ALL", "NONE", or "<reg_expression>"
IllegalArgumentException
- if argument cannot be processedprotected boolean isIdVisible(String id, String vParam)
setLocal
to determine whether
or not the id to be declared is visible.
id
- --
identifier to be testedvParam
- --
visibility parameter (value of rib:visible attribute if
present)protected String getFileContents(InputStream file)
public 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.
makeExpressionList
in interface ICodeProcessor
str
- --
string to be split
IllegalArgumentException
- if symbol mismatch occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |