public Source getSource(Environment environment,
String location) throws MalformedURLException, IOException, ProcessingException {
int start = location.indexOf(':") + 1;
int end = location.indexOf(':", start);
if (start == -1 || end == -1) {
if (this.getLogger().isWarnEnabled()) {
this.getLogger().warn("Mispelled XML:DB URL. " +
"The syntax is \"xmldb:databasetype://host/collection/resource\"");
throw new MalformedURLException("Mispelled XML:DB URL. " +
"The syntax is \"xmldb:databasetype://host/collection/resource\"");
}
}
String type = location.substring(start, end);
driver = (String)driverMap.get(type);
if (driver == null) {
this.getLogger().error("Unable to find a driver for the \"" +
type + " \" database type, please check the configuration");
throw new ProcessingException("Unable to find a driver for the \"" +
type + " \" database type, please check the configuration");
}
return new XMLDBSource(environment, m_manager, this.getLogger(), location);
}
|