* getCollection method is called.
*/
public DatabaseImpl()
throws FileNotFoundException,
XindiceException {
Configuration config;
String configFile = System.getProperty(Xindice.PROP_XINDICE_CONFIGURATION);
if (configFile != null && !configFile.equals("")) {
if (log.isInfoEnabled()) {
log.info("Specified configuration file: '" + configFile + "'");
}
FileInputStream configXMLFile = new FileInputStream(new File(configFile));
config = new Configuration(DOMParser.toDocument(configXMLFile), false);
}
else {
if (log.isInfoEnabled()) {
log.info("No configuration file specified, going with the default configuration");
}
config = new Configuration(DOMParser.toDocument(Xindice.DEFAULT_CONFIGURATION), false);
}
config = config.getChild("root-collection", false);
/* First try to find an existing Database by name. If it doesn't exist,
* we create one and in both cases we configure them with the current
* configuration */
String dbname = config.getAttribute(Database.NAME);
this.db = Database.getDatabase(dbname);
if (this.db == null) {
this.db = new Database();
}