Package cds.savot.pull
Class SavotPullEngine
- java.lang.Object
-
- cds.savot.pull.SavotPullEngine
-
- All Implemented Interfaces:
Markups
public final class SavotPullEngine extends java.lang.Object implements Markups
It has been tested with kXML Pull parser implementation
but it is possible to use other pull parsers
Designed to use with Pull parsers complient with Standard Pull Implementation v1
LBO: Note: equalsIgnoreCase() vs() equals as XML is case sensitive and VOTable specification says that clearly- Author:
- Andre Schaaff
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_STACK_CAPACITYdefault stack capacity = 4 slotsstatic intFULLFULL parsing mode: deprecated and replaced by FULLREADstatic intFULLREADFULLREAD parsing mode all in memorystatic intRESOURCEREADRESOURCEREAD parsing mode: row per row readingstatic intROWREADROWREAD parsing mode: row per row readingstatic intSEQUENTIALSEQUENTIAL parsing mode: deprecated and replaced by RESOURCEREAD-
Fields inherited from interface cds.savot.common.Markups
ACTION, ACTUATE, ARRAYSIZE, BINARY, CONTENTROLE, CONTENTTYPE, COOSYS, DATA, DATATYPE, DEFINITIONS, DESCRIPTION, ENCODING, EPOCH, EQUINOX, EXPIRES, EXTNUM, FIELD, FIELDREF, FITS, GREF, GROUP, HREF, ID, INCLUSIVE, INFO, INVALID, LINK, MAX, MIN, NAME, NROWS, NULL, OPTION, PARAM, PARAMREF, PRECISION, REF, RESOURCE, RIGHTS, SAVOTPARSER, STREAM, SYSTEM, SYSTEM_ATTRIBUTE, TABLE, TABLEDATA, TD, TITLE, TR, TYPE, UCD, UNIT, UTYPE, VALUE, VALUES, VERSION, VOTABLE, WIDTH, XML, XMLNS, XMLNSXSI, XSI, XSI_NOSCHEMA, XSI_SCHEMA, XSINOSCHEMA, XSISCHEMA, XTYPE
-
-
Constructor Summary
Constructors Constructor Description SavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.io.InputStream instream, int mode, java.lang.String enc, boolean debug, SavotStatistics stats)ConstructorSavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.io.Reader reader, int mode, boolean debug, SavotStatistics stats)ConstructorSavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.lang.String file, int mode, boolean debug, SavotStatistics stats)ConstructorSavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.net.URL url, int mode, java.lang.String enc, boolean debug, SavotStatistics stats)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the input stream if still opened and free the internal parservoidenableDebug(boolean debug)Enable debug modeSavotVOTablegetAllResources()Get current VOTable (all resources)SavotCoosysgetCoosysFromRef(java.lang.String ref)Search a COOSYS corresponding to an ID refintgetDataCount()Get the number of DATA elements in the document (for statistics)SavotFieldgetFieldFromRef(java.lang.String ref)Search a FIELD corresponding to an ID refSavotFieldRefgetFieldRefFromRef(java.lang.String ref)Search a FIELDref corresponding to an ID refSavotGroupgetGroupFromRef(java.lang.String ref)Search a GROUP corresponding to an ID refjava.util.Map<java.lang.String,java.lang.Object>getIdRefLinks()Get a reference on the Hashtable containing the link between ID and refSavotInfogetInfoFromRef(java.lang.String ref)Search a RESOURCE corresponding to an ID refSavotLinkgetLinkFromRef(java.lang.String ref)Search a LINK corresponding to an ID refSavotResourcegetNextResource()Get the next Resource (warning : RESOURCEREAD mode only)SavotTRgetNextTR()Get the next TR (warning : ROWREAD mode only)SavotParamgetParamFromRef(java.lang.String ref)Search a PARAM corresponding to an ID refSavotParamRefgetParamRefFromRef(java.lang.String ref)Search a PARAMref corresponding to an ID refintgetResourceCount()Get the number of RESOURCE elements in the document (for statistics)SavotResourcegetResourceFromRef(java.lang.String ref)Search a RESOURCE corresponding to an ID refintgetTableCount()Get the number of TABLE elements in the document (for statistics)SavotTablegetTableFromRef(java.lang.String ref)Search a TABLE corresponding to an ID refintgetTRCount()Get the number of TR elements in the document (for statistics)SavotValuesgetValuesFromRef(java.lang.String ref)Search a VALUES corresponding to an ID refSavotVOTablegetVOTable()Get a reference to V0TABLE objectvoidparse(int parsingType)Parsing enginevoidreset()Reset of the engine before another parsing LBO: useless methods ?
-
-
-
Field Detail
-
FULL
public static final int FULL
FULL parsing mode: deprecated and replaced by FULLREAD- See Also:
- Constant Field Values
-
FULLREAD
public static final int FULLREAD
FULLREAD parsing mode all in memory- See Also:
- Constant Field Values
-
SEQUENTIAL
public static final int SEQUENTIAL
SEQUENTIAL parsing mode: deprecated and replaced by RESOURCEREAD- See Also:
- Constant Field Values
-
RESOURCEREAD
public static final int RESOURCEREAD
RESOURCEREAD parsing mode: row per row reading- See Also:
- Constant Field Values
-
ROWREAD
public static final int ROWREAD
ROWREAD parsing mode: row per row reading- See Also:
- Constant Field Values
-
DEFAULT_STACK_CAPACITY
public static final int DEFAULT_STACK_CAPACITY
default stack capacity = 4 slots- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SavotPullEngine
public SavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.lang.String file, int mode, boolean debug, SavotStatistics stats)Constructor- Parameters:
parser-file- a file to parsemode- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug-stats-
-
SavotPullEngine
public SavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.net.URL url, int mode, java.lang.String enc, boolean debug, SavotStatistics stats)Constructor- Parameters:
parser-url- url to parsemode- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)enc- encoding (example : UTF-8)debug-stats-
-
SavotPullEngine
public SavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.io.InputStream instream, int mode, java.lang.String enc, boolean debug, SavotStatistics stats)Constructor- Parameters:
parser-instream- stream to parsemode- FULL (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per TR for small memory size applications)enc- encoding (example : UTF-8)debug-stats-
-
SavotPullEngine
public SavotPullEngine(org.xmlpull.v1.XmlPullParser parser, java.io.Reader reader, int mode, boolean debug, SavotStatistics stats)Constructor- Parameters:
parser-reader- reader to parsemode- FULL (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per TR for small memory size applications)debug-stats-
-
-
Method Detail
-
close
public void close()
Close the input stream if still opened and free the internal parser
-
reset
public void reset()
Reset of the engine before another parsing LBO: useless methods ?
-
parse
public void parse(int parsingType) throws java.io.IOException, java.lang.ExceptionParsing engine- Parameters:
parsingType- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
java.io.IOExceptionjava.lang.Exception
-
getNextResource
public SavotResource getNextResource()
Get the next Resource (warning : RESOURCEREAD mode only)- Returns:
- a SavotResource (always NULL if other mode)
-
getNextTR
public SavotTR getNextTR()
Get the next TR (warning : ROWREAD mode only)- Returns:
- a SavotTR (always NULL if other mode)
-
getVOTable
public SavotVOTable getVOTable()
Get a reference to V0TABLE object- Returns:
- SavotVOTable
-
getResourceCount
public int getResourceCount()
Get the number of RESOURCE elements in the document (for statistics)- Returns:
- a long value
-
getTableCount
public int getTableCount()
Get the number of TABLE elements in the document (for statistics)- Returns:
- a long value
-
getTRCount
public int getTRCount()
Get the number of TR elements in the document (for statistics)- Returns:
- a long value
-
getDataCount
public int getDataCount()
Get the number of DATA elements in the document (for statistics)- Returns:
- a long value
-
getIdRefLinks
public java.util.Map<java.lang.String,java.lang.Object> getIdRefLinks()
Get a reference on the Hashtable containing the link between ID and ref- Returns:
- a refernce to the Hashtable
-
getResourceFromRef
public SavotResource getResourceFromRef(java.lang.String ref)
Search a RESOURCE corresponding to an ID ref- Parameters:
ref-- Returns:
- a reference to a SavotResource object
-
getFieldFromRef
public SavotField getFieldFromRef(java.lang.String ref)
Search a FIELD corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotField
-
getFieldRefFromRef
public SavotFieldRef getFieldRefFromRef(java.lang.String ref)
Search a FIELDref corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotFieldRef
-
getParamFromRef
public SavotParam getParamFromRef(java.lang.String ref)
Search a PARAM corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotParam
-
getParamRefFromRef
public SavotParamRef getParamRefFromRef(java.lang.String ref)
Search a PARAMref corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotParamRef
-
getTableFromRef
public SavotTable getTableFromRef(java.lang.String ref)
Search a TABLE corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotTable
-
getGroupFromRef
public SavotGroup getGroupFromRef(java.lang.String ref)
Search a GROUP corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotGROUP
-
getInfoFromRef
public SavotInfo getInfoFromRef(java.lang.String ref)
Search a RESOURCE corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotInfo
-
getValuesFromRef
public SavotValues getValuesFromRef(java.lang.String ref)
Search a VALUES corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotValues
-
getLinkFromRef
public SavotLink getLinkFromRef(java.lang.String ref)
Search a LINK corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotLink
-
getCoosysFromRef
public SavotCoosys getCoosysFromRef(java.lang.String ref)
Search a COOSYS corresponding to an ID ref- Parameters:
ref-- Returns:
- SavotCoosys
-
getAllResources
public SavotVOTable getAllResources()
Get current VOTable (all resources)- Returns:
- SavotVOTable
-
enableDebug
public void enableDebug(boolean debug)
Enable debug mode- Parameters:
debug- boolean
-
-