Xindice XML-RPC API

org.xmldatabases.xmlrpc
Class RPCOperations

java.lang.Object
  |
  +--org.xmldatabases.xmlrpc.RPCOperations

public class RPCOperations
extends java.lang.Object

Provides the basic implementation for XML-RPC support in Xindice.


Constructor Summary
RPCOperations()
           
 
Method Summary
 int createCollection(java.lang.String parentCollection, java.lang.String collectionName)
          Creates specified Collection
 int createIndexer(java.lang.String collectionName, java.lang.String indexName, java.lang.String pattern)
          Creates a new indexer in the specified Collection
 java.lang.String createNewOID(java.lang.String collectionName)
          Creates a new unique OID for this collection.
 int dropCollection(java.lang.String collectionName)
          Deletes specified Collection
 int dropIndexer(java.lang.String collectionName, java.lang.String index)
          Removes indexer in the specified Collection
 java.lang.String getDocument(java.lang.String collectionName, java.lang.String id)
          Retrieves a document from the collection
 int getDocumentCount(java.lang.String collectionName)
          Returns the number of documents stored in this collection.
 java.lang.String insertDocument(java.lang.String collectionName, java.lang.String id, java.lang.String content)
          Inserts a new document into the collection
 java.util.Vector listCollections(java.lang.String collectionName)
          Lists all child collections under this collection
 java.util.Vector listDocuments(java.lang.String collectionName)
          Returns a set containing all documents in the collection.
 java.util.Vector listIndexers(java.lang.String collectionName)
          Returns a set containing all indexers in the collection.
 java.util.Vector listXMLObjects(java.lang.String collectionName)
          Lists all XML objects within the collection
 java.lang.String queryCollection(java.lang.String collectionName, java.lang.String type, java.lang.String query, java.util.Hashtable namespaces)
          Executes a query against a collection
 java.lang.String queryDocument(java.lang.String collectionName, java.lang.String style, java.lang.String query, java.util.Hashtable namespaces, java.lang.String id)
          Executes a query against a Document in this collection
 int removeDocument(java.lang.String collectionName, java.lang.String id)
          Deletes a document from the collection.
 java.lang.String setDocument(java.lang.String collectionName, java.lang.String id, java.lang.String content)
          Sets a document in the collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RPCOperations

public RPCOperations()
Method Detail

setDocument

public java.lang.String setDocument(java.lang.String collectionName,
                                    java.lang.String id,
                                    java.lang.String content)
                             throws java.lang.Exception
Sets a document in the collection. setDocument should be called when the document already exists in the collection.
Parameters:
collectionName - The name of the collection including database instance.
id - The id of the Document to set
content - The new Document value
Returns:
The id of the updated Document
Throws:
java.lang.Exception - thrown if the document can't be found.

getDocument

public java.lang.String getDocument(java.lang.String collectionName,
                                    java.lang.String id)
                             throws java.lang.Exception
Retrieves a document from the collection
Parameters:
collectionName - The name of the collection including database instance.
id - The id of the document to retrieve
Returns:
The retrieved Document
Throws:
java.lang.Exception - thrown if the document can't be found

getDocumentCount

public int getDocumentCount(java.lang.String collectionName)
                     throws java.lang.Exception
Returns the number of documents stored in this collection.
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The number of documents in the collection
Throws:
java.lang.Exception - Thrown if any internal error occurs

insertDocument

public java.lang.String insertDocument(java.lang.String collectionName,
                                       java.lang.String id,
                                       java.lang.String content)
                                throws java.lang.Exception
Inserts a new document into the collection
Parameters:
collectionName - The name of the collection including database instance.
id - The id to insert the document under or the empty string if a new id should be generated automatically.
content - The Document to insert
Returns:
The id of the inserted document.
Throws:
java.lang.Exception - Thrown if there is a parse error or other internal error

removeDocument

public int removeDocument(java.lang.String collectionName,
                          java.lang.String id)
                   throws java.lang.Exception
Deletes a document from the collection.
Parameters:
collectionName - The name of the collection including database instance.
id - The id of the Document to delete
Returns:
0 to keep XML-RPC happy
Throws:
java.lang.Exception - thrown if the document could not be found or any other internal error occurs.

listCollections

public java.util.Vector listCollections(java.lang.String collectionName)
                                 throws java.lang.Exception
Lists all child collections under this collection
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The list of child collections
Throws:
java.lang.Exception - Thrown if any internal error occurs

dropCollection

public int dropCollection(java.lang.String collectionName)
                   throws java.lang.Exception
Deletes specified Collection
Parameters:
collectionName - The name of the collection including database instance.
Returns:
0
Throws:
java.lang.Exception - thrown if the collection could not be found or any other internal error occurs.

createCollection

public int createCollection(java.lang.String parentCollection,
                            java.lang.String collectionName)
                     throws java.lang.Exception
Creates specified Collection
Parameters:
parentCollection - The name of the collection including database instance to create the collection.
collectionName - The name of newly created collection.
Returns:
0
Throws:
java.lang.Exception - thrown if the collection could not be found or any other internal error occurs.

listIndexers

public java.util.Vector listIndexers(java.lang.String collectionName)
                              throws java.lang.Exception
Returns a set containing all indexers in the collection.
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The list of indexers in the specified collection
Throws:
java.lang.Exception - thrown if the collection could not be found or any other internal error occurs.

createIndexer

public int createIndexer(java.lang.String collectionName,
                         java.lang.String indexName,
                         java.lang.String pattern)
                  throws java.lang.Exception
Creates a new indexer in the specified Collection
Parameters:
collectionName - The name of the collection including database instance.
indexName - The name of the newly created indexer.
pattern - The pattern of the indexer.
Returns:
0
Throws:
java.lang.Exception - thrown if the collection could not be found or any other internal error occurs.

dropIndexer

public int dropIndexer(java.lang.String collectionName,
                       java.lang.String index)
                throws java.lang.Exception
Removes indexer in the specified Collection
Parameters:
collectionName - The name of the collection including database instance.
indexerName - The name of the indexer to remove.
Returns:
0
Throws:
java.lang.Exception - thrown if the indexer could not be found or any other internal error occurs.

listDocuments

public java.util.Vector listDocuments(java.lang.String collectionName)
                               throws java.lang.Exception
Returns a set containing all documents in the collection.
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The list of documents in the specified collection
Throws:
java.lang.Exception - thrown if any internal error occurs.

listXMLObjects

public java.util.Vector listXMLObjects(java.lang.String collectionName)
                                throws java.lang.Exception
Lists all XML objects within the collection
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The list of XML objects
Throws:
java.lang.Exception - Thrown if any internal error occurs

createNewOID

public java.lang.String createNewOID(java.lang.String collectionName)
                              throws java.lang.Exception
Creates a new unique OID for this collection.
Parameters:
collectionName - The name of the collection including database instance.
Returns:
The generated id
Throws:
java.lang.Exception - thrown id any internal error occurs

queryCollection

public java.lang.String queryCollection(java.lang.String collectionName,
                                        java.lang.String type,
                                        java.lang.String query,
                                        java.util.Hashtable namespaces)
                                 throws java.lang.Exception
Executes a query against a collection
Parameters:
collectionName - The name of the collection including database instance.
type - The type of query to execute. Valid values are XPath and XUpdate.
query - The query string to execute, should be in the proper syntax for the style specified
namespaces - A Hashtable containing namespace definitions. The key is the namespace prefix and the value is the namespace URI
Returns:
The result of the query as XML.
Throws:
java.lang.Exception - thrown if any internal error occurs

queryDocument

public java.lang.String queryDocument(java.lang.String collectionName,
                                      java.lang.String style,
                                      java.lang.String query,
                                      java.util.Hashtable namespaces,
                                      java.lang.String id)
                               throws java.lang.Exception
Executes a query against a Document in this collection
Parameters:
collectionName - The name of the collection including database instance.
type - the type of query to execute. Valid values are XPath and XUpdate
query - The query string to execute, should be in the proper syntax for the style specified
namespaces - A Hashtable containing namespace definitions. The key is the namespace prefix and the value is the namespace URI
id - the id of the document to query.
Returns:
The result of the query as XML.
Throws:
java.lang.Exception - thrown if any internal error occurs

Xindice XML-RPC API

Copyright (c) 2001,2002 Kimbro Staken, Kurt Ward, All rights reserved