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/12 01:25:29 UTC

cvs commit: xml-xindice/java/src/org/apache/xindice/tools XMLUserTools.java

kstaken     2002/07/11 16:25:29

  Modified:    config   system.xml
               java/src/org/apache/xindice/client/xmldb DatabaseImpl.java
               java/src/org/apache/xindice/client/xmldb/services
                        CollectionManager.java DatabaseInstanceManager.java
               java/src/org/apache/xindice/client/xmldb/xmlrpc
                        CollectionImpl.java DatabaseImpl.java
               java/src/org/apache/xindice/client/xmldb/xmlrpc/services
                        CollectionManagementServiceImpl.java
               java/src/org/apache/xindice/server Kernel.java
               java/src/org/apache/xindice/server/rpc
                        RPCDefaultMessage.java
               java/src/org/apache/xindice/server/rpc/messages
                        CreateCollection.java CreateIndexer.java
  Added:       java/src/org/apache/xindice/server/rpc/messages
                        Shutdown.java
  Removed:     java/src/org/apache/xindice/tools XMLUserTools.java
  Log:
  Xindice now uses XML-RPC for all communications. The CORBA code is still
  there but by default it is turned off. This code is wobbly at this point
  and needs much more testing, but seems to work for basic cases. XMLObjects
  are completely broken though.
  
  Revision  Changes    Path
  1.5       +2 -2      xml-xindice/config/system.xml
  
  Index: system.xml
  ===================================================================
  RCS file: /home/cvs/xml-xindice/config/system.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- system.xml	11 Jul 2002 04:37:02 -0000	1.4
  +++ system.xml	11 Jul 2002 23:25:28 -0000	1.5
  @@ -78,12 +78,12 @@
               </responses>
            </service>
            <!-- APIService must start after the HTTP service -->
  -         <service class="org.apache.xindice.server.services.APIService" name="APIService">
  +         <!--service class="org.apache.xindice.server.services.APIService" name="APIService"-->
               <!-- If you want to use a CORBA naming service uncomment this and
                    set the uri to point to the proper location. Most installations
                    don't need to worry about this -->
               <!--naming property="InitRef.NameService" uri="http://localhost:4080/NamingService" /-->
  -         </service>
  +         <!--/service-->
         </services>
   
         <logging class="org.apache.xindice.server.standard.StdLogManager" filename="./logs/Xindice.log" rotate="yes" />
  
  
  
  1.5       +3 -3      xml-xindice/java/src/org/apache/xindice/client/xmldb/DatabaseImpl.java
  
  Index: DatabaseImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/DatabaseImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DatabaseImpl.java	11 Jul 2002 08:39:23 -0000	1.4
  +++ DatabaseImpl.java	11 Jul 2002 23:25:28 -0000	1.5
  @@ -92,8 +92,8 @@
      /**
       * These are the URI prefixes this proxy impl understands.
       */
  -   public static String CORBA_URI = "xindice://";
  -   public static String XMLRPC_URI = "xindice-rpc://";
  +   public static String CORBA_URI = "xindice-corba://";
  +   public static String XMLRPC_URI = "xindice://";
      public static String EMBED_URI = "xindice-embed://";
   
      /**
  
  
  
  1.4       +2 -2      xml-xindice/java/src/org/apache/xindice/client/xmldb/services/CollectionManager.java
  
  Index: CollectionManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/services/CollectionManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionManager.java	11 Jul 2002 03:17:07 -0000	1.3
  +++ CollectionManager.java	11 Jul 2002 23:25:28 -0000	1.4
  @@ -141,7 +141,7 @@
       * @return the list of XMLObjects.
       * @exception XMLDBException
       */
  -   public String[] listXMLObjects() throws XMLDBException;
  +  public String[] listXMLObjects() throws XMLDBException;
      
      /**
       * Creates a new collection level XMLObject using the provided configuration.
  
  
  
  1.3       +2 -2      xml-xindice/java/src/org/apache/xindice/client/xmldb/services/DatabaseInstanceManager.java
  
  Index: DatabaseInstanceManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/services/DatabaseInstanceManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DatabaseInstanceManager.java	11 Jul 2002 03:17:07 -0000	1.2
  +++ DatabaseInstanceManager.java	11 Jul 2002 23:25:28 -0000	1.3
  @@ -76,7 +76,7 @@
       * @return The name of this database
       * @exception XMLDBException
       */
  -   public String getDatabaseName() throws XMLDBException;
  + //  public String getDatabaseName() throws XMLDBException;
   
      /**
       * Shutsdown the Database instance
  
  
  
  1.2       +180 -64   xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java
  
  Index: CollectionImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CollectionImpl.java	11 Jul 2002 07:57:06 -0000	1.1
  +++ CollectionImpl.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -61,9 +61,11 @@
   import org.xmldb.api.modules.*;
   import org.apache.xmlrpc.*;
   import org.apache.xindice.util.*;
  +import org.apache.xindice.core.FaultCodes;
   import org.apache.xindice.server.rpc.RPCDefaultMessage;
   import java.util.Hashtable;
   import java.util.Vector;
  +import java.util.Enumeration;
   import java.net.MalformedURLException;
   import org.apache.xindice.client.xmldb.resources.XMLResourceImpl;
   import org.apache.xindice.xml.TextWriter;
  @@ -78,6 +80,7 @@
   import org.apache.xindice.client.xmldb.CommonConfigurable;
   import org.apache.xindice.client.xmldb.ResourceSetImpl;
   import org.apache.xindice.client.xmldb.ResourceIteratorImpl;
  +import org.apache.xindice.client.xmldb.xmlrpc.services.*;
   
   /**
    * Implementation of XML:DB's <code>Collection</code> interface using
  @@ -87,16 +90,9 @@
    * @author Kimbro Staken <ks...@xmldatabases.org>
    * @version 1
    */
  -public class CollectionImpl extends CommonConfigurable implements Collection {
  -
  -    /* Named service classes map to instantiate for each collection */
  -    private static String[] serviceClassesMap =
  -    {  "org.apache.xindice.client.xmldb.xmlrpc.services.XPathQueryServiceImpl",
  -      "org.apache.xindice.client.xmldb.xmlrpc.services.XUpdateQueryServiceImpl",
  -      "org.apache.xindice.client.xmldb.xmlrpc.services.CollectionManagementServiceImpl" };
  -      
  +public class CollectionImpl extends CommonConfigurable implements Collection {      
       /* Instantiated named services map */
  -    private Hashtable servicesMap = new Hashtable();
  +    protected Hashtable services = null;
       
       /* path to XML-RPC service on database */
       private static String XINDICE_SERVICE_LOCATION = "/RPC2";
  @@ -154,36 +150,86 @@
               throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                        "Collection not found: " + collPath);
           }
  +
  +        services = new Hashtable();
           
  -        for (int i=0; i < serviceClassesMap.length; i++) {
  +        // Register all services supported by this collection implementation.
  +        XPathQueryServiceImpl xpath = new XPathQueryServiceImpl();
  +        xpath.setCollection(this);
  +//        xpath.setSymbolDeserializer(syms);
  +        registerService(xpath);
   
  -            try {
  -            
  -                /*
  -                 * Look up service constructor that accepts CollectionImpl
  -                 * argument
  -                 */
  -                Service s = (Service) 
  -                        Class.forName(serviceClassesMap[i]).newInstance();
  -                s.setCollection(this);
  -                
  -                servicesMap.put(s.getName() + s.getVersion(), s);
  -            } catch (InstantiationException e) {
  -            
  -                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "Couldn't create "
  -                       + serviceClassesMap[i] + " service: " + e.getMessage());
  -            } catch (ClassNotFoundException e) {
  -                
  -                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "Couldn't create "
  -                       + serviceClassesMap[i] + " service: " + e.getMessage());
  -            } catch (IllegalAccessException e) {
  -                
  -                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "Couldn't create "
  -                       + serviceClassesMap[i] + " service: " + e.getMessage());
  -            }
  -        } 
  +        XUpdateQueryServiceImpl xupdate = new XUpdateQueryServiceImpl();
  +        xupdate.setCollection(this);
  +        registerService(xupdate);
  +
  +        try {
  +           CollectionManagementServiceImpl manager = new CollectionManagementServiceImpl();
  +           manager.setCollection(this);
  +           registerService(manager);
  +
  +           // CollectionManagementServiceImpl provides both standard access as a
  +           // CollectionManagementService and Xindice specific access as a
  +           // CollectionManager and DatabaseInstanceManager.
  +           // We need to register it explicitly to make it available
  +           services.put("CollectionManager" + manager.getVersion(), manager);
  +           services.put("DatabaseInstanceManager" + manager.getVersion(), manager);           
  +        }
  +        catch (Exception e) {
  +           throw FaultCodes.createXMLDBException(e);
  +        }
       }
  -    
  +
  +     /**
  +      * Returns the list of Services supported by this Collection.
  +      *
  +      * @return A list of supported Services
  +      * @exception XMLDBException
  +      */
  +     public org.xmldb.api.base.Service[] getServices() throws XMLDBException {
  +        checkOpen();
  +
  +        Enumeration e = services.elements();
  +        Service[] result = new Service[services.size()];
  +
  +        int i = 0;
  +        while (e.hasMoreElements()) {
  +           result[i] = (Service) e.nextElement();
  +           i++;
  +        }
  +
  +        return result;
  +     }
  +
  +     /**
  +      * Get a Service instance based on the name and version.
  +      *
  +      * @param name The Service instance to retrieve
  +      * @param version The version of the service to retrieve.
  +      * @return The Service instance or null if no service was found.
  +      * @exception XMLDBException
  +      */
  +     public org.xmldb.api.base.Service getService(String name, String version) throws XMLDBException {
  +        checkOpen();
  +
  +        Service result = (Service) services.get(name + version);
  +
  +        return result;
  +     }
  +
  +     /**
  +      * Registers a new Service with this Collection.
  +      *
  +      * @param service Description of Parameter
  +      * @exception XMLDBException
  +      */
  +     public void registerService(org.xmldb.api.base.Service service) throws XMLDBException {
  +        checkOpen();
  +
  +        service.setCollection(this);
  +        services.put(service.getName() + service.getVersion(), service);
  +     }
  +     
       /**
        * Submits a command for RPC to database server
        *
  @@ -202,18 +248,6 @@
           v.add(params);
           return ((Hashtable) client.execute("run",v)).get(RPCDefaultMessage.RESULT);
       }
  -        
  -        
  -    /**
  -     * Returns the available services for this collection
  -     *
  -     * @return an array with one entry per available service
  -     */
  -    public Service[] getServices() {
  -
  -        return (Service[]) servicesMap.entrySet().toArray(
  -                new Service[servicesMap.size()]);
  -    }
       
       /**
        * Returns the named resource in this collection
  @@ -311,19 +345,6 @@
       }
       
       /**
  -     * Looks up named service for this collection.
  -     *
  -     * @param name service name
  -     * @param version service version
  -     */
  -    public Service getService(String name, String version) throws XMLDBException {
  -        
  -        Service s = (Service) servicesMap.get(name + version);
  -        
  -        return s;
  -    }
  -    
  -    /**
        * Checks if the collection is still open. Only open collections are safe
        * to work with.
        *
  @@ -674,7 +695,27 @@
                       "Cannot create child collection: " + e.getMessage());
           }
       }
  -    
  +
  +     public Collection createCollection(String name, Document configuration) throws XMLDBException {
  +        checkOpen();
  +        try {
  +           Hashtable params = new Hashtable();
  +           params.put(RPCDefaultMessage.COLLECTION, collPath);
  +           params.put(RPCDefaultMessage.NAME, name);
  +           params.put(RPCDefaultMessage.CONFIGURATION,
  +                      new TextWriter(configuration).toString());
  +
  +           runRemoteCommand("CreateCollection", params);
  +           
  +           return getChildCollection(name);
  +        }
  +        catch (Exception e) {
  +e.printStackTrace();           
  +           throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
  +                    "Cannot create child collection: " + e.getMessage());
  +        }
  +     }
  +     
       /**
        * Removes child collection from this collection
        *
  @@ -697,5 +738,80 @@
                       "Cannot remove child collection: " + e.getMessage());
           }
       }
  -    
  +
  +     /**
  +      * Returns a list of all indexers for this collection.
  +      *
  +      * @return the list of indexers
  +      * @exception XMLDBException
  +      */
  +     public String[] listIndexers() throws XMLDBException {
  +        try {
  +           Hashtable params = new Hashtable();
  +           params.put(RPCDefaultMessage.COLLECTION, collPath);
  +           Vector list = (Vector) runRemoteCommand("ListIndexers", params);
  +
  +           return (String[]) list.toArray(new String[list.size()]);
  +        }
  +        catch (Exception e) {
  +           throw FaultCodes.createXMLDBException(e);
  +        }
  +     }
  +
  +     /**
  +      * Creates a new Indexer for this collection.
  +      *
  +      * @param name The name for this indexer
  +      * @param configuration The configuration to use for this indexer.
  +      * @exception XMLDBException
  +      */
  +     public void createIndexer(Document configuration) throws XMLDBException {
  +        try {
  +           Hashtable params = new Hashtable();
  +           params.put(RPCDefaultMessage.COLLECTION, collPath);
  +           params.put(RPCDefaultMessage.CONFIGURATION,
  +                      new TextWriter(configuration).toString());
  +           
  +           runRemoteCommand("CreateIndexer", params);                      
  +        }
  +        catch (Exception e) {
  +           throw FaultCodes.createXMLDBException(e);
  +        }
  +     }
  +
  +     /**
  +      * Drops the indexer from the collection
  +      *
  +      * @param indexer The indexer to drop.
  +      * @exception XMLDBException
  +      */
  +     public void dropIndexer(String name) throws XMLDBException {
  +        try {
  +           Hashtable params = new Hashtable();
  +           params.put(RPCDefaultMessage.COLLECTION, collPath);
  +           params.put(RPCDefaultMessage.NAME, name);
  +
  +           runRemoteCommand("RemoveIndexer", params);
  +        }
  +        catch (Exception e) {
  +           throw FaultCodes.createXMLDBException(e);
  +        }
  +     }
  +
  +     /**
  +      * Shutsdown the Database instance
  +      *
  +      * @return the result of the shutdown operation
  +      * @exception XMLDBException
  +      */
  +     public void shutdown() throws XMLDBException {
  +        try {
  +           Hashtable params = new Hashtable();
  +
  +           runRemoteCommand("Shutdown", params);
  +        }
  +        catch (Exception e) {
  +           throw FaultCodes.createXMLDBException(e);
  +        }
  +     }
   }
  
  
  
  1.2       +2 -2      xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java
  
  Index: DatabaseImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DatabaseImpl.java	11 Jul 2002 07:57:06 -0000	1.1
  +++ DatabaseImpl.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -76,7 +76,7 @@
   public class DatabaseImpl extends CommonConfigurable implements Database {
       
       /* prefix used to denote XML:DB URI's that should use this driver */
  -    static String DRIVER_NAME = "xindice-rpc";
  +    static String DRIVER_NAME = "xindice";
       
       /* XML:DB conformance level of this driver */
       private String CONFORMANCE_LEVEL = "0";
  
  
  
  1.2       +161 -3    xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/services/CollectionManagementServiceImpl.java
  
  Index: CollectionManagementServiceImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/services/CollectionManagementServiceImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CollectionManagementServiceImpl.java	11 Jul 2002 07:57:06 -0000	1.1
  +++ CollectionManagementServiceImpl.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -64,16 +64,21 @@
   import org.xmldb.api.base.ErrorCodes;
   import org.apache.xindice.client.xmldb.CommonConfigurable;
   import org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl;
  +import org.apache.xindice.client.xmldb.services.CollectionManager;
  +import org.apache.xindice.client.xmldb.services.DatabaseInstanceManager;
  +import org.apache.xindice.core.FaultCodes;
  +import org.w3c.dom.Document;
   
   /**
    * XML:DB CollectionManagementService implementation using XML-RPC to
    * communicate with Xindice.
    *
    * @author James Bates <ja...@amplexor.com>
  + * @author Kimbro Staken <ks...@xmldatabases.org>
    * @version 1.0
    */
   public class CollectionManagementServiceImpl extends CommonConfigurable
  -        implements CollectionManagementService {
  +        implements CollectionManagementService, CollectionManager, DatabaseInstanceManager {
   
       /* The collection this service operates on */
       private Collection coll = null;
  @@ -145,5 +150,158 @@
       public void setCollection(Collection collection) {
           
           this.coll = collection;
  -    }    
  +    }
  +
  +    /**
  +       * Returns the name of the collection that this manager is associated with.
  +     *
  +     * @return the name of the collection
  +     * @exception XMLDBException
  +     */
  +    public String getCollectionName() throws XMLDBException {
  +       try {
  +          return coll.getName();
  +       }
  +       catch (Exception e) {
  +          throw FaultCodes.createXMLDBException(e);
  +       }
  +    }
  +
  +    /**
  +       * Returns the fully qualified name of the collection that this manager is
  +     * associated with. This name includes all parent collections.
  +     *
  +     * @return the fully qualified name for this collection.
  +     * @exception XMLDBException
  +     */
  +    public String getCanonicalName() throws XMLDBException {
  +       try {
  +          return ((CollectionImpl) coll).getPath();
  +       }
  +       catch (Exception e) {
  +          throw FaultCodes.createXMLDBException(e);
  +       }
  +    }
  +    
  +    /**
  +       * Creates a new collection in the database identified by name and using
  +     * the provided configuration.
  +     *
  +     * @param path the path of the new collection
  +     * @param configuration the XML collection configuration to use for
  +     *        creating this collection.
  +     * @return The newly created collection
  +     * @exception XMLDBException
  +     */
  +    public Collection createCollection(String path, Document configuration)
  +       throws XMLDBException {
  +          if (coll == null) {
  +             throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
  +                                      "Must set collection for this service");
  +          }
  +
  +          return ((CollectionImpl) coll).createCollection(path, configuration);
  +       }
  +
  +    /**
  +     * Drops a child collection from this collection.
  +     *
  +     * @param collection The child collection to drop.
  +     * @exception XMLDBException
  +     */
  +    public void dropCollection(String name) throws XMLDBException {
  +        this.removeCollection(name);
  +    }
  +
  +    /**
  +     * Returns a list of all indexers for this collection.
  +     *
  +     * @return the list of indexers
  +     * @exception XMLDBException
  +     */
  +    public String[] listIndexers() throws XMLDBException {
  +       try {
  +          return ((CollectionImpl) coll).listIndexers();
  +       }
  +       catch (Exception e) {
  +          throw FaultCodes.createXMLDBException(e);
  +       }
  +    }
  +
  +    /**
  +     * Creates a new Indexer for this collection.
  +     *
  +     * @param configuration The configuration to use for this indexer.
  +     * @exception XMLDBException
  +     */
  +    public void createIndexer(Document configuration) throws XMLDBException {
  +       try {
  +          ((CollectionImpl) coll).createIndexer(configuration);
  +       }
  +       catch (Exception e) {
  +          throw FaultCodes.createXMLDBException(e);
  +       }
  +    }
  +    
  +    /**
  +     * Drops the indexer from the collection
  +     *
  +     * @param indexer The indexer to drop.
  +     * @exception XMLDBException
  +     */
  +    public void dropIndexer(String name) throws XMLDBException {
  +       try {
  +          ((CollectionImpl) coll).dropIndexer(name);
  +       }
  +       catch (Exception e) {
  +          throw FaultCodes.createXMLDBException(e);
  +       }
  +    }
  +
  +    /**
  +     * Shutsdown the Database instance
  +     *
  +     * @return the result of the shutdown operation
  +     * @exception XMLDBException
  +     */
  +    public void shutdown() throws XMLDBException {
  +          ((CollectionImpl) coll).shutdown();
  +
  +    }
  +
  +
  +    /**
  +       * Returns a list of all collection level XMLObjects for this collection.
  +     *
  +     * @return the list of XMLObjects.
  +     * @exception XMLDBException
  +     */
  +    public String[] listXMLObjects() throws XMLDBException {
  +       return null;
  +    }
  +
  +    /**
  +       * Creates a new collection level XMLObject using the provided configuration.
  +     * The XMLObject will be added to the collection using the provided name as
  +     * a key.
  +     *
  +     * @param name The name of this XMLObject
  +     * @param configuration The XML configuration to use
  +     * @return The created XMLObject
  +     * @exception XMLDBException
  +     */
  +    public void createXMLObject(Document configuration) throws XMLDBException {
  +       
  +    }
  +
  +    /**
  +       * Drops a collection level XMLObject from the collection.
  +     *
  +     * @param object The XMLObject to drop.
  +     * @exception XMLDBException
  +     */
  +    public void dropXMLObject(String name)
  +       throws XMLDBException {
  +       
  +       }
   }
  
  
  
  1.4       +7 -1      xml-xindice/java/src/org/apache/xindice/server/Kernel.java
  
  Index: Kernel.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/Kernel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Kernel.java	8 May 2002 09:53:33 -0000	1.3
  +++ Kernel.java	11 Jul 2002 23:25:28 -0000	1.4
  @@ -108,6 +108,7 @@
      private ServiceManager services;
      private ComponentManager components;
      private UserManager users;
  +   private static Kernel kernel;
   
      public Kernel() {
         this("system.xml", true);
  @@ -185,8 +186,13 @@
         System.out.println();
         System.out.println("Server Running");
         running = true;
  +      kernel = this;
      }
   
  +   public static Kernel getKernel() {
  +      return kernel;
  +   }
  +   
      /**
       * run is used to keep the kernel alive with no services running
       * and to run interval-scheduled tasks
  
  
  
  1.2       +10 -8     xml-xindice/java/src/org/apache/xindice/server/rpc/RPCDefaultMessage.java
  
  Index: RPCDefaultMessage.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/RPCDefaultMessage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RPCDefaultMessage.java	11 Jul 2002 07:50:44 -0000	1.1
  +++ RPCDefaultMessage.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -81,15 +81,17 @@
      public static final String TYPE = "type";
      public static final String QUERY = "query";
      public static final String NAMESPACES = "namespaces";
  +   public static final String CONFIGURATION = "configuration";
   
  -   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_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 static final String MISSING_CONFIGURATION_PARAM = "You must either provide a document containing the configuration or specify the 'name' and 'patter' parameters.";
  +
      public Hashtable execute(Hashtable message) throws Exception {
         return null;
      }
  
  
  
  1.2       +26 -14    xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateCollection.java
  
  Index: CreateCollection.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateCollection.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CreateCollection.java	11 Jul 2002 07:50:44 -0000	1.1
  +++ CreateCollection.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -80,21 +80,33 @@
            throw new Exception(MISSING_COLLECTION_PARAM);
         }
   
  -      if(!message.containsKey(NAME)) {
  -         throw new Exception(MISSING_NAME_PARAM);
  +      if ( ! message.containsKey(CONFIGURATION) && ! message.containsKey(NAME) ) {
  +         throw new Exception(MISSING_CONFIGURATION_PARAM);
         }
   
  -      CollectionManager colman = getCollection( (String) message.get(COLLECTION) );
  -      Document doc = new DocumentImpl();
  +      Document doc;
  +      // Handle the case where we're getting an entire configuration document.
  +      if ( message.containsKey(CONFIGURATION) ) {
  +         doc = DOMParser.toDocument((String) message.get(CONFIGURATION));
  +         if ( doc == null ) {
  +            throw new Exception( "Unable to parse Collection configuration" );
  +         }
  +      }
  +      // Otherwise we need to build the configuration from the name and pattern.
  +      else {
  +         doc = new DocumentImpl();
   
  -      Element colEle = doc.createElement("collection");
  -      colEle.setAttribute("compressed", "true");
  -      colEle.setAttribute("name", (String) message.get(NAME));
  -      doc.appendChild(colEle);
  +         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);
  +         Element filEle = doc.createElement("filer");
  +         filEle.setAttribute("class", "org.apache.xindice.core.filer.BTreeFiler");
  +         colEle.appendChild(filEle);
  +      }
  +      
  +      CollectionManager colman = getCollection((String) message.get(COLLECTION));
   
         Configuration config = new Configuration(doc.getDocumentElement(),false);     
         colman.createCollection( (String) message.get(NAME), config );
  
  
  
  1.2       +27 -17    xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateIndexer.java
  
  Index: CreateIndexer.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/CreateIndexer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CreateIndexer.java	11 Jul 2002 07:50:44 -0000	1.1
  +++ CreateIndexer.java	11 Jul 2002 23:25:28 -0000	1.2
  @@ -76,29 +76,39 @@
         
      public Hashtable execute(Hashtable message) throws Exception {
   
  -      if(!message.containsKey(COLLECTION)) {
  +      if ( ! message.containsKey(COLLECTION) ) {
            throw new Exception(MISSING_COLLECTION_PARAM);
         }
   
  -      if(!message.containsKey(NAME)) {
  -         throw new Exception(MISSING_NAME_PARAM);
  +      if ( ! message.containsKey(CONFIGURATION) && ! message.containsKey(NAME) ) {
  +         throw new Exception(MISSING_CONFIGURATION_PARAM);
         }
   
  -      if(!message.containsKey(PATTERN)) {
  -         throw new Exception(MISSING_PATTERN_PARAM);
  +      Document doc;
  +      // Handle the case where we're getting an entire configuration document.
  +      if ( message.containsKey(CONFIGURATION) ) {
  +         doc = DOMParser.toDocument((String) message.get(CONFIGURATION));
  +         if ( doc == null ) {
  +            throw new Exception( "Unable to parse Indexer configuration" );
  +         }
  +         
  +         // TODO: should extract the name from the document.
  +         message.put(NAME, "");
         }
  +      // Otherwise we need to build the configuration from the name and pattern.
  +      else {
  +         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));
   
  -      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); 
  -
  +         doc.appendChild(index);         
  +      }
  +      
         Collection col = getCollection( (String) message.get(COLLECTION) );
         Configuration config = new Configuration(doc.getDocumentElement(), false);     
         col.createIndexer( config );
  
  
  
  1.1                  xml-xindice/java/src/org/apache/xindice/server/rpc/messages/Shutdown.java
  
  Index: Shutdown.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: Shutdown.java,v 1.1 2002/07/11 23:25:28 kstaken Exp $
   */
  
  import java.util.Hashtable;
  
  import org.apache.xindice.server.Kernel;
  import org.apache.xindice.server.rpc.*;
  
  /**
   *
   */
  public class Shutdown extends RPCDefaultMessage {   
     
     public Hashtable execute(Hashtable message) throws Exception {
        Kernel.getKernel().shutDown(1);
  
        Hashtable result = new Hashtable();
        result.put(RESULT, "yes");
        return result;
     }
  }