Author: vgritsenko
Date: Tue Apr  3 14:52:05 2007
New Revision: 525295

URL: http://svn.apache.org/viewvc?view=rev&rev=525295
Log:
            <action dev="VG" type="update" fixes-bug="41854" due-to="Natalia 
Shilenkova">
                Add support for filer parameter in command line tools.
            </action>


Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/tools/XMLTools.java
    
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/AddCollection.java
    xml/xindice/trunk/java/src/org/apache/xindice/tools/command/HelpCommand.java
    xml/xindice/trunk/java/src/org/apache/xindice/tools/command/Shutdown.java
    xml/xindice/trunk/status.xml

Modified: xml/xindice/trunk/java/src/org/apache/xindice/tools/XMLTools.java
URL: 
http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/tools/XMLTools.java?view=diff&rev=525295&r1=525294&r2=525295
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/tools/XMLTools.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/tools/XMLTools.java Tue Apr  
3 14:52:05 2007
@@ -46,6 +46,7 @@
 public class XMLTools {
 
     public static final String COLLECTION = "collection";
+    public static final String FILER = "filer";
     public static final String EXTENSION = "extension";
     public static final String FILE_PATH = "filePath";
     public static final String ACTION = "action";
@@ -199,6 +200,8 @@
                     throw new IllegalArgumentException("The name of a 
collection must start with '/'");
                 }
                 table.put(COLLECTION, colname);
+            } else if (token.equalsIgnoreCase("--filer")) {
+                table.put(FILER, at.nextSwitchToken());
             } else if (token.equalsIgnoreCase("-e") || 
token.equalsIgnoreCase("--extension")) {
                 table.put(EXTENSION, at.nextSwitchToken());
             } else if (token.equalsIgnoreCase("-f") || 
token.equalsIgnoreCase("--filepath")) {

Modified: 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/AddCollection.java
URL: 
http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/tools/command/AddCollection.java?view=diff&rev=525295&r1=525294&r2=525295
==============================================================================
--- 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/AddCollection.java 
(original)
+++ 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/AddCollection.java 
Tue Apr  3 14:52:05 2007
@@ -89,7 +89,19 @@
                 doc.appendChild(colEle);
 
                 Element filEle = doc.createElement("filer");
-                filEle.setAttribute("class", 
"org.apache.xindice.core.filer.BTreeFiler");
+                String filerClass = "org.apache.xindice.core.filer.BTreeFiler";
+                // see if user specified filer type
+                if (table.containsKey(XMLTools.FILER)) {
+                    String filer = (String) table.get(XMLTools.FILER);
+                    if ("HashFiler".equals(filer)) {
+                        filerClass = "org.apache.xindice.core.filer.HashFiler";
+                    } else if (!"BTreeFiler".equals(filer)) {
+                        System.out.println("Unknown filer: " + filer);
+                        return false;
+                    }
+                }
+
+                filEle.setAttribute("class", filerClass);
                 if (table.containsKey(XMLTools.PAGE_SIZE)) {
                     filEle.setAttribute(XMLTools.PAGE_SIZE, (String) 
table.get(XMLTools.PAGE_SIZE));
                 }

Modified: 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/HelpCommand.java
URL: 
http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/tools/command/HelpCommand.java?view=diff&rev=525295&r1=525294&r2=525295
==============================================================================
--- 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/HelpCommand.java 
(original)
+++ 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/HelpCommand.java 
Tue Apr  3 14:52:05 2007
@@ -29,9 +29,10 @@
 /**
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Todd Byrne</a>
+ * @version $Revision$, $Date$
  */
 public class HelpCommand extends Command {
-       
+
        public boolean execute(Hashtable table) throws Exception {
                NodeList list = (NodeList)table.get(XMLTools.COMMAND_LIST);
 
@@ -70,6 +71,7 @@
                System.out.println("    --pagesize   Page size for file pages 
(default: 4096)");
                System.out.println("    --maxkeysize The maximum size for file 
keys (default: 0=none)");
                System.out.println("    --pagecount  Number of pages in the 
primary storage (default: 1024)");
+               System.out.println("    --filer      Collection filer, can be 
HashFiler or BTreeFiler (default: BTreeFiler)");
                System.out.println();
 
                System.out.println("Actions:");
@@ -111,5 +113,4 @@
                System.out.println();
                return true;
        }
-
 }

Modified: 
xml/xindice/trunk/java/src/org/apache/xindice/tools/command/Shutdown.java
URL: 
http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/tools/command/Shutdown.java?view=diff&rev=525295&r1=525294&r2=525295
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/tools/command/Shutdown.java 
(original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/tools/command/Shutdown.java 
Tue Apr  3 14:52:05 2007
@@ -45,15 +45,26 @@
         }
 
         try {
+            // Collection name can be incorrect, use database name instead
+            String context = (String) table.get(XMLTools.COLLECTION);
+            int i = context.indexOf('/', 1);
+            String db;
+            if (i >= 0) {
+                db = context.substring(0, i);
+            } else {
+                db = context;
+            }
+
             // Get a Collection reference to pass on to individual commands
-            String colstring = normalizeCollectionURI((String) 
table.get(XMLTools.COLLECTION),
-                                                      (String) 
table.get(XMLTools.LOCAL));
+            String colstring = normalizeCollectionURI(db, (String) 
table.get(XMLTools.LOCAL));
             col = DatabaseManager.getCollection(colstring);
 
-            DatabaseInstanceManager man = (DatabaseInstanceManager) 
col.getService("DatabaseInstanceManager", XMLDBAPIVERSION);
+            if (col != null) {
+                DatabaseInstanceManager man = (DatabaseInstanceManager) 
col.getService("DatabaseInstanceManager", XMLDBAPIVERSION);
 
-            // Shutdown the server
-            man.shutdown();
+                // Shutdown the server
+                man.shutdown();
+            }
         } finally {
             if (col != null) {
                 col.close();
@@ -63,5 +74,3 @@
         return true;
     }
 }
-
-

Modified: xml/xindice/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xml/xindice/trunk/status.xml?view=diff&rev=525295&r1=525294&r2=525295
==============================================================================
--- xml/xindice/trunk/status.xml (original)
+++ xml/xindice/trunk/status.xml Tue Apr  3 14:52:05 2007
@@ -118,6 +118,9 @@
 
     <changes>
         <release version="1.1b5-dev" date="(not released)">
+            <action dev="VG" type="update" fixes-bug="41854" due-to="Natalia 
Shilenkova">
+                Add support for filer parameter in command line tools.
+            </action>
             <action dev="VG" type="update">
                 Moved configuration file in WAR file to /WEB-INF/config. 
Updated
                 XindiceServlet to check for xindice.configuration system 
property


Reply via email to