You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vl...@apache.org on 2002/11/17 09:55:57 UTC
cvs commit: xml-xindice/java/src/org/apache/xindice/tools XMLTools.java
vladimir 2002/11/17 00:55:57
Modified: java/src/org/apache/xindice/tools XMLTools.java
Log:
use env. variable to define the configuration file
Revision Changes Path
1.14 +18 -9 xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java
Index: XMLTools.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XMLTools.java 13 Nov 2002 05:41:02 -0000 1.13
+++ XMLTools.java 17 Nov 2002 08:55:57 -0000 1.14
@@ -65,6 +65,8 @@
import org.apache.xindice.util.StringUtilities;
import org.apache.xindice.util.XindiceException;
import org.apache.xindice.xml.dom.DOMParser;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
import org.xmldb.api.DatabaseManager;
@@ -104,8 +106,10 @@
public static final String AUTO_KEY = "autoKey";
public static final String NAMESPACES = "namespaces";
public static final String IMPL_CLASS = "implClass";
-
- private Hashtable table;
+
+ private static Log log = LogFactory.getLog("org.apache.xindice.XMLTools");
+
+ private Hashtable table;
protected String location = null;
private boolean initialized = false;
private static boolean verbose = false;
@@ -211,11 +215,11 @@
} catch (IllegalArgumentException e) {
printHelp();
throw new XindiceException("ERROR : " + e.getMessage(), e);
- } catch (NoSuchElementException ne) {
- throw new NoSuchElementException("ERROR : "+ne+" Switch found. Parameter missing.");
- } catch (NullPointerException np) {
- np.printStackTrace(System.out);
- throw new NullPointerException("ERROR : " + np);
+ } catch (NoSuchElementException e) {
+ throw new NoSuchElementException("ERROR : " + e + " Switch found. Parameter missing.");
+ } catch (NullPointerException e) {
+ e.printStackTrace(System.out);
+ throw new NullPointerException("ERROR : " + e);
} catch (Exception e) {
e.printStackTrace(System.out);
throw new XindiceException("ERROR : " + e.getMessage(), e);
@@ -270,7 +274,12 @@
} else if ( token.equalsIgnoreCase("-l") || token.equalsIgnoreCase("--localdb") ) {
table.put( LOCAL, "true");
} else if ( token.equalsIgnoreCase("-d") || token.equalsIgnoreCase("--dbconfig") ) {
- table.put( DB_CONFIG, at.nextSwitchToken());
+ String configFile = System.getProperty("user.dir") + File.separator + at.nextSwitchToken();
+ if (log.isDebugEnabled()) {
+ log.debug(configFile);
+ }
+ System.setProperty(Xindice.PROP_XINDICE_CONFIGURATION, configFile);
+ table.put( DB_CONFIG, configFile);
} else if ( token.equalsIgnoreCase("-s") || token.equalsIgnoreCase("--namespaces") ) {
table.put(NAMESPACES, at.nextSwitchToken());
// Index specific options