|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.data.VoidData
com.davisor.data.stream.JoinedDataBuffer
com.davisor.graphics.chart.ChartXMLDataBuffer
ChartXMLDataBuffer implements a SAX document handler that can read and combine chart data from a XML document and an external data source. In particular, if an external non-XML data source is supplied, it provides the data for data columns that are only declared in the XML document.
The XML syntax this handler accepts is described in a separate Chart XML reference document. The XML attributes this handler manipulates are further described in a separate attribute reference document.
ChartXMLDataBuffer will pack the read data into a number of DataBuffer objects that will hold channel attribute information in
addition to the actual data.
DataStream
External data sources are consumed and buffered at construction time. The source SQL result set, in particular, may then be disposed, while its data now can be read and re-read as many times as necessary.
The pairing of external data source columns and XML document
columns is based on their identities. The identity of JDBC database
columns is given by their column names, dug out from JDBC
metadata. The identity of DataStream columns is defined by
their TupleType member identities. Both of these identities
are matched against the id attributes in XML groups
and columns. If a match is found, the data in the external data
source replaces entirely any data given in the XML document for
that column. The column XML attributes and data type are however
still applied to the data.
Column identities are validated in endDocument() method.
The validation process will generate an unique identity for
any column that either does not already have one, or that has an
identity that conflicts with another column.
Chart attributes may assosiate channel attributes to data channels at chart generation time. The assosiation is based on channel identities. Such channel attribute identity references to columns that had conflicting identity will not therefore obviously work.
startElement(String,AttributeList),
ChannelAttributes,
ChartData| Field Summary | |
static int |
COLUMN
|
static int |
DATA
|
static int |
DATAFORMAT
|
static int |
DATATYPE
|
static boolean |
DEBUG
|
static int |
ELEMENT
|
static int |
ELEMENT_SHORT
|
static int |
FORMAT
|
static int |
GROUP
|
static int |
ID
|
static com.davisor.core.Index |
INDEXES
|
protected java.util.List |
M_columnIDs
Column ids during parsing. |
protected java.util.List |
M_columns
Column list during parsing. |
protected java.net.URL |
M_context
Context URL for textures and images. |
protected java.util.Map |
M_databaseColumns
Supplemental database columns (if given). |
protected java.lang.String[] |
M_databaseNames
Database column names (if given). |
protected java.util.Map |
M_jspAttributesMap
Map containing attributes from the jsp page context |
static int |
META
|
static int |
NAME
|
static int |
SEPARATOR
|
static int |
SQLCOLUMNINDEX
|
static int |
SQLCOLUMNNAME
|
protected static java.lang.String[] |
TAGS
|
static int |
TYPE
|
static int |
VALUE
|
static int |
VALUES
|
static java.lang.String |
XMLDATABUFFER_METADATA
Needed to pass information from data source to lazylistdatabuffer |
| Fields inherited from class com.davisor.data.stream.JoinedDataBuffer |
bufferMetaData, M_buffers, M_size |
| Fields inherited from class com.davisor.data.VoidData |
M_type |
| Constructor Summary | |
ChartXMLDataBuffer(java.net.URL context)
Creates a new chart data buffer that can be initialized from the XML document by using ChartXMLDocumentHandler. |
|
ChartXMLDataBuffer(java.net.URL context,
java.util.Map attributes)
Creates a new chart data buffer that can be initialized from the XML document by using ChartXMLDocumentHandler. |
|
| Method Summary | |
protected java.util.Map |
attributeListToMap(org.xml.sax.AttributeList atts)
Converts SAX1 AttributeList to Map object |
void |
characters(char[] ch,
int start,
int length)
Appends a bundle of characters into current text accumulation buffer. |
protected void |
endColumn()
Handles the end of a column. |
void |
endDocument()
Handles the end of a XML document. |
protected void |
endElement()
Handles the end of a data element. |
void |
endElement(java.lang.String name)
Handles the end of a XML element. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
Handles the end of a XML element in SAX2 compliant way. |
protected void |
endGroup()
Handles the end of a column group. |
void |
endPrefixMapping(java.lang.String prefix)
End the scope of a prefix-URI mapping in SAX2 compliant way. |
java.net.URL |
getContext()
Returns the context for textures and images. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Handles ignorable white space (which is ignored). |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Handles processing instructions (which are ignored). |
void |
setContext(java.net.URL context)
Sets the context for textures and images for the given context. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Sets the custom document locator (ignored). |
void |
skippedEntity(java.lang.String name)
Receive notification of a skipped entity in SAX2 compliant way. |
protected void |
startColumn(org.xml.sax.AttributeList atts)
Handles the start of a column. |
void |
startDocument()
Handles the start of a XML document. |
protected void |
startElement(org.xml.sax.AttributeList atts)
Handles the start of a data element. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
Handles the start of a XML element. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes atts)
Handles the end of a XML element in SAX2 compliant way. |
protected void |
startGroup(org.xml.sax.AttributeList atts)
Handles the start of a column group. |
protected void |
startMeta(org.xml.sax.AttributeList atts)
Handles the start of a meta data. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Begin the scope of a prefix-URI Namespace mapping in SAX2 compliant way. |
| Methods inherited from class com.davisor.data.stream.JoinedDataBuffer |
assosiateListsWithTypes, close, getBuffers, getData, getSize, getStream, getStream, init, resolveSizeAndType, toString, toString |
| Methods inherited from class com.davisor.data.VoidData |
equals, getDataValue, getType, hashCode, setType |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
| Field Detail |
public static final int COLUMN
public static final int GROUP
public static final int ELEMENT
public static final int ELEMENT_SHORT
public static final int TYPE
public static final int ID
public static final int SQLCOLUMNNAME
public static final int SQLCOLUMNINDEX
public static final int NAME
public static final int DATAFORMAT
public static final int DATATYPE
public static final int VALUES
public static final int SEPARATOR
public static final int DATA
public static final int FORMAT
public static final int META
public static final int VALUE
protected static final java.lang.String[] TAGS
public static final com.davisor.core.Index INDEXES
protected java.net.URL M_context
protected java.util.Map M_jspAttributesMap
protected java.util.Map M_databaseColumns
protected java.lang.String[] M_databaseNames
protected java.util.List M_columns
protected java.util.List M_columnIDs
public static final java.lang.String XMLDATABUFFER_METADATA
public static final boolean DEBUG
| Constructor Detail |
public ChartXMLDataBuffer(java.net.URL context)
context - an URL context for textures and images (may be null)
public ChartXMLDataBuffer(java.net.URL context,
java.util.Map attributes)
context - an URL context for textures and images (may be null)attributes - map originating from outside (may be null)| Method Detail |
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
throws org.xml.sax.SAXException
endColumn()
endElement(java.lang.String, java.lang.String, java.lang.String)
endGroup()
endElement in interface org.xml.sax.ContentHandlernamespaceURI - element namespace identifier (may be empty)localName - element local name (may be empty)qualifiedName - element qualified name (may be empty)
org.xml.sax.SAXExceptionendElement(String)
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
endPrefixMapping in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startColumn(org.xml.sax.AttributeList)
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
startGroup(org.xml.sax.AttributeList)
startElement in interface org.xml.sax.ContentHandlernamespaceURI - element namespace identifier (may be empty)localName - element local name (may be empty)qualifiedName - element qualified name (may be empty)atts - element attributes (may be empty)
org.xml.sax.SAXExceptionstartElement(String,AttributeList)
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXExceptionJoinedDataBuffer.init(java.lang.String, java.util.List, java.util.List, boolean)
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXExceptionpublic void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator in interface org.xml.sax.ContentHandler
public void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException
public void endElement(java.lang.String name)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.DocumentHandlername - element to be ended
org.xml.sax.SAXExceptionstartElement(String, AttributeList),
endElement(String, String, String)
public void startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.DocumentHandlername - element to be startedatts - attributes for the element
org.xml.sax.SAXExceptionendElement(String),
startElement(String, String, String, org.xml.sax.Attributes)protected java.util.Map attributeListToMap(org.xml.sax.AttributeList atts)
protected void endColumn()
Alternatively, if a database column with matching column identity is available, data is taken from it.
Finally, the new data column is added into current column group, if available, or among the top-level columns.
startColumn(org.xml.sax.AttributeList)protected void endElement()
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)protected void endGroup()
The new group will be stored into a JoinedDataBuffer
object, that contains all columns from the current group, all
their member spesific attributes, and all group attributes common
to all members. In particular, all member attributes will be
added as sub-channel attributes to the group attributes.
startGroup(org.xml.sax.AttributeList),
JoinedDataBuffer
protected void startColumn(org.xml.sax.AttributeList atts)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionendColumn()protected void startElement(org.xml.sax.AttributeList atts)
If current data buffer is active and non-empty at the moment this method is called, the current content of that buffer is treated as out-of-element body content. If so, all preceding and trailing white space is first removed from the biffer. The remaining buffer content is then expected to contain a series data elements, separated by current column data separator character. If so, these element are stored into current data column now.
For example, in the following case, column separator is white
space, and the elements "a", "b", and "cd" will be added to data
colum, now, and " e f " later when endElement is
invoked. Please note, that the whole content of element tag is
treated as the element value, in contrary to out-of-element data,
that first trims and then slices the content.
a b cd e f
endElement()protected void startGroup(org.xml.sax.AttributeList atts)
protected void startMeta(org.xml.sax.AttributeList atts)
public java.net.URL getContext()
setContext(java.net.URL)public void setContext(java.net.URL context)
getContext()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||