DbLoader Class Reference

The controller of CIF to DB data conversion process. More...

#include <CifSchemaMap.h>

Collaboration diagram for DbLoader:

Collaboration graph
[legend]
List of all members.

Public Types

enum  eConvOpt { eDATA_ONLY = 0, eDATA_WITH_SCRIPTS, eSCRIPTS_ONLY }

Public Member Functions

 DbLoader (SchemaMapping &schemaMapping, DbOutput &dbOutput, bool verbose=false, const string &workDir=String::Empty)
virtual ~DbLoader ()
void SetWorkDir (const string &workDir)
void AsciiFileToDb (const string &asciiFile, const eConvOpt convOpt)
void SerFileToDb (const string &serFile, const eConvOpt convOpt)
void FileObjToDb (CifFile &cifFile, const eConvOpt convOpt)

Static Public Member Functions

static unsigned int GetTableColumnIndex (const ISTable &isTable, const string &colName)

Private Member Functions

void _LoadBlock (Block &rBlock, Block &wBlock)
bool _Search (vector< vector< string > > &dMap, const unsigned int iAttr, ISTable *isTableP, const string &blockName, const vector< string > &cNameMap, const string &sItem, const string &sCnd, const string &sFnct)
void _DoFunc (vector< string > &s, const vector< string > &r, const string &sFnct)
void _OpenLog (const string &logName)
int _GetMapColumnIndex (const vector< string > &cNameMap, const string &vOf)
void _GetMapColumnValue (string &p, vector< vector< string > > &dMap, int iCol, int irow)
int _GetMapColumnLength (vector< vector< string > > &dMap, int iCol)
void _ReorderName (string &res, char *string, int mode)
void _ToUpperString (string &aString)
void _StripString (string &aString, int mode)
int _CheckNullRow (const vector< string > &row, const vector< ATTRIBINFO > &aI)
void Clear ()

Static Private Member Functions

static void CleanString (string &aString)

Private Attributes

string _workDir
string _INPUT_FILE
string _blockName
bool _verbose
ofstream _log
SchemaMapping_schemaMapping
DbOutput_dbOutput

Static Private Attributes

static const string _LOG_FILE

Detailed Description

The controller of CIF to DB data conversion process.

This class controls the conversion process of CIF data to DB loadable data. It provides methods for its construction/destruction, conversion of ASCII CIF files, conversion of serialized (binary) CIF files, conversion of in-memory CIF file objects, setting the working directory. Data conversion methods can be instructed to generate: only the data loading files, only the data loading shell scripts or both the data and scripts. DB server data loading is accomplished by executing the generated loading shell scripts, which utilize the data loading files, obtained during the conversion process.


Member Enumeration Documentation

enum DbLoader::eConvOpt

Enumerator:
eDATA_ONLY 
eDATA_WITH_SCRIPTS 
eSCRIPTS_ONLY 


Constructor & Destructor Documentation

DbLoader::DbLoader ( SchemaMapping schemaMapping,
DbOutput dbOutput,
bool  verbose = false,
const string &  workDir = String::Empty 
)

Constructs a CIF to DB controller object.

Parameters:
[in] schemaMapping - reference to the schema mapping object
[in] dbOutput - reference to the database output object
[in] verbose - optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not specified, logging is turned off.
[in] workDir - optional parameter that indicates the working directory in which the files will be placed. If workDir is not specified, current process working directory is used.
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None

DbLoader::~DbLoader (  )  [virtual]

Destructs a CIF to DB controller object.

Parameters:
 Not applicable
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None


Member Function Documentation

void DbLoader::SetWorkDir ( const string &  workDir  ) 

Sets the working directory in which the generated files will be placed.

Parameters:
[in] workDir - indicates the working directory in which the files will be placed.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void DbLoader::AsciiFileToDb ( const string &  asciiFile,
const eConvOpt  convOpt 
)

Converts an ASCII CIF file to DB loadable data with/without generating loading scripts. The specified file is first parsed and then converted.

Parameters:
[in] asciiFile - indicates the name of the ASCII CIF file, which is to be converted.
[in] convOpt - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void DbLoader::SerFileToDb ( const string &  serFile,
const eConvOpt  convOpt 
)

Converts a serialized (binary) CIF file to DB loadable data with/without generating loading scripts. The specified file is de-serialized (without the need to parse it) and converted.

Parameters:
[in] serFile - indicates the name of the serialized (binary) CIF file, which is to be converted.
[in] convOpt - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void DbLoader::FileObjToDb ( CifFile &  cifFile,
const eConvOpt  convOpt 
)

Converts an in-memory CIF file object to DB loadable data with/without generating loading scripts.

Parameters:
[in] cifFile - a reference to the in-memory CIF file object, which is to be converted.
[in] convOpt - indicates data conversion options: generate data only, generate data with loading scripts, generate loading scripts only.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

unsigned int DbLoader::GetTableColumnIndex ( const ISTable &  isTable,
const string &  colName 
) [static]

Utility method, not part of users public API.

void DbLoader::_LoadBlock ( Block &  rBlock,
Block &  wBlock 
) [private]

bool DbLoader::_Search ( vector< vector< string > > &  dMap,
const unsigned int  iAttr,
ISTable *  isTableP,
const string &  blockName,
const vector< string > &  cNameMap,
const string &  sItem,
const string &  sCnd,
const string &  sFnct 
) [private]

void DbLoader::_DoFunc ( vector< string > &  s,
const vector< string > &  r,
const string &  sFnct 
) [private]

void DbLoader::_OpenLog ( const string &  logName  )  [private]

int DbLoader::_GetMapColumnIndex ( const vector< string > &  cNameMap,
const string &  vOf 
) [private]

void DbLoader::_GetMapColumnValue ( string &  p,
vector< vector< string > > &  dMap,
int  iCol,
int  irow 
) [private]

int DbLoader::_GetMapColumnLength ( vector< vector< string > > &  dMap,
int  iCol 
) [private]

void DbLoader::_ReorderName ( string &  res,
char *  string,
int  mode 
) [private]

void DbLoader::_ToUpperString ( string &  aString  )  [private]

void DbLoader::_StripString ( string &  aString,
int  mode 
) [private]

int DbLoader::_CheckNullRow ( const vector< string > &  row,
const vector< ATTRIBINFO > &  aI 
) [private]

void DbLoader::CleanString ( string &  aString  )  [static, private]

void DbLoader::Clear (  )  [private]


Member Data Documentation

const string DbLoader::_LOG_FILE [static, private]

string DbLoader::_workDir [private]

string DbLoader::_INPUT_FILE [private]

string DbLoader::_blockName [private]

bool DbLoader::_verbose [private]

ofstream DbLoader::_log [private]

SchemaMapping& DbLoader::_schemaMapping [private]

DbOutput& DbLoader::_dbOutput [private]


The documentation for this class was generated from the following files:
Generated on Fri Feb 8 10:24:43 2008 for db-loader-v4.0 by  doxygen 1.5.1