DataImportXmlParser Class Reference

This class will parse a Data Import XML configuration file using a SAX like parsing algorithm based on the expat parser. More...

Inherits ExpatEvtHandler, and IDataImport.

Inheritance diagram for DataImportXmlParser:

Inheritance graph
[legend]
Collaboration diagram for DataImportXmlParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DataImportXmlParser ()
virtual ~DataImportXmlParser ()
void setXMLInputFile (const std::string &inputFile)
 Sets the input file to parse.
std::string getXMLInputFile ()
 returns the XML File that this importer is using
void OnStartElement (const XML_Char *name, const XML_Char **attrs)
 Called when the beginning of an element is found.
void OnEndElement (const XML_Char *name)
 Called the the end of an element is encountered.
void setOutputFilePath (std::string outputFilePath)
std::string getOutputFilePath ()
void setDeleteExistingDataFile (std::string deleteExistingDataFile)
 Sets the OverWriteDataFile property.
std::string getDeleteExistingDataFile ()
 returns the OverWriteDataFile property
void setDataFile (IDataFile::Pointer dataModel)
IDataFile::Pointer getDataFile ()
void setDataSources (IDataSource::Collection &datasources)
IDataSource::Collection getDataSources ()
void addDataSource (IDataSource::Pointer dataSource)
int32 parseXMLFile ()
 Does the actual work of parsing the xml file and creating all the datasources for the import.
int32 import ()
 Imports the data into the data file.
 MXA_INSTANCE_PROPERTY (bool, Verbose, _verbose)

Private Member Functions

 DataImportXmlParser (const DataImportXmlParser &)
void operator= (const DataImportXmlParser &)
void _createDataSource (std::string pathTemplate, std::vector< IDataDimension * >::size_type index, std::vector< int > &dimVals)
void _createDataSource2 ()
void getCurrentImportDelegateProperties (IImportDelegate::Pointer importDelegatePtr)
void start_Data_Dimensions_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Data_Dimensions' tag is found.
void end_Data_Dimensions_Tag (const XML_Char *name)
 Method that will be called when the 'Data_Dimensions' tag is Exited.
void start_Data_Import_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Data_Import' tag is found.
void end_Data_Import_Tag (const XML_Char *name)
 Method that will be called when the 'Data_Import' tag is Exited.
void start_Data_Model_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Data_Model' tag is found.
void end_Data_Model_Tag (const XML_Char *name)
 Method that will be called when the 'Data_Model' tag is Exited.
void start_Dimension_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Dimension' tag is found.
void end_Dimension_Tag (const XML_Char *name)
 Method that will be called when the 'Dimension' tag is Exited.
void start_Explicit_Data_Source_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Explicit_Data_Source' tag is found.
void end_Explicit_Data_Source_Tag (const XML_Char *name)
 Method that will be called when the 'Explicit_Data_Source' tag is Exited.
void start_File_Path_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'File_Path' tag is found.
void end_File_Path_Tag (const XML_Char *name)
 Method that will be called when the 'File_Path' tag is Exited.
void start_Implicit_Data_Source_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Implicit_Data_Source' tag is found.
void end_Implicit_Data_Source_Tag (const XML_Char *name)
 Method that will be called when the 'Implicit_Data_Source' tag is Exited.
void start_Index_Part_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Index_Part' tag is found.
void end_Index_Part_Tag (const XML_Char *name)
 Method that will be called when the 'Index_Part' tag is Exited.
void start_Output_File_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Output_File' tag is found.
void end_Output_File_Tag (const XML_Char *name)
 Method that will be called when the 'Output_File' tag is Exited.
void start_Text_Part_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Text_Part' tag is found.
void end_Text_Part_Tag (const XML_Char *name)
 Method that will be called when the 'Text_Part' tag is Exited.
void start_Import_Property_Tag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'Text_Part' tag is found.
void end_Import_Property_Tag (const XML_Char *name)
 Method that will be called when the 'Text_Part' tag is Exited.
void onSupportFilesStartTag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'UserMetaData' tag is found.
void onSupportFileStartTag (const XML_Char *name, const XML_Char **attrs)
 Method that will be called when the 'UserMetaData' tag is found.
void onSupportFilesEndTag (const XML_Char *name)
 Method that will be called when the 'Support_Files' tag is Exited.
void onSupportFileEndTag (const XML_Char *name)
 Method that will be called when the 'Support_File' tag is Exited.
int32 _loadDataModelFromTemplateFile (const std::string &modelFile)
 Loads the data model from an xml file or HDF5 file.
int32 _mergeModelToDisk ()
 Merges the Model in memory to the model resident on disk.

Private Attributes

std::string _xmlFilename
std::string _outputFilePath
std::string _deleteExistingDataFile
IDataFile::Pointer _dataFile
IDataModel::Pointer _dataModel
IDataSource::Collection _dataSources
int32 _xmlParseError
bool _parseData
std::string _errorMessage
ExpatParser_parser
std::vector< IDataDimension::Pointer > _implDataDimensions
std::map< IDataDimension::Pointer,
IStringSection::Pointer > 
_implPathMap
IDataRecord::Pointer _implDataRecord
std::string _implSourceType
std::string _implPreTextSection
XMLAttributeMapPtr _curImportPropertyMap

Detailed Description

This class will parse a Data Import XML configuration file using a SAX like parsing algorithm based on the expat parser.

Author:
Mike Jackson
Date:
Sept 2007
Version:
Revision
1.2


Constructor & Destructor Documentation

DataImportXmlParser::DataImportXmlParser (  ) 

DataImportXmlParser::~DataImportXmlParser (  )  [virtual]

DataImportXmlParser::DataImportXmlParser ( const DataImportXmlParser  )  [private]


Member Function Documentation

void DataImportXmlParser::setXMLInputFile ( const std::string &  inputFile  )  [inline]

Sets the input file to parse.

Parameters:
inputFile The path to an xml file

std::string DataImportXmlParser::getXMLInputFile (  )  [inline]

returns the XML File that this importer is using

void DataImportXmlParser::OnStartElement ( const XML_Char *  name,
const XML_Char **  attrs 
) [virtual]

Called when the beginning of an element is found.

Parameters:
name The name of the element
attrs The attributes of the element

Reimplemented from ExpatEvtHandler.

void DataImportXmlParser::OnEndElement ( const XML_Char *  name  )  [virtual]

Called the the end of an element is encountered.

Parameters:
name The name of the element that is ending

Reimplemented from ExpatEvtHandler.

void DataImportXmlParser::setOutputFilePath ( std::string  outputFilePath  ) 

Set the value of m_outputFilePath

Parameters:
outputFilePath the new value of m_outputFilePath

std::string DataImportXmlParser::getOutputFilePath (  ) 

Get the value of m_outputFilePath

Returns:
the value of m_outputFilePath

void DataImportXmlParser::setDeleteExistingDataFile ( std::string  deleteExistingDataFile  ) 

Sets the OverWriteDataFile property.

std::string DataImportXmlParser::getDeleteExistingDataFile (  ) 

returns the OverWriteDataFile property

Returns:
The value of the OverWriteDataFile property

void DataImportXmlParser::setDataFile ( IDataFile::Pointer  dataModel  )  [virtual]

Set the value of m_dataModel

Parameters:
dataModel the new value of m_dataModel

Implements IDataImport.

IDataFile::Pointer DataImportXmlParser::getDataFile (  )  [virtual]

Get the value of m_dataModel

Returns:
the value of m_dataModel

Implements IDataImport.

void DataImportXmlParser::setDataSources ( IDataSource::Collection datasources  )  [virtual]

Set the value of m_dataSources

Parameters:
datasources the new value of m_dataSources

Implements IDataImport.

IDataSource::Collection DataImportXmlParser::getDataSources (  )  [virtual]

Get the value of m_dataSources

Returns:
the value of m_dataSources

Implements IDataImport.

void DataImportXmlParser::addDataSource ( IDataSource::Pointer  dataSource  )  [virtual]

Parameters:
dataSource The datasource to add to the list

Implements IDataImport.

int DataImportXmlParser::parseXMLFile (  ) 

Does the actual work of parsing the xml file and creating all the datasources for the import.

Returns:
Error condition

int32 DataImportXmlParser::import (  )  [virtual]

Imports the data into the data file.

Returns:
Error Condition. Zero or Positive is Success

Implements IDataImport.

DataImportXmlParser::MXA_INSTANCE_PROPERTY ( bool  ,
Verbose  ,
_verbose   
)

void DataImportXmlParser::operator= ( const DataImportXmlParser  )  [private]

void DataImportXmlParser::_createDataSource ( std::string  pathTemplate,
std::vector< IDataDimension * >::size_type  index,
std::vector< int > &  dimVals 
) [private]

void DataImportXmlParser::_createDataSource2 (  )  [private]

void DataImportXmlParser::getCurrentImportDelegateProperties ( IImportDelegate::Pointer  importDelegatePtr  )  [private]

void DataImportXmlParser::start_Data_Dimensions_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Data_Dimensions' tag is found.

void DataImportXmlParser::end_Data_Dimensions_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Data_Dimensions' tag is Exited.

void DataImportXmlParser::start_Data_Import_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Data_Import' tag is found.

void DataImportXmlParser::end_Data_Import_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Data_Import' tag is Exited.

void DataImportXmlParser::start_Data_Model_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Data_Model' tag is found.

void DataImportXmlParser::end_Data_Model_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Data_Model' tag is Exited.

void DataImportXmlParser::start_Dimension_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Dimension' tag is found.

void DataImportXmlParser::end_Dimension_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Dimension' tag is Exited.

void DataImportXmlParser::start_Explicit_Data_Source_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Explicit_Data_Source' tag is found.

void DataImportXmlParser::end_Explicit_Data_Source_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Explicit_Data_Source' tag is Exited.

void DataImportXmlParser::start_File_Path_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'File_Path' tag is found.

void DataImportXmlParser::end_File_Path_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'File_Path' tag is Exited.

void DataImportXmlParser::start_Implicit_Data_Source_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Implicit_Data_Source' tag is found.

void DataImportXmlParser::end_Implicit_Data_Source_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Implicit_Data_Source' tag is Exited.

void DataImportXmlParser::start_Index_Part_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Index_Part' tag is found.

void DataImportXmlParser::end_Index_Part_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Index_Part' tag is Exited.

void DataImportXmlParser::start_Output_File_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Output_File' tag is found.

void DataImportXmlParser::end_Output_File_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Output_File' tag is Exited.

void DataImportXmlParser::start_Text_Part_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Text_Part' tag is found.

void DataImportXmlParser::end_Text_Part_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Text_Part' tag is Exited.

void DataImportXmlParser::start_Import_Property_Tag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'Text_Part' tag is found.

void DataImportXmlParser::end_Import_Property_Tag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Text_Part' tag is Exited.

void DataImportXmlParser::onSupportFilesStartTag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'UserMetaData' tag is found.

void DataImportXmlParser::onSupportFileStartTag ( const XML_Char *  name,
const XML_Char **  attrs 
) [private]

Method that will be called when the 'UserMetaData' tag is found.

void DataImportXmlParser::onSupportFilesEndTag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Support_Files' tag is Exited.

void DataImportXmlParser::onSupportFileEndTag ( const XML_Char *  name  )  [private]

Method that will be called when the 'Support_File' tag is Exited.

int DataImportXmlParser::_loadDataModelFromTemplateFile ( const std::string &  modelFile  )  [private]

Loads the data model from an xml file or HDF5 file.

Parameters:
modelFile The xml or HDF5 file
Returns:
Error condition

int32 DataImportXmlParser::_mergeModelToDisk (  )  [private]

Merges the Model in memory to the model resident on disk.


Member Data Documentation

std::string DataImportXmlParser::_xmlFilename [private]

std::string DataImportXmlParser::_outputFilePath [private]

std::string DataImportXmlParser::_deleteExistingDataFile [private]

IDataFile::Pointer DataImportXmlParser::_dataFile [private]

IDataModel::Pointer DataImportXmlParser::_dataModel [private]

IDataSource::Collection DataImportXmlParser::_dataSources [private]

int32 DataImportXmlParser::_xmlParseError [private]

bool DataImportXmlParser::_parseData [private]

std::string DataImportXmlParser::_errorMessage [private]

ExpatParser* DataImportXmlParser::_parser [private]

std::vector<IDataDimension::Pointer> DataImportXmlParser::_implDataDimensions [private]

std::map<IDataDimension::Pointer, IStringSection::Pointer> DataImportXmlParser::_implPathMap [private]

IDataRecord::Pointer DataImportXmlParser::_implDataRecord [private]

std::string DataImportXmlParser::_implSourceType [private]

std::string DataImportXmlParser::_implPreTextSection [private]

XMLAttributeMapPtr DataImportXmlParser::_curImportPropertyMap [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:11 2009 for MXADataModel by  doxygen 1.5.2