|
From: <tr...@us...> - 2003-06-27 02:06:02
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config In directory sc8-pr-cvs1:/tmp/cvs-serv31771/src/com/babeldoc/sql/config Modified Files: SqlConfig.java SqlConfigService.java SqlConfigurationLoader.java Log Message: Reformatted and updated license header Index: SqlConfig.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SqlConfig.java 3 Jun 2003 22:35:26 -0000 1.5 --- SqlConfig.java 27 Jun 2003 02:05:58 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.sql.config; --- 1,66 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.sql.config; *************** *** 28,49 **** import java.util.Set; /** ! * <strong>SqlConfig</strong> ! * <p>another simple implementation of a IConfig interface. This stuff should really go ! * in to a more suitable superclass</p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfig ! extends com.babeldoc.core.Named ! implements IConfig { /** instance: the data */ private Map data; - /** instance: the parent service */ - SqlConfigService service; - /** The dirty flag - how tell if this data has changed. */ private boolean dirty = false; --- 72,94 ---- import java.util.Set; + /** ! * <strong>SqlConfig</strong> ! * ! * <p> ! * another simple implementation of a IConfig interface. This stuff should ! * really go in to a more suitable superclass ! * </p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfig extends com.babeldoc.core.Named implements IConfig { ! /** instance: the parent service */ ! SqlConfigService service; /** instance: the data */ private Map data; /** The dirty flag - how tell if this data has changed. */ private boolean dirty = false; *************** *** 53,56 **** --- 98,102 ---- * * @param name configuration object name + * @param service DOCUMENT ME! */ SqlConfig(String name, SqlConfigService service) { *************** *** 61,85 **** /** ! * Get the string configuration setting for the name * ! * @param name the configuration option key ! * @return the value of the configuration option */ ! public String getString(String name) { ! return (String) data.get(name); } /** ! * Get an enumeration of all the configurations. * ! * @return */ ! public Set keys() { ! return data.keySet(); } /** * does this configuration object have this key? * @param name * @return true if key found, else false. */ --- 107,147 ---- /** ! * Get the state of the dirty flag. * ! * @return */ ! public boolean isDirty() { ! return dirty; } /** ! * Set the configuration option. This may not be implemented in all ! * interfaces. It is intended for more sophistacated implementations. * ! * @param name the key of the option ! * @param value of the option */ ! public void setString(String name, String value) { ! service.setString(this.getName(), name, value); ! data.put(name, value); ! setDirty(true); ! } ! ! /** ! * Get the string configuration setting for the name ! * ! * @param name the configuration option key ! * ! * @return the value of the configuration option ! */ ! public String getString(String name) { ! return (String) data.get(name); } /** * does this configuration object have this key? + * * @param name + * * @return true if key found, else false. */ *************** *** 89,102 **** /** ! * Set the configuration option. This may not be implemented in ! * all interfaces. It is intended for more sophistacated implementations. * ! * @param name the key of the option ! * @param value of the option */ ! public void setString(String name, String value) { ! service.setString(this.getName(), name, value); ! data.put(name, value); ! setDirty(true); } --- 151,160 ---- /** ! * Get an enumeration of all the configurations. * ! * @return */ ! public Set keys() { ! return data.keySet(); } *************** *** 108,119 **** void setDirty(boolean dirty) { this.dirty = dirty; - } - - /** - * Get the state of the dirty flag. - * @return - */ - public boolean isDirty() { - return dirty; } } --- 166,169 ---- Index: SqlConfigService.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfigService.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SqlConfigService.java 3 Jun 2003 22:35:27 -0000 1.5 --- SqlConfigService.java 27 Jun 2003 02:05:58 -0000 1.6 *************** *** 1,22 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.sql.config; --- 1,66 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.sql.config; *************** *** 27,70 **** import java.sql.*; import java.util.Locale; /** * A sql configuration service ! * ! * <p>The implementation of the configuration service is intended for high-volume, enterprise ! * installations. This implementation allows for dynamic configurations and also for configuration ! * writing, something not allowed in the "Light" version.</p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfigService ! implements IConfigService { ! /** constant: the name of the database */ ! public final static String DB_NAME = "dbName"; /** constant: the password to use */ ! public final static String DB_PASSWORD = "dbPassword"; /** constant: the url to use to resolved the database */ ! public final static String DB_URL = "dbUrl"; ! /** constant: the name of database driver class-name */ ! public final static String DB_DRIVER = "dbDriver"; ! /** constant: the select query to get the configuration data */ public static final String CONFIG_SELECT = "SELECT cfg_name, cfg_value FROM config WHERE cfg_name LIKE "; /** constant: delete the key */ public static final String CONFIG_DELETE = "delete from config WHERE cfg_name = ?"; /** constant: insert the key */ public static final String CONFIG_INSERT = "INSERT INTO config ( cfg_name , cfg_value ) values ( ? , ? )"; // Instance variable settings. String dbName; String dbPasswd; - String dbDriver; String dbUrl; /** ! * Construct a sql connection. This will extract the properties from the system ! * properties and will initialize the instance variables representing the database ! * information. This method will attempt to load the driver class. */ public SqlConfigService() { --- 71,124 ---- import java.sql.*; + import java.util.Locale; + /** * A sql configuration service ! * ! * <p> ! * The implementation of the configuration service is intended for high-volume, ! * enterprise installations. This implementation allows for dynamic ! * configurations and also for configuration writing, something not allowed in ! * the "Light" version. ! * </p> * * @author Bmcdonald * @version 1.0 */ ! public class SqlConfigService implements IConfigService { /** constant: the name of the database */ ! public static final String DB_NAME = "dbName"; ! /** constant: the password to use */ ! public static final String DB_PASSWORD = "dbPassword"; ! /** constant: the url to use to resolved the database */ ! public static final String DB_URL = "dbUrl"; ! ! /** constant: the name of database driver class-name */ ! public static final String DB_DRIVER = "dbDriver"; ! ! /** constant: the select query to get the configuration data */ public static final String CONFIG_SELECT = "SELECT cfg_name, cfg_value FROM config WHERE cfg_name LIKE "; + /** constant: delete the key */ public static final String CONFIG_DELETE = "delete from config WHERE cfg_name = ?"; + /** constant: insert the key */ public static final String CONFIG_INSERT = "INSERT INTO config ( cfg_name , cfg_value ) values ( ? , ? )"; + String dbDriver; // Instance variable settings. String dbName; String dbPasswd; String dbUrl; /** ! * Construct a sql connection. This will extract the properties from the ! * system properties and will initialize the instance variables representing ! * the database information. This method will attempt to load the driver ! * class. */ public SqlConfigService() { *************** *** 74,78 **** dbUrl = System.getProperty(DB_URL); ! if (dbName != null && dbPasswd != null && dbDriver != null && dbUrl != null) { try { Class.forName(dbDriver).newInstance(); --- 128,133 ---- dbUrl = System.getProperty(DB_URL); ! if ((dbName != null) && (dbPasswd != null) && (dbDriver != null) && ! (dbUrl != null)) { try { Class.forName(dbDriver).newInstance(); *************** *** 84,92 **** /** ! * get a config bundle for the name and given locale. This extracts the country and ! * language strings from the locale object and calls the getConfig method * * @param name configuration object name * @param locale locale to use * @return the configuration object */ --- 139,149 ---- /** ! * get a config bundle for the name and given locale. This extracts the ! * country and language strings from the locale object and calls the ! * getConfig method * * @param name configuration object name * @param locale locale to use + * * @return the configuration object */ *************** *** 96,103 **** if (country != null) { ! name += "." + country; } if (language != null) { ! name += "." + language; } --- 153,161 ---- if (country != null) { ! name += ("." + country); } + if (language != null) { ! name += ("." + language); } *************** *** 106,114 **** /** ! * get a config bundle for the name and default locale. This is were the the database is ! * actually opened and data is selected. ! * <strong>TODO: Use a connection pool</strong> * * @param name configurationobject name * @return configuration object */ --- 164,173 ---- /** ! * get a config bundle for the name and default locale. This is were the the ! * database is actually opened and data is selected. <strong>TODO: Use a ! * connection pool</strong> * * @param name configurationobject name + * * @return configuration object */ *************** *** 123,126 **** --- 182,186 ---- stmt = con.createStatement(); results = stmt.executeQuery(CONFIG_SELECT + "'" + name + "%'"); + int nameLen = name.length() + 1; *************** *** 139,154 **** --- 199,220 ---- } catch (Exception x) { } + ; + try { stmt.close(); } catch (Exception x) { } + ; + try { con.close(); } catch (Exception x) { } + ; } + return config; } *************** *** 158,161 **** --- 224,228 ---- * * @param name + * * @return */ *************** *** 164,171 **** --- 231,246 ---- } + //this should be implemented... + public boolean saveConfig(String name, IConfig config) { + System.out.println("Not supported yet"); + + return false; + } + /** * package privacy - set the configuration value * * @param name the key of the option + * @param key DOCUMENT ME! * @param value of the option */ *************** *** 178,182 **** // Build the string name/key - remember names + keys get // stored in the same table. ! name += "." + key; try { --- 253,257 ---- // Build the string name/key - remember names + keys get // stored in the same table. ! name += ("." + key); try { *************** *** 199,208 **** --- 274,287 ---- } catch (Exception x) { } + ; + try { pstmt1.close(); } catch (Exception x) { } + ; + try { if (pstmt2 != null) { *************** *** 211,228 **** } catch (Exception x) { } ; try { con.close(); } catch (Exception x) { } ; } - } - - - //this should be implemented... - public boolean saveConfig(String name, IConfig config) { - System.out.println("Not supported yet"); - return false; } } --- 290,303 ---- } catch (Exception x) { } + ; + try { con.close(); } catch (Exception x) { } + ; } } } Index: SqlConfigurationLoader.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/config/SqlConfigurationLoader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SqlConfigurationLoader.java 22 May 2003 03:20:32 -0000 1.6 --- SqlConfigurationLoader.java 27 Jun 2003 02:05:58 -0000 1.7 *************** *** 1,26 **** ! /* ! * $Header$ ! * $DateTime: 2002/07/21 17:01:20 $ * * ! * babeldoc: universal document processor * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 ! * of the License, or (at your option) any later version. * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.babeldoc.sql.config; import com.babeldoc.core.I18n; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; --- 1,72 ---- ! /* ==================================================================== ! * The Apache Software License, Version 1.1 * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted provided that the following conditions ! * are met: * ! * 1. Redistributions of source code must retain the above copyright ! * notice, this list of conditions and the following disclaimer. * ! * 2. Redistributions in binary form must reproduce the above copyright ! * notice, this list of conditions and the following disclaimer in ! * the documentation and/or other materials provided with the ! * distribution. ! * ! * 3. The end-user documentation included with the redistribution, ! * if any, must include the following acknowledgment: ! * "This product includes software developed by the ! * Apache Software Foundation (http://www.apache.org/)." ! * Alternately, this acknowledgment may appear in the software itself, ! * if and wherever such third-party acknowledgments normally appear. ! * ! * 4. The names "Apache" and "Apache Software Foundation" must ! * not be used to endorse or promote products derived from this ! * software without prior written permission. For written ! * permission, please contact ap...@ap.... ! * ! * 5. Products derived from this software may not be called "Apache", ! * nor may "Apache" appear in their name, without prior written ! * permission of the Apache Software Foundation. ! * ! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! * SUCH DAMAGE. ! * ==================================================================== ! * ! * This software consists of voluntary contributions made by many ! * individuals on behalf of the Apache Software Foundation. For more ! * information on the Apache Software Foundation, please see ! * <http://www.apache.org/>. ! * ! * Portions of this software are based upon public domain software ! * originally written at the National Center for Supercomputing Applications, ! * University of Illinois, Urbana-Champaign. ! * ==================================================================== ! * ! * Babeldoc: The Universal Document Processor ! * ! * $Header$ ! * $DateTime$ ! * $Author$ * */ package com.babeldoc.sql.config; import com.babeldoc.core.I18n; + import com.babeldoc.core.BabeldocCommand; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; *************** *** 30,40 **** import java.io.FileInputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; /** ! * <strong>SqlConfigurationLoader</strong> ! * <p>Provides a way to import all the configuration data from the configuration properties ! * files into the sql configuration tables</p> * * @author Bmcdonald --- 76,91 ---- import java.io.FileInputStream; import java.io.IOException; + import java.util.Enumeration; import java.util.Properties; + /** ! * <strong>SqlConfigurationLoader</strong> ! * ! * <p> ! * Provides a way to import all the configuration data from the configuration ! * properties files into the sql configuration tables ! * </p> * * @author Bmcdonald *************** *** 42,48 **** */ public class SqlConfigurationLoader ! extends com.babeldoc.core.BabeldocCommand { /** instance: the directory to scan from */ private File directory; /** instance: the configuration service to use to set the values */ private SqlConfigService sqlConfigService; --- 93,100 ---- */ public class SqlConfigurationLoader ! extends BabeldocCommand { /** instance: the directory to scan from */ private File directory; + /** instance: the configuration service to use to set the values */ private SqlConfigService sqlConfigService; *************** *** 58,71 **** /** - * setup the options on the command line. - * - * @param options the options to access - */ - public void setupCommandLine(Options options) { - super.setupCommandLine(options); - options.addOption(OptionBuilder.isRequired().withDescription(com.babeldoc.core.I18n.get("sql.002")).withLongOpt("directory").hasArg().create('d')); - } - - /** * Handle the command line from main * --- 110,113 ---- *************** *** 76,79 **** --- 118,122 ---- String dir = commandLine.getOptionValue('d'); directory = new File(dir); + if (directory.isDirectory()) { this.sqlConfigService = new SqlConfigService(); *************** *** 88,91 **** --- 131,155 ---- /** + * Main routine + * + * @param args + */ + public static void main(String[] args) { + new SqlConfigurationLoader(args); + } + + /** + * setup the options on the command line. + * + * @param options the options to access + */ + public void setupCommandLine(Options options) { + super.setupCommandLine(options); + options.addOption(OptionBuilder.isRequired() + .withDescription(com.babeldoc.core.I18n.get( + "sql.002")).withLongOpt("directory").hasArg().create('d')); + } + + /** * recursive descend into the directory with property files * *************** *** 95,98 **** --- 159,163 ---- if (file.isDirectory()) { File[] files = file.listFiles(); + for (int i = 0; i < files.length; ++i) { process(files[i]); *************** *** 101,111 **** if (file.getAbsolutePath().endsWith(".properties")) { Properties props = new Properties(); try { props.load(new FileInputStream(file)); String dir = directory.getAbsolutePath(); String fname = file.getAbsolutePath(); ! String basename = fname.substring(dir.length() + 1).replace(File.separatorChar, '/'); ! basename = basename.substring(0, basename.length() - ".properties".length()); Enumeration e = props.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); --- 166,182 ---- if (file.getAbsolutePath().endsWith(".properties")) { Properties props = new Properties(); + try { props.load(new FileInputStream(file)); + String dir = directory.getAbsolutePath(); String fname = file.getAbsolutePath(); ! String basename = fname.substring(dir.length() + 1).replace(File.separatorChar, ! '/'); ! basename = basename.substring(0, ! basename.length() - ".properties".length()); ! Enumeration e = props.keys(); + while (e.hasMoreElements()) { String key = (String) e.nextElement(); *************** *** 114,129 **** } } catch (IOException e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get("002001") + file.toString(), e); } } } - } - - /** - * Main routine - * @param args - */ - public static void main(String[] args) { - new SqlConfigurationLoader(args); } } --- 185,193 ---- } } catch (IOException e) { ! com.babeldoc.core.LogService.getInstance().logError(com.babeldoc.core.I18n.get( ! "002001") + file.toString(), e); } } } } } |