com.ibm.etools.pd.widget.viewer
Class CommonDataRetriever

java.lang.Object
  |
  +--com.ibm.etools.pd.widget.viewer.DOMDataRetriever
        |
        +--com.ibm.etools.pd.widget.viewer.CommonDataRetriever
All Implemented Interfaces:
IDataInputConstants, IDataInputProcessingExceptionCodes, java.io.Serializable
Direct Known Subclasses:
MeterDataRetriever, PieChartDataRetriever, XYChartDataRetriever

public class CommonDataRetriever
extends DOMDataRetriever
implements IDataInputProcessingExceptionCodes, IDataInputConstants

Common data retrieval methods which retrieve data of interest to SVGLineChart, SVGBarChart, SVGStackBarChart, SVGPieChart and SVGMeter from documents which conform to the documented data input schemas.

See Also:
Serialized Form

Field Summary
protected  org.w3c.dom.Document configDocument
          Document containing configuration data.
protected  org.w3c.dom.Document dataDocument
          Document containing data update.
 
Fields inherited from interface com.ibm.etools.pd.widget.viewer.IDataInputProcessingExceptionCodes
CATEGORY_ID_MISMATCH, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT, MAXIMUM_NUMBER_OF_SEGMENT_MARKERS_EXCEEDED, MISSING_CATEGORY_IDS_OR_DATAPOINT_VALUES, MISSING_CATEGORY_NAMES, MISSING_IDS_OR_POSITIONS, MISSING_NAMES_OR_POSITIONS, MISSING_PERCENTAGE_OF_DATAPOINT_TOTAL_OR_POSITION, MISSING_PERCENTAGES, MISSING_TOTALS, MISSING_TOTALS_OR_POSITIONS, MISSING_VALUES_OR_POSITIONS, NO_CONTEXT_FOUND, NO_DATA_DOCUMENT, NO_DATASETS_FOUND, NO_DESCRIPTION_FOUND, NO_IDS_FOUND, NO_NAMES_FOUND, NO_PERCENTAGE_OF_DATAPOINT_TOTAL_FOUND, NO_SUMMARY_FOUND, NO_TIMESTAMP_FOUND, NO_TOTALS_FOUND, NO_VALUE_FOUND, NO_VALUES_FOUND, POSITION_NUMBER_OUT_OF_BOUNDS
 
Fields inherited from interface com.ibm.etools.pd.widget.viewer.IDataInputConstants
ACTUAL_RATE, CATEGORIZATION, CATEGORY, CONFIGURATION, CONTEXT, DATAPOINT, DATASET, DATAUPDATE, DESCRIPTION, EMPTY_STRING, FONT, HEIGHT, ID, LEGEND_TITLE, MAXVALUE, MINVALUE, NAME, PERCENTAGE_OF_DATAPOINT_TOTAL, POSITION, RANGE, RATE_DEFINITION, SEGMENT_MARKER, SUMMARY, SUPPRESS_LEGEND, TIMESTAMP, TIMESTAMP_PREFIX, TITLE, TOTAL, TOTAL_TITLE, VALUE, VALUE_TITLE, WIDTH, X_TITLE, Y_TITLE
 
Method Summary
 java.lang.String[] getCategories()
          Returns the array of values which comprise the categories into which the data are assigned.
 java.lang.String[] getCategoryIds()
          Returns an array of values, each of which uniquely identifies a category.
 java.lang.String[] getCategoryTotals()
          Returns the array of values, each of which represents the sum of the data values within a category.
 java.util.Hashtable getConfigurationAttributes()
          Returns the configuration attributes and values (if any) found in the configuration document.
 java.lang.String[] getDatapointValuesFromDatasetWithPosition(java.lang.String position)
          Returns the array of data values for the data set with the specified position from the data document.
 java.lang.String[] getDatapointValuesFromFirstDataset()
          Returns the array of data values from the first data set found in the data document.
 java.lang.String[] getLegendLabels()
          Returns the ordered array of values found in the data document which comprise the legend.
 int getNumberOfDatasets()
          Returns the number of data sets found in the data document.
 java.lang.String[] getRangeMarkers()
          Returns the array of values which mark the segments into which the data range is divided.
 java.lang.String getTimestamp()
          Returns the timestamp found in the data document.
 void setConfigDocument(org.w3c.dom.Document newConfigDocument)
          Sets the document which contains the configuration data.
 void setDataDocument(org.w3c.dom.Document newDataDocument)
          Sets the document which contains the data update and may contain configuration data; however,only in the event that configDocument is null will configuration data be retrieved from this document.
protected  void throwException(short code, java.lang.String element)
          Convenience method for throwing exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configDocument

protected org.w3c.dom.Document configDocument
Document containing configuration data.


dataDocument

protected org.w3c.dom.Document dataDocument
Document containing data update. May also contain configuration data.

Method Detail

setConfigDocument

public void setConfigDocument(org.w3c.dom.Document newConfigDocument)
Sets the document which contains the configuration data. Configuration-related data is retrieved only from this document.

Parameters:
newConfigDocument - the configuration data document

setDataDocument

public void setDataDocument(org.w3c.dom.Document newDataDocument)
Sets the document which contains the data update and may contain configuration data; however,only in the event that configDocument is null will configuration data be retrieved from this document.

Parameters:
newDataDocument - the document providing data updates

getNumberOfDatasets

public int getNumberOfDatasets()
                        throws DataInputProcessingException
Returns the number of data sets found in the data document.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_DATASETS_FOUND.

getConfigurationAttributes

public java.util.Hashtable getConfigurationAttributes()
                                               throws DataInputProcessingException
Returns the configuration attributes and values (if any) found in the configuration document.

Throws:
DataInputProcessingException - for code NO_DATA_DOCUMENT.

getLegendLabels

public java.lang.String[] getLegendLabels()
                                   throws DataInputProcessingException
Returns the ordered array of values found in the data document which comprise the legend. Values can be ordered by specifying their ordinal position; otherwise, the retrieved (document) order is used.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_NAMES_FOUND, MISSING_NAMES_OR_POSITIONS, POSITION_NUMBER_OUT_OF_BOUNDS, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT

getTimestamp

public java.lang.String getTimestamp()
                              throws DataInputProcessingException
Returns the timestamp found in the data document.

Throws:
DataInputProcessingException - for code NO_DATA_DOCUMENT, NO_TIMESTAMP_FOUND.

getRangeMarkers

public java.lang.String[] getRangeMarkers()
                                   throws DataInputProcessingException
Returns the array of values which mark the segments into which the data range is divided.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_VALUES_FOUND, MISSING_VALUES_OR_POSITIONS, POSITION_NUMBER_OUT_OF_BOUNDS, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT

getCategories

public java.lang.String[] getCategories()
                                 throws DataInputProcessingException
Returns the array of values which comprise the categories into which the data are assigned.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_NAMES_FOUND, MISSING_NAMES_OR_POSITIONS, POSITION_NUMBER_OUT_OF_BOUNDS, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT

getCategoryIds

public java.lang.String[] getCategoryIds()
                                  throws DataInputProcessingException
Returns an array of values, each of which uniquely identifies a category. These identifiers are used to map data values to the categories to which they have been assigned.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_IDS_FOUND, MISSING_IDS_OR_POSITIONS, POSITION_NUMBER_OUT_OF_BOUNDS, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT

getCategoryTotals

public java.lang.String[] getCategoryTotals()
                                     throws DataInputProcessingException
Returns the array of values, each of which represents the sum of the data values within a category.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_TOTALS_FOUND, MISSING_TOTALS_OR_POSITIONS, POSITION_NUMBER_OUT_OF_BOUNDS, DUPLICATE_POSITION_NUMBER, INVALID_NUMBER_FORMAT

getDatapointValuesFromDatasetWithPosition

public java.lang.String[] getDatapointValuesFromDatasetWithPosition(java.lang.String position)
                                                             throws DataInputProcessingException
Returns the array of data values for the data set with the specified position from the data document.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_VALUES_FOUND, NO_IDS_FOUND, MISSING_CATEGORY_IDS_OR_DATAPOINT_VALUES, CATEGORY_ID_MISMATCH, INVALID_NUMBER_FORMAT

getDatapointValuesFromFirstDataset

public java.lang.String[] getDatapointValuesFromFirstDataset()
                                                      throws DataInputProcessingException
Returns the array of data values from the first data set found in the data document.

Throws:
DataInputProcessingException - for codes NO_DATA_DOCUMENT, NO_VALUES_FOUND, NO_IDS_FOUND, MISSING_CATEGORY_IDS_OR_DATAPOINT_VALUES, CATEGORY_ID_MISMATCH, INVALID_NUMBER_FORMAT

throwException

protected void throwException(short code,
                              java.lang.String element)
                       throws DataInputProcessingException
Convenience method for throwing exceptions.

DataInputProcessingException