[prev in list] [next in list] [prev in thread] [next in thread]
List: xindice-dev
Subject: cvs commit: xml-xindice/java/src/org/apache/xindice/tools/command Shutdown.java
From: vgritsenko () apache ! org
Date: 2004-02-21 14:29:45
Message-ID: 20040221142945.94428.qmail () minotaur ! apache ! org
[Download RAW message or body]
vgritsenko 2004/02/21 06:29:45
Modified: java/src/org/apache/xindice/core Database.java
java/src/org/apache/xindice/tools XMLTools.java
java/src/org/apache/xindice/tools/command Shutdown.java
Log:
XMLTools to shutdown the database when working in embed ("local") mode.
Revision Changes Path
1.41 +6 -2 xml-xindice/java/src/org/apache/xindice/core/Database.java
Index: Database.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/Database.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Database.java 21 Feb 2004 13:48:23 -0000 1.40
+++ Database.java 21 Feb 2004 14:29:45 -0000 1.41
@@ -142,6 +142,10 @@
* @see org.apache.xindice.core.DBObject#close()
*/
public boolean close() throws DBException {
+ if (log.isDebugEnabled()) {
+ log.debug("Shutting down database: '" + getName() + "'");
+ }
+
flushConfig();
super.close();
1.29 +13 -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.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- XMLTools.java 8 Feb 2004 02:57:35 -0000 1.28
+++ XMLTools.java 21 Feb 2004 14:29:45 -0000 1.29
@@ -29,7 +29,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xmldb.api.DatabaseManager;
-import org.xmldb.api.base.Database;
import org.xmldb.api.base.XMLDBException;
import java.io.File;
@@ -285,24 +284,29 @@
if (commandClass != null) {
try {
- // register Xindice Database with xml:db
- Database db = new DatabaseImpl();
-
+ // Register Xindice Database with xml:db
+ DatabaseImpl db = new DatabaseImpl();
DatabaseManager.registerDatabase(db);
- // execute command class
+ // Execute command class
Command command = (Command) Class.forName(commandClass).newInstance();
command.execute(table);
+
+ // Close Database
+ if ("true".equals(table.get(LOCAL))) {
+ command = new org.apache.xindice.tools.command.Shutdown();
+ command.execute(table);
+ }
+
return true;
} catch (XMLDBException e) {
- System.err.println("XMLDB Exception with code " + e.errorCode);
+ System.err.println("XMLDB Exception " + e.errorCode + ": " + e.getMessage());
if (table.get(VERBOSE).equals("true")) {
e.printStackTrace(System.err);
}
return false;
} catch (Exception e) {
System.err.println("ERROR : " + e.getMessage());
-
if (table.get(VERBOSE).equals("true")) {
e.printStackTrace(System.err);
}
1.9 +4 -6 xml-xindice/java/src/org/apache/xindice/tools/command/Shutdown.java
Index: Shutdown.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/Shutdown.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Shutdown.java 8 Feb 2004 02:57:35 -0000 1.8
+++ Shutdown.java 21 Feb 2004 14:29:45 -0000 1.9
@@ -27,8 +27,8 @@
import java.util.Hashtable;
/**
- * AddCollection.java is designed to let the user create
- * new Collections and Nested Collections within the Database.
+ * Shutdown.java is designed to let the user shutdown
+ * the Database.
*
* @version CVS $Revision$, $Date$
*/
@@ -44,7 +44,6 @@
}
try {
-
// Get a Collection reference to pass on to individual commands
String colstring = normalizeCollectionURI((String) table.get(XMLTools.COLLECTION),
(String) table.get(XMLTools.LOCAL));
@@ -54,7 +53,6 @@
// Shutdown the server
man.shutdown();
-
} finally {
if (col != null) {
col.close();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic