vgritsenko 2003/01/24 18:55:04 Modified: src/java/org/apache/cocoon/components/source XMLDBSourceFactory.java Log: conf is not null Revision Changes Path 1.9 +29 -37 xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSourceFactory.java Index: XMLDBSourceFactory.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/XMLDBSourceFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- XMLDBSourceFactory.java 17 Dec 2002 00:03:45 -0000 1.8 +++ XMLDBSourceFactory.java 25 Jan 2003 02:55:04 -0000 1.9 @@ -76,9 +76,8 @@ */ public final class XMLDBSourceFactory - extends AbstractLogEnabled - implements SourceFactory, Configurable, Composable { - + extends AbstractLogEnabled + implements SourceFactory, Configurable, Composable { /** The driver implementation class */ protected String driver; @@ -99,9 +98,7 @@ * Configure the instance. */ public void configure(final Configuration conf) - throws ConfigurationException { - - if (conf != null) { + throws ConfigurationException { driverMap = new HashMap(); credentialMap = new HashMap(); @@ -109,20 +106,15 @@ Configuration[] xmldbConfigs = conf.getChildren("driver"); for (int i = 0; i < xmldbConfigs.length; i++) { - SourceCredential credential = new SourceCredential(null, null); + SourceCredential credential = new SourceCredential(null, null); - driverMap.put(xmldbConfigs[i].getAttribute("type"), - xmldbConfigs[i].getAttribute("class")); + driverMap.put(xmldbConfigs[i].getAttribute("type"), + xmldbConfigs[i].getAttribute("class")); - credential.setPrincipal(xmldbConfigs[i].getAttribute("user", null)); - credential.setPassword(xmldbConfigs[i].getAttribute("password", null)); - credentialMap.put(xmldbConfigs[i].getAttribute("type"), credential); + credential.setPrincipal(xmldbConfigs[i].getAttribute("user", null)); + credential.setPassword(xmldbConfigs[i].getAttribute("password", null)); + credentialMap.put(xmldbConfigs[i].getAttribute("type"), credential); } - - } else { - throw new ConfigurationException("XMLDB configuration not found"); - } - } /** @@ -131,42 +123,42 @@ */ public void compose(ComponentManager cm) { - this.m_manager = cm; + this.m_manager = cm; } /** * Resolve the source */ public Source getSource(Environment environment, String location) - throws ProcessingException, IOException, MalformedURLException { + throws ProcessingException, IOException, MalformedURLException { - int start = location.indexOf(':') + 1; - int end = location.indexOf(':', start); + int start = location.indexOf(':') + 1; + int end = location.indexOf(':', start); - if (start == -1 || end == -1) { - throw new MalformedURLException("Mispelled XML:DB URL. " + - "The syntax is \"xmldb:databasetype://host/collection/resource\""); - } + if (start == -1 || end == -1) { + throw new MalformedURLException("Mispelled XML:DB URL. " + + "The syntax is \"xmldb:databasetype://host/collection/resource\""); + } - String type = location.substring(start, end); + String type = location.substring(start, end); - driver = (String)driverMap.get(type); - credential = (SourceCredential)credentialMap.get(type); + driver = (String)driverMap.get(type); + credential = (SourceCredential)credentialMap.get(type); - if (driver == null) { - throw new ProcessingException("Unable to find a driver for the \"" + - type + " \" database type, please check the configuration"); - } + if (driver == null) { + 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(), - driver, credential, location); + return new XMLDBSource(environment, m_manager, this.getLogger(), + driver, credential, location); } /** * Resolve the source */ public Source getSource(Environment environment, URL base, String location) - throws ProcessingException, IOException, MalformedURLException { - return getSource(environment, base.toExternalForm() + location); + throws ProcessingException, IOException, MalformedURLException { + return getSource(environment, base.toExternalForm() + location); } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]