|
||||||||||
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 java.lang.String |
A_ID
|
static java.lang.String |
A_KEY
|
static java.lang.String |
A_TYPE
|
protected static int |
anonId
For <object> section: anonymous id assigned if no explicit one was provided. |
static java.lang.String |
ARG
|
static java.lang.String |
ARRAY
|
static java.lang.String |
CLASS
|
static java.lang.String |
CONSTRUCTOR
|
static java.lang.String |
DATA
|
static java.lang.String |
DEF
|
static java.lang.String |
FUNCTION
|
static java.lang.String |
KEY
|
protected int |
lineNo
Actual line number (for error messages). |
static java.lang.String |
MEMBER
|
static java.lang.String |
METHOD
|
static java.lang.String |
NAME
|
static java.lang.String |
NULL
|
static java.lang.String |
OBJECT
|
protected java.util.Map<java.lang.String,java.lang.Object> |
objects
Object map. |
static java.lang.String[] |
PREF_PACKAGES
Preferred packages to be searched at object instantiation, member lookup, .. |
static java.lang.String |
REF
|
protected java.util.Map<java.lang.String,java.lang.Object> |
results
Result map. |
static java.lang.String |
RETURN
|
static java.lang.String |
SCRIPT
|
protected java.lang.String |
scriptFileName
Script file-name. |
static java.lang.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 java.lang.String |
VALUE
|
Constructor Summary | |
---|---|
JGLScript()
|
Method Summary | |
---|---|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
|
protected void |
error(java.lang.String msg)
XML format error. |
protected java.lang.Object |
globalInvoke(java.lang.Object instance,
java.lang.String name,
java.lang.Object[] args)
Invokes the given method. |
void |
characters(char[] ch,
int start,
int length)
|
java.util.Map<java.lang.String,java.lang.Object> |
interpret(java.lang.String scriptFileName)
Read and interprets XML script. |
java.util.Map<java.lang.String,java.lang.Object> |
interpret(java.lang.String scriptFileName,
java.util.Map<java.lang.String,java.lang.Object> input)
Read and interprets XML script. |
static void |
main(java.lang.String[] args)
|
protected void |
newObject(java.lang.String name,
java.lang.Object instance)
New object instance. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
protected void |
warning(java.lang.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 java.lang.String SCRIPT
public static final java.lang.String OBJECT
public static final java.lang.String CLASS
public static final java.lang.String CONSTRUCTOR
public static final java.lang.String METHOD
public static final java.lang.String MEMBER
public static final java.lang.String NAME
public static final java.lang.String ARG
public static final java.lang.String REF
public static final java.lang.String FUNCTION
public static final java.lang.String RETURN
public static final java.lang.String ARRAY
public static final java.lang.String DATA
public static final java.lang.String NULL
public static final java.lang.String SET
public static final java.lang.String KEY
public static final java.lang.String VALUE
public static final java.lang.String DEF
public static final java.lang.String A_ID
public static final java.lang.String A_TYPE
public static final java.lang.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 java.lang.String[] PREF_PACKAGES
protected java.util.Map<java.lang.String,java.lang.Object> objects
protected java.util.Map<java.lang.String,java.lang.Object> results
protected java.lang.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(java.lang.String msg)
protected void warning(java.lang.String msg)
protected void newObject(java.lang.String name, java.lang.Object instance)
protected java.lang.Object globalInvoke(java.lang.Object instance, java.lang.String name, java.lang.Object[] args)
public java.util.Map<java.lang.String,java.lang.Object> interpret(java.lang.String scriptFileName)
scriptFileName
- File-name to interpret.
public java.util.Map<java.lang.String,java.lang.Object> interpret(java.lang.String scriptFileName, java.util.Map<java.lang.String,java.lang.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 org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |