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 ks...@apache.org on 2002/07/11 09:50:45 UTC

cvs commit: xml-xindice/java/src/org/apache/xindice/server/rpc/messages CreateCollection.java CreateIndexer.java CreateNewOID.java GetCollectionConfiguration.java GetCollectionCount.java GetDocument.java GetDocumentCount.java GetIndexerConfiguration.java InsertDocument.java ListCollections.java ListDocuments.java ListIndexers.java Query.java RemoveCollection.java RemoveDocument.java RemoveIndexer.java UpdateIndexer.java

kstaken     2002/07/11 00:50:45

  Added:       java/src/org/apache/xindice/server/rpc Client.java
                        RPCDefaultMessage.java RPCMessage.java
                        RPCMessageHandler.java RPCMessageInterface.java
               java/src/org/apache/xindice/server/rpc/messages
                        CreateCollection.java CreateIndexer.java
                        CreateNewOID.java GetCollectionConfiguration.java
                        GetCollectionCount.java GetDocument.java
                        GetDocumentCount.java GetIndexerConfiguration.java
                        InsertDocument.java ListCollections.java
                        ListDocuments.java ListIndexers.java Query.java
                        RemoveCollection.java RemoveDocument.java
                        RemoveIndexer.java UpdateIndexer.java
  Log:
  Moving the XML-RPC server pieces into the main tree.
  
  Revision  Changes    Path
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/Client.java
  
  Index: Client.java
  ===================================================================
  package org.apache.xindice.server.rpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: Client.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.*;
  
  import org.apache.xmlrpc.*;
  import org.apache.xindice.util.*;
  import org.apache.xindice.xml.dom.*;
  import org.apache.xindice.xml.*;
  import org.w3c.dom.*;
  /**
   *
   */
  public class Client {
  
     public static Hashtable run(Hashtable message) throws Exception {
        XmlRpc.setEncoding("UTF8");
        XmlRpc.setDriver("xerces");
        XmlRpcClient client = new XmlRpcClient("http://localhost:4080/RPC2");
        Vector params = new Vector();
        params.addElement(message);
  
        return (Hashtable) client.execute("run", params);   
     }
     
     public static void main(String[] args) throws Exception {
        Hashtable message = new Hashtable();
        message.put("message", "InsertDocument");
        message.put("name", "utf8-test");
        message.put("collection", "/db/test3");
        message.put("document",
                    "<?xml version=\"1.0\" encoding=\"utf-8\"?><test>� test � � �</test>");
  
        Hashtable result = run(message);
        System.out.println(result.get("result"));
  
        message.put("message", "GetDocument");
        message.put("compressed", "true");
        message.put("timestamp", new Integer(12344));
        
        result = run(message);
        Hashtable compDoc = (Hashtable) result.get("result");
        SymbolDeserializer syms = new SymbolDeserializer();
        SymbolTable s = syms.getSymbols(compDoc);
        Document doc = new DocumentImpl((byte [])compDoc.get("document"), s, null);
        TextWriter.write(doc, System.out);
        System.out.println(doc);      
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/RPCDefaultMessage.java
  
  Index: RPCDefaultMessage.java
  ===================================================================
  package org.apache.xindice.server.rpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RPCDefaultMessage.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.apache.xindice.core.*;
  
  /**
   * @author kstaken
   */
  public class RPCDefaultMessage implements RPCMessage {
  
     public static final String API_NAME = "Xindice XML-RPC";
     public static final String RESULT = "result";
     public static final String NAME = "name";
     public static final String COLLECTION = "collection";
     public static final String DOCUMENT = "document";
     public static final String COMPRESSED = "compressed";
     public static final String TIMESTAMP = "timestamp";
     public static final String PATTERN = "pattern";
     public static final String MAXKEYSIZE = "maxkeysize";
     public static final String PAGESIZE = "pagesize";
     public static final String TYPE = "type";
     public static final String QUERY = "query";
     public static final String NAMESPACES = "namespaces";
  
     public static final String MISSING_COLLECTION_PARAM = "Required parameter COLLECTION not found.";
     public static final String MISSING_NAME_PARAM = "Required parameter NAME not found.";
     public static final String MISSING_DOCUMENT_PARAM = "Required parameter DOCUMENT not found.";
     public static final String MISSING_PATTERN_PARAM = "Required parameter PATTERN not found.";
     public static final String MISSING_TYPE_PARAM = "Required parameter TYPE not found.";
     public static final String MISSING_QUERY_PARAM = "Required parameter QUERY not found.";
     public static final String MISSING_TIMESTAMP_PARAM = "For compressed results a timestamp must be provided.";
     
     public Hashtable execute(Hashtable message) throws Exception {
        return null;
     }
  
     /**
      * Retrieves a Collection instance based on the path provided in name.
      *
      * @param name The collection to retrieve
      * @return The Collection value
      * @exception Exception
      * @author kstaken
      */
     protected Collection getCollection( String name ) throws Exception {
        // Get rid of any trailling slashes.
        while (name.endsWith("/")) {
           name = name.substring(0, name.lastIndexOf("/"));
        }
        
        // name must start with a /
        if ( name.startsWith( "/" ) ) {
           // find the database name. We just skip the first slash
           int colIndex = name.indexOf( '/', 1 );
  
           // We assume there's no collection specified
           String dbName =  name.substring( 1 );;
           String colName = "/";
  
           // if colIndex isn't -1 then we need to pick out the db and collection
           if ( colIndex != -1 ) {         
              dbName = name.substring( 1, colIndex );
  
              // The rest of the name locates the collection
              colName = name.substring( colIndex + 1 );
           }
  
           Database db = Database.getDatabase( dbName );
           if ( db == null ) {
              throw new Exception( "Database " + dbName + " could not be found" );
           }
           Collection col = db.getCollection( colName );
           if ( col == null ) {
              throw new Exception( "Collection " + colName + " could not be found" );
           }
  
           return col;
        }
        else {
           throw new Exception( "Collection name must begin with a '/'" );
        }
     }   
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/RPCMessage.java
  
  Index: RPCMessage.java
  ===================================================================
  package org.apache.xindice.server.rpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RPCMessage.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.*;
  
  /**
   *
   */
  public interface RPCMessage {
     public Hashtable execute(Hashtable message) throws Exception;
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/RPCMessageHandler.java
  
  Index: RPCMessageHandler.java
  ===================================================================
  package org.apache.xindice.server.rpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   * 
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RPCMessageHandler.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  /**
   * 
   */
  import org.apache.xindice.core.*;
  
  import org.apache.xindice.server.*;
  import org.apache.xindice.util.*;
  
  import java.io.*;
  import java.util.*;
  
  import org.apache.xmlrpc.*;
  
  /**
  * XMLRPCHandler provides XML-RPC access to basic operations for Xindice
  */
  
  public final class RPCMessageHandler extends SimpleScriptComponent
         implements ScriptFilter {
      protected String[] databases = null;
      protected XmlRpcServer xmlrpc;
      
      public RPCMessageHandler() {
         XmlRpc.setEncoding("UTF8");
         try {
            // TODO: This introduces a firm dependency on xerces. fix it.
            XmlRpc.setDriver("xerces");
         }
         catch (Exception e) {
            System.out.println("XML-RPC support requires Xerces");
         }
         
         xmlrpc = new XmlRpcServer();
         xmlrpc.addHandler ("$default", new RPCMessageInterface());
         
      }
  
      public void setKernel(Kernel kernel) {
          
          super.setKernel(kernel);
          databases = Database.listDatabases();
      }
  
      public void setConfig(Configuration config) {
  
          this.config = config;
          String name = config.getAttribute(NAME);      
      }
  
      public boolean isPackageFiltered(String name) {
          return true;
      }
  
      public boolean run(Script script, Gateway gateway) {        
         String pathinfo = gateway.getRequestHeader("PATH_INFO");
  
         // We only handle all requests under /RPC2
         // We just use that endpoint since it's common in the XML-RPC community.
         // This could easily be made configurable.
         if ( ! pathinfo.startsWith("/RPC2") ) {
            return true;
         }
         
         
         // We only handle POST requests
         if ( ! gateway.getRequestHeader("REQUEST_METHOD").equals("POST") ) {
            return true;
         }
  
         DataOutputStream dos = new DataOutputStream(gateway.getOutputStream());
  
         try {
            byte[] result = xmlrpc.execute(gateway.getInputStream());
            gateway.setResponseHeader("Content-type", "text/xml");
            gateway.setResponseHeader("Content-length", Integer.toString(result.length));
  
            dos.write(result);	
            dos.flush();
  
            gateway.send(200);
            gateway.logMessage(LogManager.LOG_GENERAL,
                               gateway.getRequestHeader("REQUEST_METHOD") + " " + pathinfo + " " + 
                               gateway.getResponseHeader("Content-length"));
         }
         catch ( Exception e ) {
            gateway.sendException(this.getName(), e);
         }
  
         return false;
      }
  }
  
  
  
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/RPCMessageInterface.java
  
  Index: RPCMessageInterface.java
  ===================================================================
  package org.apache.xindice.server.rpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RPCMessageInterface.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.*;
  
  /**
   *
   */
  public final class RPCMessageInterface {
     public static final String MESSAGE_PARAM = "message";
      
     public Hashtable run(Hashtable message) throws Exception {
        // The method determines what class we load to handle the message.
        RPCMessage handler = null;
        try {
           handler = 
              (RPCMessage) Class.forName("org.apache.xindice.server.rpc.messages." +
                            message.get(MESSAGE_PARAM)).newInstance();
        }
        catch (Exception e) {
           e.printStackTrace();
        }
  
        return handler.execute(message);
     }
  }
  
  
  
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateCollection.java
  
  Index: CreateCollection.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: CreateCollection.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.util.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.xml.dom.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class CreateCollection extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        CollectionManager colman = getCollection( (String) message.get(COLLECTION) );
        Document doc = new DocumentImpl();
  
        Element colEle = doc.createElement("collection");
        colEle.setAttribute("compressed", "true");
        colEle.setAttribute("name", (String) message.get(NAME));
        doc.appendChild(colEle);
  
        Element filEle = doc.createElement("filer");
        filEle.setAttribute("class", "org.apache.xindice.core.filer.BTreeFiler");
        colEle.appendChild(filEle);
  
        Configuration config = new Configuration(doc.getDocumentElement(),false);     
        colman.createCollection( (String) message.get(NAME), config );
  
        Hashtable result = new Hashtable();
        result.put(RESULT, (String) message.get(NAME));
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateIndexer.java
  
  Index: CreateIndexer.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: CreateIndexer.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.util.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.xml.dom.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class CreateIndexer extends RPCDefaultMessage {
        
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        if(!message.containsKey(PATTERN)) {
           throw new Exception(MISSING_PATTERN_PARAM);
        }
  
        Document doc = new DocumentImpl();
  
        // Create the index element to hold attributes
        Element index = doc.createElement("index");
  
        index.setAttribute("class", "org.apache.xindice.core.indexer.ValueIndexer");
        index.setAttribute("name", (String) message.get(NAME));
        index.setAttribute("pattern", (String) message.get(PATTERN));
  
        doc.appendChild(index); 
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
        Configuration config = new Configuration(doc.getDocumentElement(), false);     
        col.createIndexer( config );
        
        Hashtable result = new Hashtable();
        result.put(RESULT, (String) message.get(NAME));
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateNewOID.java
  
  Index: CreateNewOID.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: CreateNewOID.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class CreateNewOID extends RPCDefaultMessage {   
  
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        Hashtable result = new Hashtable();
        result.put(RESULT, col.createNewOID().toString());
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetCollectionConfiguration.java
  
  Index: GetCollectionConfiguration.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: GetCollectionConfiguration.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class GetCollectionConfiguration extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        // TODO: figure out what goes here.
        
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetCollectionCount.java
  
  Index: GetCollectionCount.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: GetCollectionCount.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   * XML-RPC message to list number of child collections in a collection
   *
   * @author James Bates <ja...@amplexor.com>
   * @version 1
   */
  public class GetCollectionCount extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        Hashtable result = new Hashtable();
        result.put( RESULT, new Integer( (int) col.countCollections() ) );
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetDocument.java
  
  Index: GetDocument.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: GetDocument.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.util.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class GetDocument extends RPCDefaultMessage {   
   
     public Hashtable execute(Hashtable message) throws Exception {
        SymbolSerializer symbolSerializer = null;
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        Document doc = col.getDocument( (String) message.get(NAME) );
        if ( doc == null ) {
           throw new Exception( API_NAME + ": Document not found " +
                                (String) message.get(NAME) );
        }
  
        Hashtable result = new Hashtable();
        if (message.containsKey(COMPRESSED)) {
           try {
              symbolSerializer = new SymbolSerializer(col.getSymbols());
           }
           catch ( Exception e ) {
              // It's ok (in theory) for a Collection to have no symbol table
           }
  
           long timestamp = 1;
           /* Time stamp is an optimization and longs are causing problems with XML-RPC
              so we'll try to get everything working without them.
            if ( ! message.containsKey(TIMESTAMP) ) {
              throw new Exception(MISSING_TIMESTAMP_PARAM);
           }
  
           int timestamp = ((Integer) message.get("timestamp")).intValue();*/
           if ( /*( timestamp != -1) &&*/ ( symbolSerializer != null ) ) {
              result.put(RESULT,
                         symbolSerializer.convertFromDocument(doc, timestamp));
           }
           else {
              result.put(RESULT, TextWriter.toString( doc ));	             
           }
        }
        else {
           result.put(RESULT, TextWriter.toString( doc ));	         
        }
        
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetDocumentCount.java
  
  Index: GetDocumentCount.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: GetDocumentCount.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class GetDocumentCount extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        Hashtable result = new Hashtable();
  
        result.put( RESULT, new Integer( (int) col.getDocumentCount() ) );
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetIndexerConfiguration.java
  
  Index: GetIndexerConfiguration.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: GetIndexerConfiguration.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class GetIndexerConfiguration extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        // TODO: figure out what to do here
  
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/InsertDocument.java
  
  Index: InsertDocument.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: InsertDocument.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.xml.dom.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class InsertDocument extends RPCDefaultMessage {   
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        if(!message.containsKey(DOCUMENT)) {
           throw new Exception(MISSING_DOCUMENT_PARAM);
        }
  
        Collection col = getCollection((String) message.get(COLLECTION));
  
        Document doc = DOMParser.toDocument((String) message.get(DOCUMENT));
        if ( doc == null ) {
           throw new Exception( "Unable to parse Document" );
        }
  
        String id = (String) message.get(NAME);
        if ( id.equals( "" ) ) {
           id = col.insertDocument( doc ).toString();
        }
        else {
           col.insertDocument( id, doc );
        }
        
        Hashtable result = new Hashtable();
        result.put(RESULT, id);
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/ListCollections.java
  
  Index: ListCollections.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: ListCollections.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class ListCollections extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
        String[] cols = col.listCollections();
  
        Vector list = new Vector();
        for ( int i = 0; ( cols != null ) && ( i < cols.length ); i++ ) {
           list.addElement( cols[i] );
        }
  
        Hashtable result = new Hashtable();
        result.put(RESULT, list);
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/ListDocuments.java
  
  Index: ListDocuments.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: ListDocuments.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class ListDocuments extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
        String[] list = col.listDocuments();
  
        Vector docs = new Vector();
        for ( int i = 0; ( list != null ) && ( i < list.length ); i++ ) {
           docs.addElement( list[i] );
        }
  
        Hashtable result = new Hashtable();
        result.put(RESULT, docs);
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/ListIndexers.java
  
  Index: ListIndexers.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: ListIndexers.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class ListIndexers extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
        String[] list = col.listIndexers();
  
        Vector indexers = new Vector();
        for ( int i = 0; ( list != null ) && ( i < list.length ); i++ ) {
           indexers.addElement( list[i] );
        }
  
        Hashtable result = new Hashtable();
        result.put(RESULT, indexers);
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/Query.java
  
  Index: Query.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: Query.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Enumeration;
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.core.data.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.xml.dom.*;
  import org.apache.xindice.server.rpc.*;
  
     /**
      * Executes a query against a document or collection
      * @return The result of the query as XML.
      */
  
  public class Query extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(TYPE)) {
           throw new Exception(MISSING_TYPE_PARAM);
        }
  
        if(!message.containsKey(QUERY)) {
           throw new Exception(MISSING_QUERY_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
        NodeSet ns = null;
  
        if (message.containsKey( NAME )) {
  
           ns = col.queryDocument( (String)message.get(TYPE), (String)message.get(QUERY), mapNamespaces( (Hashtable)message.get(NAMESPACES) ), (String)message.get(NAME) );
  
        } else {
  
           ns = col.queryCollection( (String)message.get(TYPE), (String)message.get(QUERY), mapNamespaces( (Hashtable)message.get(NAMESPACES) ) );
        }
  
        Hashtable result = new Hashtable();
        result.put(RESULT, queryWrapper( ns ));
        return result;
     }
  
     /**
      * Maps a Hashtable containing namespace definitions into a Xindice
      * NamespaceMap.
      *
      * @param namespaces
      * @return A NamespaceMap
      */
     protected NamespaceMap mapNamespaces( Hashtable namespaces ) {
        NamespaceMap nsMap = null;
        if ( namespaces.size() > 0 ) {
           nsMap = new NamespaceMap();
  
           Enumeration keys = namespaces.keys();
           while ( keys.hasMoreElements() ) {
              String key = ( String ) keys.nextElement();
              nsMap.setNamespace( key, ( String ) namespaces.get( key ) );
           }
        }
  
        return nsMap;
     }
  
     /**
      * Adds additional meta data to the query response and turns it into a
      * Document.
      *
      * @param ns The NodeSet containing the query results.
      * @return the result set as an XML document
      * @exception Exception
      */
     private String queryWrapper( NodeSet ns ) throws Exception {
        // Turn the NodeSet into a document.
        DocumentImpl doc = new DocumentImpl();
  
        Element root = doc.createElement( "result" );
        doc.appendChild( root );
        int count = 0;
        while ( ns != null && ns.hasMoreNodes() ) {
           Node n = ns.getNextNode();
  
           if ( n.getNodeType() == Node.DOCUMENT_NODE ) {
              n = ( ( Document ) n ).getDocumentElement();
           }
  
           if ( n instanceof DBNode ) {
              ( ( DBNode ) n ).expandSource();
           }
  
           root.appendChild( doc.importNode( n, true ) );
           count++;
        }
  
        root.setAttribute( "count", Integer.toString( count ) );
  
        return TextWriter.toString( doc );
     }
  
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/RemoveCollection.java
  
  Index: RemoveCollection.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RemoveCollection.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class RemoveCollection extends RPCDefaultMessage {   
     // TODO: should have a simple way to validate params.
  
     public Hashtable execute(Hashtable message) throws Exception {
  
        if ( ! message.containsKey(COLLECTION) ) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if ( ! message.containsKey(NAME) ) {
           throw new Exception(MISSING_NAME_PARAM);
        }
        
        Collection col = getCollection( (String) message.get(COLLECTION)
                                        + "/" + (String) message.get(NAME));
        col.dropCollection( col );
  
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/RemoveDocument.java
  
  Index: RemoveDocument.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RemoveDocument.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class RemoveDocument extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        col.remove( (String) message.get(NAME) );
        
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/RemoveIndexer.java
  
  Index: RemoveIndexer.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: RemoveIndexer.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class RemoveIndexer extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        if(!message.containsKey(NAME)) {
           throw new Exception(MISSING_NAME_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        col.dropIndexer( col.getIndexer((String) message.get(NAME)) );
  
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/UpdateIndexer.java
  
  Index: UpdateIndexer.java
  ===================================================================
  package org.apache.xindice.server.rpc.messages;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xindice" 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 apache@apache.org.
   *
   * 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 and was
   * originally based on software copyright (c) 1999-2001, The dbXML
   * Group, L.L.C., http://www.dbxmlgroup.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: UpdateIndexer.java,v 1.1 2002/07/11 07:50:44 kstaken Exp $
   */
  
  import java.util.Hashtable;
  import java.io.*;
  
  import org.w3c.dom.*;
  
  import org.apache.xindice.core.*;
  import org.apache.xindice.xml.*;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class UpdateIndexer extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
  
        if(!message.containsKey(COLLECTION)) {
           throw new Exception(MISSING_COLLECTION_PARAM);
        }
  
        Collection col = getCollection( (String) message.get(COLLECTION) );
  
        // TODO: figure out what to do here.
        
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }