if ( !super.init(imh, configDocString) ) {
return false;
}
XmlParseUtils xmlParseUtils = (XmlParseUtils) imh.getEntry(InitMapHolder.
XML_PARSE_UTILS);
FileUtils fileUtils = (FileUtils) imh.getEntry(InitMapHolder.FILE_UTILS);
Strings strings = new Strings();
// Get the db_utils config file and DTD.
configDocString = fileUtils.addRoot(configDocString);
String dbUtilsConfigDocString =
fileUtils.readFile(new File(configDocString));
String dbUtilsConfigDTDFile = fileUtils.addRoot("defs/db_utils_cfg.dtd");
// Add the DTD with root to the config file.
if (strings.matches(" SYSTEM\\s+\".+\"\\s*>",
dbUtilsConfigDocString)) {
dbUtilsConfigDocString = strings.getPreMatch() + " SYSTEM \"" +
dbUtilsConfigDTDFile + "\">" + strings.getPostMatch();
}
// Convert the config String to an Xml Document.
try {
this.dbUtilsConfigDoc = xmlParseUtils.convertStringToXmlDocument(
dbUtilsConfigDocString, true);
}
catch (SAXException e) {
errEntry.setThrowable(e);
errEntry.setAppContext("init()");
errEntry.setDocInfo(configDocString);
errEntry.setAppMessage("Error while parsing DbUtils config file.");
logger.logError(errEntry);
return false;
}
Element rootElem = dbUtilsConfigDoc.getDocumentElement();
Element contentFactElem = xmlParseUtils.getSingletonElement(rootElem,
"ContentFactoryClass");
Element contentPersistenceElem = xmlParseUtils.getSingletonElement(rootElem,
"ContentPersistenceClass");
String contentFactoryString = xmlParseUtils.getTextFromNode(contentFactElem).
trim();
Console.displayDev("CMSDbUtils",
"ContentFactory class: " + contentFactoryString, true,
"scb");
String contentPersistString = xmlParseUtils.getTextFromNode(
contentPersistenceElem).trim();
Console.displayDev("CMSDbUtils",
"Persistence class: " + contentPersistString, true,
"scb");