|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
cz.cuni.jagrlib.xml.JGLScript
public class JGLScript
Script read from XML file.
Nested Class Summary | |
---|---|
protected class |
JGLScript.ArgParseState
Reads direct argument: atomic type, 1D array.. |
protected class |
JGLScript.ArrayState
Defines general array object. |
protected class |
JGLScript.ClassState
Reads full class specification and returns it using setValue() . |
protected class |
JGLScript.ConstructorState
Constructs the object using explicitly defined constructor. |
protected class |
JGLScript.DefState
Defines literal (named) object: atomic type, 1D array.. |
protected class |
JGLScript.FunctionState
Executes function from the other object. |
protected class |
JGLScript.InitState
Global parsing state encapsulating the whole XML file. |
protected class |
JGLScript.MemberState
Fetches member variable from the given class/instance. |
protected class |
JGLScript.MethodState
Invokes the given method of the ancestor object. |
protected class |
JGLScript.NullState
Null reference literal. |
protected class |
JGLScript.ObjectState
Defines a new object instance. |
protected class |
JGLScript.ParseState
Generic state object. |
protected class |
JGLScript.RefState
Reads reference to previously defined object. |
protected class |
JGLScript.ReturnState
Defines result object map. |
protected class |
JGLScript.ScriptState
Parses the whole JGL script (inside of the <script> tag). |
protected class |
JGLScript.SequenceState
Defines vector of the objects. |
protected class |
JGLScript.SetState
Invokes the set() method of the ancestor object. |
protected class |
JGLScript.TextParseState
General text-parsing state, accumulates text into StringBuffer . |
Field Summary | |
---|---|
static String |
A_ID
|
static String |
A_KEY
|
static String |
A_TYPE
|
protected static int |
anonId
For <object> section: anonymous id assigned if no explicit one was provided. |
static String |
ARG
|
static String |
ARRAY
|
static String |
CLASS
|
static String |
CONSTRUCTOR
|
static String |
DATA
|
static String |
DEF
|
static String |
FUNCTION
|
static String |
KEY
|
protected int |
lineNo
Actual line number (for error messages). |
static String |
MEMBER
|
static String |
METHOD
|
static String |
NAME
|
static String |
NULL
|
static String |
OBJECT
|
protected Map<String,Object> |
objects
Object map. |
static String[] |
PREF_PACKAGES
Preferred packages to be searched at object instantiation, member lookup, .. |
static String |
REF
|
protected Map<String,Object> |
results
Result map. |
static String |
RETURN
|
static String |
SCRIPT
|
protected String |
scriptFileName
Script file-name. |
static String |
SET
|
static int |
STATE_ALL
|
static int |
STATE_CLASS
|
static int |
STATE_NAME
|
static int |
STATE_REF
|
protected JGLScript.ParseState |
tos
State stack (top of stack). |
static String |
VALUE
|
Constructor Summary | |
---|---|
JGLScript()
|
Method Summary | |
---|---|
void |
endElement(String uri,
String localName,
String qName)
|
protected void |
error(String msg)
XML format error. |
protected Object |
globalInvoke(Object instance,
String name,
Object[] args)
Invokes the given method. |
void |
characters(char[] ch,
int start,
int length)
|
Map<String,Object> |
interpret(String scriptFileName)
Read and interprets XML script. |
Map<String,Object> |
interpret(String scriptFileName,
Map<String,Object> input)
Read and interprets XML script. |
static void |
main(String[] args)
|
protected void |
newObject(String name,
Object instance)
New object instance. |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
|
protected void |
warning(String msg)
XML warning. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SCRIPT
public static final String OBJECT
public static final String CLASS
public static final String CONSTRUCTOR
public static final String METHOD
public static final String MEMBER
public static final String NAME
public static final String ARG
public static final String REF
public static final String FUNCTION
public static final String RETURN
public static final String ARRAY
public static final String DATA
public static final String NULL
public static final String SET
public static final String KEY
public static final String VALUE
public static final String DEF
public static final String A_ID
public static final String A_TYPE
public static final String A_KEY
public static final int STATE_ALL
public static final int STATE_CLASS
public static final int STATE_REF
public static final int STATE_NAME
public static final String[] PREF_PACKAGES
protected Map<String,Object> objects
protected Map<String,Object> results
protected String scriptFileName
protected int lineNo
protected JGLScript.ParseState tos
protected static int anonId
<object>
section: anonymous id assigned if no explicit one was provided.
Constructor Detail |
---|
public JGLScript()
Method Detail |
---|
protected void error(String msg)
protected void warning(String msg)
protected void newObject(String name, Object instance)
protected Object globalInvoke(Object instance, String name, Object[] args)
public Map<String,Object> interpret(String scriptFileName)
scriptFileName
- File-name to interpret.
public Map<String,Object> interpret(String scriptFileName, Map<String,Object> input)
scriptFileName
- File-name to interpret.input
- Initial object-map (can be null
, if not, it will be altered!).
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |