org.exist.xmlrpc
Class RpcServer

java.lang.Object
  extended byorg.exist.xmlrpc.RpcServer
All Implemented Interfaces:
RpcAPI

public class RpcServer
extends java.lang.Object
implements RpcAPI

Handler class for XMLRPC calls.

To allow calls by many parallel users, RpcServer does not directly execute calls. Instead it delegates all calls to instances of the inner class RpcConnection, which run in their own thread.

On startup, RpcServer creates a pool of RpcConnections. For every call the server first gets a RpcConnection object from the pool, executes the call and releases the RpcConnection.

If the pool's maximum of concurrent connections (MAX_CONNECT) is reached, RpcServer will block until a connection is available.

All methods returning XML data will return UTF-8 encoded strings, unless an encoding is specified. Methods that allow to set the encoding will always return byte[] instead of string. byte[]-values are handled as binary data and are automatically BASE64-encoded by the XMLRPC engine. This way the correct character encoding is preserved during transport.

Author:
Wolfgang Meier

Field Summary
 
Fields inherited from interface org.exist.xmlrpc.RpcAPI
BASE_URI, COLUMN, ERROR, LINE, NAMESPACES, SORT_EXPR, STATIC_DOCUMENTS, VARIABLES
 
Constructor Summary
RpcServer(Configuration conf, java.lang.String databaseid)
          Constructor for the RpcServer object
 
Method Summary
 boolean backup(User user, java.lang.String userbackup, java.lang.String password, java.lang.String destcollection, java.lang.String collection)
           
 java.util.Hashtable compile(User user, byte[] xquery, java.util.Hashtable parameters)
           
 boolean configureCollection(User user, java.lang.String collection, java.lang.String configuration)
           
 boolean copyCollection(User user, java.lang.String name, java.lang.String namedest)
           
 boolean copyCollection(User user, java.lang.String collectionPath, java.lang.String destinationPath, java.lang.String newName)
           
 boolean copyResource(User user, java.lang.String docPath, java.lang.String destinationPath, java.lang.String newName)
           
 boolean createCollection(User user, java.lang.String name)
          Create a new collection on the database.
 boolean createCollection(User user, java.lang.String name, java.util.Date created)
           
 java.lang.String createId(User user, java.lang.String collection)
           
 java.lang.String createResourceId(User user, java.lang.String collection)
           
 boolean dataBackup(User user, java.lang.String dest)
           
 java.util.Hashtable describeCollection(User user, java.lang.String rootCollection)
           
 java.util.Hashtable describeResource(User user, java.lang.String resourceName)
           
 java.util.Hashtable execute(User user, java.lang.String path, java.util.Hashtable parameters)
          Execute XPath/Xquery from path file (stored inside eXist) returned reference may be used later to get a summary of results or retrieve the actual hits.
 int executeQuery(User user, byte[] xpath, java.util.Hashtable parameters)
           
 int executeQuery(User user, byte[] xpath, java.lang.String encoding, java.util.Hashtable parameters)
          Execute XPath query and return a reference to the result set.
 int executeQuery(User user, java.lang.String xpath, java.util.Hashtable parameters)
           
 byte[] getBinaryResource(User user, java.lang.String name)
           
 java.util.Hashtable getCollectionDesc(User user, java.lang.String rootCollection)
          Describe a collection: returns a struct with the following fields:
 java.util.Date getCreationDate(User user, java.lang.String collectionName)
           
 java.util.Vector getDocType(User user, java.lang.String documentName)
           
 byte[] getDocument(User user, java.lang.String name, java.util.Hashtable parametri)
          Retrieve document by name.
 byte[] getDocument(User user, java.lang.String name, java.lang.String encoding, int prettyPrint)
          Retrieve document by name.
 byte[] getDocument(User user, java.lang.String name, java.lang.String encoding, int prettyPrint, java.lang.String stylesheet)
          Retrieve document by name.
 java.lang.String getDocumentAsString(User user, java.lang.String name, java.util.Hashtable parameters)
          Retrieve a document.
 java.lang.String getDocumentAsString(User user, java.lang.String name, int prettyPrint)
           
 java.lang.String getDocumentAsString(User user, java.lang.String name, int prettyPrint, java.lang.String stylesheet)
           
 java.util.Vector getDocumentChunk(User user, java.lang.String name, java.util.Hashtable parameters)
           
 byte[] getDocumentChunk(User user, java.lang.String name, int start, int len)
           
 java.util.Hashtable getDocumentData(User user, java.lang.String name, java.util.Hashtable parameters)
          Retrieve the specified document, but limit the number of bytes transmitted to avoid memory shortage on the server.
 java.util.Vector getDocumentListing(User user)
          Get a list of all documents contained in the database.
 java.util.Vector getDocumentListing(User user, java.lang.String collection)
          Get a list of all documents contained in the collection.
 java.util.Vector getGroups(User user)
           
 int getHits(User user, int resultId)
          Get the number of hits in the result set identified by it's result-set-id.
 java.util.Vector getIndexedElements(User user, java.lang.String collectionName, boolean inclusive)
           
 java.util.Hashtable getNextChunk(User user, java.lang.String handle, int offset)
           
 java.util.Hashtable getPermissions(User user, java.lang.String docName)
           
 int getResourceCount(User user, java.lang.String collectionName)
          Returns the number of resources in the collection identified by collectionName.
 java.util.Vector getTimestamps(User user, java.lang.String documentName)
           
 java.util.Hashtable getUser(User user, java.lang.String name)
          Gets the user attribute of the RpcServer object
 java.util.Vector getUsers(User user)
           
 boolean hasCollection(User user, java.lang.String name)
          does a document called name exist in the repository?
 boolean hasDocument(User user, java.lang.String name)
          does a document called name exist in the repository?
 java.lang.String hasUserLock(User user, java.lang.String path)
           
 boolean isValid(User user, java.lang.String name)
           
 boolean isXACMLEnabled(User user)
          Returns true if XACML is enabled for the current database instance
 java.util.Hashtable listCollectionPermissions(User user, java.lang.String name)
           
 java.util.Hashtable listDocumentPermissions(User user, java.lang.String name)
           
 boolean lockResource(User user, java.lang.String path, java.lang.String userName)
           
 boolean moveCollection(User user, java.lang.String collectionPath, java.lang.String destinationPath, java.lang.String newName)
           
 boolean moveResource(User user, java.lang.String docPath, java.lang.String destinationPath, java.lang.String newName)
           
 boolean parse(User user, byte[] xmlData, java.lang.String docName)
          parse an XML document and store it into the database.
 boolean parse(User user, byte[] xmlData, java.lang.String docName, int overwrite)
          Parse an XML document and store it into the database.
 boolean parse(User user, byte[] xmlData, java.lang.String docName, int overwrite, java.util.Date created, java.util.Date modified)
           
 boolean parse(User user, java.lang.String xml, java.lang.String docName)
           
 boolean parse(User user, java.lang.String xml, java.lang.String docName, int overwrite)
           
 boolean parseLocal(User user, java.lang.String localFile, java.lang.String docName, boolean replace)
          Parse a file previously uploaded with upload.
 boolean parseLocal(User user, java.lang.String localFile, java.lang.String docName, boolean replace, java.util.Date created, java.util.Date modified)
           
 java.lang.String printDiagnostics(User user, java.lang.String query, java.util.Hashtable parameters)
          Returns a diagnostic dump of the expression structure after compiling the query.
 byte[] query(User user, byte[] xquery, int howmany, int start, java.util.Hashtable parameters)
          execute XPath query and return howmany nodes from the result set, starting at position start.
 java.util.Hashtable queryP(User user, byte[] xpath, java.util.Hashtable parameters)
           
 java.util.Hashtable queryP(User user, byte[] xpath, java.lang.String docName, java.lang.String s_id, java.util.Hashtable parameters)
           
 java.util.Hashtable querySummary(User user, int resultId)
          Retrieve a summary of the result set identified by it's result-set-id.
 java.util.Hashtable querySummary(User user, java.lang.String xpath)
          execute XPath query and return a summary of hits per document and hits per doctype.
 boolean reindexCollection(User user, java.lang.String name)
           
 boolean releaseQueryResult(User user, int handle)
           
 boolean remove(User user, java.lang.String docName)
          remove a document from the repository.
 boolean removeCollection(User user, java.lang.String name)
          Remove an entire collection from the database.
 boolean removeUser(User user, java.lang.String name)
           
 byte[] retrieve(User user, int resultId, int num, java.util.Hashtable parameters)
          Retrieve a single result from the result-set identified by resultId.
 byte[] retrieve(User user, java.lang.String doc, java.lang.String id)
          retrieve a single node from a document.
 byte[] retrieve(User user, java.lang.String doc, java.lang.String id, java.util.Hashtable parameters)
          retrieve a single node from a document.
 byte[] retrieveAll(User user, int resultId, java.util.Hashtable parameters)
           
 java.lang.String retrieveAsString(User user, java.lang.String doc, java.lang.String id, java.util.Hashtable parameters)
           
 java.util.Vector scanIndexTerms(User user, java.lang.String xpath, java.lang.String start, java.lang.String end)
           
 java.util.Vector scanIndexTerms(User user, java.lang.String collectionName, java.lang.String start, java.lang.String end, boolean inclusive)
           
 boolean setDocType(User user, java.lang.String documentName, java.lang.String doctypename, java.lang.String publicid, java.lang.String systemid)
           
 boolean setPermissions(User user, java.lang.String resource, int permissions)
           
 boolean setPermissions(User user, java.lang.String resource, java.lang.String permissions)
          Sets the permissions attribute of the RpcServer object
 boolean setPermissions(User user, java.lang.String resource, java.lang.String owner, java.lang.String ownerGroup, int permissions)
           
 boolean setPermissions(User user, java.lang.String resource, java.lang.String owner, java.lang.String ownerGroup, java.lang.String permissions)
          Sets the permissions attribute of the RpcServer object
 boolean setUser(User user, java.lang.String name, java.lang.String password, java.lang.String digestPassword, java.util.Vector groups)
           
 boolean setUser(User user, java.lang.String name, java.lang.String password, java.lang.String digestPassword, java.util.Vector groups, java.lang.String home)
          Sets the password attribute of the RpcServer object
 boolean shutdown(User user)
          Shut down the database immediately.
 boolean shutdown(User user, long delay)
          Shut down the database after the specified delay (in milliseconds).
 boolean storeBinary(User user, byte[] data, java.lang.String docName, java.lang.String mimeType, boolean replace)
          Store data as a binary resource.
 boolean storeBinary(User user, byte[] data, java.lang.String docName, java.lang.String mimeType, boolean replace, java.util.Date created, java.util.Date modified)
           
 boolean sync(User user)
           
 boolean unlockResource(User user, java.lang.String path)
           
 java.lang.String upload(User user, byte[] data, int length)
          An alternative to parse() for larger XML documents.
 java.lang.String upload(User user, java.lang.String file, byte[] data, int length)
          An alternative to parse() for larger XML documents.
 java.lang.String uploadCompressed(User user, byte[] data, int length)
           
 java.lang.String uploadCompressed(User user, java.lang.String file, byte[] data, int length)
           
 int xupdate(User user, java.lang.String collectionName, byte[] xupdate)
           
 int xupdateResource(User user, java.lang.String resource, byte[] xupdate)
           
 int xupdateResource(User user, java.lang.String resource, byte[] xupdate, java.lang.String encoding)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcServer

public RpcServer(Configuration conf,
                 java.lang.String databaseid)
          throws EXistException
Constructor for the RpcServer object

Parameters:
conf - Description of the Parameter
Throws:
EXistException - Description of the Exception
Method Detail

createCollection

public boolean createCollection(User user,
                                java.lang.String name)
                         throws EXistException,
                                PermissionDeniedException
Description copied from interface: RpcAPI
Create a new collection on the database.

Specified by:
createCollection in interface RpcAPI
Parameters:
user -
name - the path to the new collection.
Throws:
PermissionDeniedException
EXistException

createCollection

public boolean createCollection(User user,
                                java.lang.String name,
                                java.util.Date created)
                         throws EXistException,
                                PermissionDeniedException
Specified by:
createCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

createId

public java.lang.String createId(User user,
                                 java.lang.String collection)
                          throws EXistException,
                                 PermissionDeniedException,
                                 java.net.URISyntaxException
Throws:
EXistException
PermissionDeniedException
java.net.URISyntaxException

executeQuery

public int executeQuery(User user,
                        java.lang.String xpath,
                        java.util.Hashtable parameters)
                 throws EXistException,
                        PermissionDeniedException
Specified by:
executeQuery in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

executeQuery

public int executeQuery(User user,
                        byte[] xpath,
                        java.lang.String encoding,
                        java.util.Hashtable parameters)
                 throws EXistException,
                        PermissionDeniedException
Description copied from interface: RpcAPI
Execute XPath query and return a reference to the result set. The returned reference may be used later to get a summary of results or retrieve the actual hits.

Specified by:
executeQuery in interface RpcAPI
Parameters:
xpath - Description of the Parameter
encoding - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

executeQuery

public int executeQuery(User user,
                        byte[] xpath,
                        java.util.Hashtable parameters)
                 throws EXistException,
                        PermissionDeniedException
Specified by:
executeQuery in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getCollectionDesc

public java.util.Hashtable getCollectionDesc(User user,
                                             java.lang.String rootCollection)
                                      throws EXistException,
                                             PermissionDeniedException
Description copied from interface: RpcAPI
Describe a collection: returns a struct with the following fields:
	name				The name of the collection
	
	owner				The name of the user owning the collection.
	
	group				The group owning the collection.
	
	permissions	The permissions that apply to this collection (int value)
	
	created			The creation date of this collection (long value)
	
	collections		An array containing the names of all subcollections.
	
	documents		An array containing a struct for each document in the collection.
	
Each of the elements in the "documents" array is another struct containing the properties of the document:
	name				The full path of the document.
	
	owner				The name of the user owning the document.
	
	group				The group owning the document.
	
	permissions	The permissions that apply to this document (int)
	
	type					Type of the resource: either "XMLResource" or "BinaryResource"
	

Specified by:
getCollectionDesc in interface RpcAPI
Parameters:
rootCollection - Description of the Parameter
user - Description of the Parameter
Returns:
The collectionDesc value
Throws:
PermissionDeniedException - Description of the Exception
EXistException - Description of the Exception

describeResource

public java.util.Hashtable describeResource(User user,
                                            java.lang.String resourceName)
                                     throws EXistException,
                                            PermissionDeniedException
Specified by:
describeResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

describeCollection

public java.util.Hashtable describeCollection(User user,
                                              java.lang.String rootCollection)
                                       throws EXistException,
                                              PermissionDeniedException
Specified by:
describeCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocument

public byte[] getDocument(User user,
                          java.lang.String name,
                          java.lang.String encoding,
                          int prettyPrint)
                   throws EXistException,
                          PermissionDeniedException
Description copied from interface: RpcAPI
Retrieve document by name. XML content is indented if prettyPrint is set to >=0. Use supplied encoding for output. This method is provided to retrieve a document with encodings other than UTF-8. Since the data is handled as binary data, character encodings are preserved. byte[]-values are automatically BASE64-encoded by the XMLRPC library.

Specified by:
getDocument in interface RpcAPI
Parameters:
name - the document's name.
prettyPrint - pretty print XML if >0.
encoding - character encoding to use.
user -
Returns:
Document data as binary array.
Throws:
EXistException
PermissionDeniedException

getDocument

public byte[] getDocument(User user,
                          java.lang.String name,
                          java.lang.String encoding,
                          int prettyPrint,
                          java.lang.String stylesheet)
                   throws EXistException,
                          PermissionDeniedException
Description copied from interface: RpcAPI
Retrieve document by name. XML content is indented if prettyPrint is set to >=0. Use supplied encoding for output and apply the specified stylesheet. This method is provided to retrieve a document with encodings other than UTF-8. Since the data is handled as binary data, character encodings are preserved. byte[]-values are automatically BASE64-encoded by the XMLRPC library.

Specified by:
getDocument in interface RpcAPI
Parameters:
name - the document's name.
prettyPrint - pretty print XML if >0.
encoding - character encoding to use.
user - Description of the Parameter
Returns:
The document value
Throws:
EXistException
PermissionDeniedException

getDocumentAsString

public java.lang.String getDocumentAsString(User user,
                                            java.lang.String name,
                                            int prettyPrint)
                                     throws EXistException,
                                            PermissionDeniedException
Specified by:
getDocumentAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocumentAsString

public java.lang.String getDocumentAsString(User user,
                                            java.lang.String name,
                                            int prettyPrint,
                                            java.lang.String stylesheet)
                                     throws EXistException,
                                            PermissionDeniedException
Specified by:
getDocumentAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getBinaryResource

public byte[] getBinaryResource(User user,
                                java.lang.String name)
                         throws EXistException,
                                PermissionDeniedException
Specified by:
getBinaryResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocumentAsString

public java.lang.String getDocumentAsString(User user,
                                            java.lang.String name,
                                            java.util.Hashtable parameters)
                                     throws EXistException,
                                            PermissionDeniedException
Retrieve a document. The document data is returned as a string.

Specified by:
getDocumentAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocument

public byte[] getDocument(User user,
                          java.lang.String name,
                          java.util.Hashtable parametri)
                   throws EXistException,
                          PermissionDeniedException
Description copied from interface: RpcAPI
Retrieve document by name. All optional output parameters are passed as key/value pairs int the hashtable parameters. Valid keys may either be taken from OutputKeys or EXistOutputKeys. For example, the encoding is identified by the value of key OutputKeys.ENCODING.

Specified by:
getDocument in interface RpcAPI
Parameters:
name - the document's name.
parametri - Hashtable of parameters.
Returns:
The document value
Throws:
EXistException
PermissionDeniedException

getDocumentData

public java.util.Hashtable getDocumentData(User user,
                                           java.lang.String name,
                                           java.util.Hashtable parameters)
                                    throws EXistException,
                                           PermissionDeniedException
Description copied from interface: RpcAPI
Retrieve the specified document, but limit the number of bytes transmitted to avoid memory shortage on the server.

Specified by:
getDocumentData in interface RpcAPI
Parameters:
user -
name -
parameters -
Throws:
PermissionDeniedException
EXistException

getNextChunk

public java.util.Hashtable getNextChunk(User user,
                                        java.lang.String handle,
                                        int offset)
                                 throws EXistException,
                                        PermissionDeniedException
Specified by:
getNextChunk in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocumentListing

public java.util.Vector getDocumentListing(User user)
                                    throws EXistException,
                                           PermissionDeniedException
Description copied from interface: RpcAPI
Get a list of all documents contained in the database.

Specified by:
getDocumentListing in interface RpcAPI
Parameters:
user -
Returns:
list of document paths
Throws:
PermissionDeniedException - Description of the Exception
EXistException - Description of the Exception

getDocumentListing

public java.util.Vector getDocumentListing(User user,
                                           java.lang.String collection)
                                    throws EXistException,
                                           PermissionDeniedException
Description copied from interface: RpcAPI
Get a list of all documents contained in the collection.

Specified by:
getDocumentListing in interface RpcAPI
Parameters:
collection - the collection to use.
user - Description of the Parameter
Returns:
list of document paths
Throws:
PermissionDeniedException - Description of the Exception
EXistException - Description of the Exception

listDocumentPermissions

public java.util.Hashtable listDocumentPermissions(User user,
                                                   java.lang.String name)
                                            throws EXistException,
                                                   PermissionDeniedException
Specified by:
listDocumentPermissions in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

listCollectionPermissions

public java.util.Hashtable listCollectionPermissions(User user,
                                                     java.lang.String name)
                                              throws EXistException,
                                                     PermissionDeniedException
Specified by:
listCollectionPermissions in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getHits

public int getHits(User user,
                   int resultId)
            throws EXistException,
                   PermissionDeniedException
Description copied from interface: RpcAPI
Get the number of hits in the result set identified by it's result-set-id.

Specified by:
getHits in interface RpcAPI
Parameters:
resultId - Description of the Parameter
user - Description of the Parameter
Returns:
The hits value
Throws:
PermissionDeniedException - Description of the Exception
EXistException - Description of the Exception

getPermissions

public java.util.Hashtable getPermissions(User user,
                                          java.lang.String docName)
                                   throws EXistException,
                                          PermissionDeniedException
Specified by:
getPermissions in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getCreationDate

public java.util.Date getCreationDate(User user,
                                      java.lang.String collectionName)
                               throws PermissionDeniedException,
                                      EXistException
Specified by:
getCreationDate in interface RpcAPI
Throws:
PermissionDeniedException
EXistException

getTimestamps

public java.util.Vector getTimestamps(User user,
                                      java.lang.String documentName)
                               throws PermissionDeniedException,
                                      EXistException
Specified by:
getTimestamps in interface RpcAPI
Throws:
PermissionDeniedException
EXistException

getUser

public java.util.Hashtable getUser(User user,
                                   java.lang.String name)
                            throws EXistException,
                                   PermissionDeniedException
Gets the user attribute of the RpcServer object

Specified by:
getUser in interface RpcAPI
Parameters:
user - Description of the Parameter
name - Description of the Parameter
Returns:
The user value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

getUsers

public java.util.Vector getUsers(User user)
                          throws EXistException,
                                 PermissionDeniedException
Specified by:
getUsers in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getGroups

public java.util.Vector getGroups(User user)
                           throws EXistException,
                                  PermissionDeniedException
Specified by:
getGroups in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getIndexedElements

public java.util.Vector getIndexedElements(User user,
                                           java.lang.String collectionName,
                                           boolean inclusive)
                                    throws EXistException,
                                           PermissionDeniedException
Specified by:
getIndexedElements in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

scanIndexTerms

public java.util.Vector scanIndexTerms(User user,
                                       java.lang.String collectionName,
                                       java.lang.String start,
                                       java.lang.String end,
                                       boolean inclusive)
                                throws PermissionDeniedException,
                                       EXistException
Specified by:
scanIndexTerms in interface RpcAPI
Throws:
PermissionDeniedException
EXistException

scanIndexTerms

public java.util.Vector scanIndexTerms(User user,
                                       java.lang.String xpath,
                                       java.lang.String start,
                                       java.lang.String end)
                                throws PermissionDeniedException,
                                       EXistException,
                                       XPathException
Specified by:
scanIndexTerms in interface RpcAPI
Throws:
PermissionDeniedException
EXistException
XPathException

hasDocument

public boolean hasDocument(User user,
                           java.lang.String name)
                    throws EXistException,
                           PermissionDeniedException
does a document called name exist in the repository?

Specified by:
hasDocument in interface RpcAPI
Parameters:
name - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

hasCollection

public boolean hasCollection(User user,
                             java.lang.String name)
                      throws EXistException,
                             PermissionDeniedException
does a document called name exist in the repository?

Specified by:
hasCollection in interface RpcAPI
Parameters:
name - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

getResourceCount

public int getResourceCount(User user,
                            java.lang.String collectionName)
                     throws EXistException,
                            PermissionDeniedException
Description copied from interface: RpcAPI
Returns the number of resources in the collection identified by collectionName.

Specified by:
getResourceCount in interface RpcAPI
Parameters:
collectionName -
user -
Returns:
number of resources
Throws:
PermissionDeniedException
EXistException

parse

public boolean parse(User user,
                     byte[] xmlData,
                     java.lang.String docName)
              throws EXistException,
                     PermissionDeniedException
parse an XML document and store it into the database. The document will later be identified by docName. Some xmlrpc clients seem to have problems with character encodings when sending xml content. To avoid this, parse() accepts the xml document content as byte[].

Specified by:
parse in interface RpcAPI
Parameters:
xmlData - the document's XML content as UTF-8 encoded array of bytes.
docName - the document's name
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

parse

public boolean parse(User user,
                     byte[] xmlData,
                     java.lang.String docName,
                     int overwrite)
              throws EXistException,
                     PermissionDeniedException
Description copied from interface: RpcAPI
Parse an XML document and store it into the database. The document will later be identified by docName. Some xmlrpc clients seem to have problems with character encodings when sending xml content. To avoid this, parse() accepts the xml document content as byte[]. If overwrite is >0, an existing document with the same name will be replaced by the new document.

Specified by:
parse in interface RpcAPI
Parameters:
xmlData - The document data
docName - The path where the document will be stored
overwrite - Overwrite an existing document with the same path?
Throws:
PermissionDeniedException
EXistException

parse

public boolean parse(User user,
                     byte[] xmlData,
                     java.lang.String docName,
                     int overwrite,
                     java.util.Date created,
                     java.util.Date modified)
              throws EXistException,
                     PermissionDeniedException
Specified by:
parse in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

parse

public boolean parse(User user,
                     java.lang.String xml,
                     java.lang.String docName,
                     int overwrite)
              throws EXistException,
                     PermissionDeniedException
Specified by:
parse in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

parseLocal

public boolean parseLocal(User user,
                          java.lang.String localFile,
                          java.lang.String docName,
                          boolean replace)
                   throws EXistException,
                          PermissionDeniedException,
                          org.xml.sax.SAXException
Parse a file previously uploaded with upload. The temporary file will be removed.

Specified by:
parseLocal in interface RpcAPI
Parameters:
user -
localFile -
Throws:
EXistException
java.io.IOException
PermissionDeniedException
org.xml.sax.SAXException

parseLocal

public boolean parseLocal(User user,
                          java.lang.String localFile,
                          java.lang.String docName,
                          boolean replace,
                          java.util.Date created,
                          java.util.Date modified)
                   throws EXistException,
                          PermissionDeniedException,
                          org.xml.sax.SAXException
Specified by:
parseLocal in interface RpcAPI
Throws:
EXistException
PermissionDeniedException
org.xml.sax.SAXException

uploadCompressed

public java.lang.String uploadCompressed(User user,
                                         byte[] data,
                                         int length)
                                  throws EXistException,
                                         PermissionDeniedException
Specified by:
uploadCompressed in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

uploadCompressed

public java.lang.String uploadCompressed(User user,
                                         java.lang.String file,
                                         byte[] data,
                                         int length)
                                  throws EXistException,
                                         PermissionDeniedException
Specified by:
uploadCompressed in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

upload

public java.lang.String upload(User user,
                               byte[] data,
                               int length)
                        throws EXistException,
                               PermissionDeniedException
Description copied from interface: RpcAPI
An alternative to parse() for larger XML documents. The document is first uploaded chunk by chunk using upload(), then parseLocal() is called to actually store the uploaded file.

Specified by:
upload in interface RpcAPI
Parameters:
user -
data - the current chunk
length - total length of the file
Returns:
the name of the file to which the chunk has been appended.
Throws:
PermissionDeniedException
EXistException

upload

public java.lang.String upload(User user,
                               java.lang.String file,
                               byte[] data,
                               int length)
                        throws EXistException,
                               PermissionDeniedException
Description copied from interface: RpcAPI
An alternative to parse() for larger XML documents. The document is first uploaded chunk by chunk using upload(), then parseLocal() is called to actually store the uploaded file.

Specified by:
upload in interface RpcAPI
Parameters:
user -
data - the current chunk
file - the name of the file to which the chunk will be appended. This should be the file name returned by the first call to upload.
length - total length of the file
Returns:
the name of the file to which the chunk has been appended.
Throws:
PermissionDeniedException
EXistException

parse

public boolean parse(User user,
                     java.lang.String xml,
                     java.lang.String docName)
              throws EXistException,
                     PermissionDeniedException
Specified by:
parse in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

storeBinary

public boolean storeBinary(User user,
                           byte[] data,
                           java.lang.String docName,
                           java.lang.String mimeType,
                           boolean replace)
                    throws EXistException,
                           PermissionDeniedException
Description copied from interface: RpcAPI
Store data as a binary resource.

Specified by:
storeBinary in interface RpcAPI
Parameters:
user -
data - the data to be stored
docName - the path to the new document
replace - if true, an old document with the same path will be overwritten
Throws:
EXistException
PermissionDeniedException

storeBinary

public boolean storeBinary(User user,
                           byte[] data,
                           java.lang.String docName,
                           java.lang.String mimeType,
                           boolean replace,
                           java.util.Date created,
                           java.util.Date modified)
                    throws EXistException,
                           PermissionDeniedException
Specified by:
storeBinary in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

createResourceId

public java.lang.String createResourceId(User user,
                                         java.lang.String collection)
                                  throws EXistException,
                                         PermissionDeniedException
Specified by:
createResourceId in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

compile

public java.util.Hashtable compile(User user,
                                   byte[] xquery,
                                   java.util.Hashtable parameters)
                            throws java.lang.Exception
Specified by:
compile in interface RpcAPI
Throws:
java.lang.Exception

queryP

public java.util.Hashtable queryP(User user,
                                  byte[] xpath,
                                  java.util.Hashtable parameters)
                           throws EXistException,
                                  PermissionDeniedException
Specified by:
queryP in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

queryP

public java.util.Hashtable queryP(User user,
                                  byte[] xpath,
                                  java.lang.String docName,
                                  java.lang.String s_id,
                                  java.util.Hashtable parameters)
                           throws EXistException,
                                  PermissionDeniedException
Specified by:
queryP in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

execute

public java.util.Hashtable execute(User user,
                                   java.lang.String path,
                                   java.util.Hashtable parameters)
                            throws EXistException,
                                   PermissionDeniedException
Description copied from interface: RpcAPI
Execute XPath/Xquery from path file (stored inside eXist) returned reference may be used later to get a summary of results or retrieve the actual hits.

Specified by:
execute in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

printDiagnostics

public java.lang.String printDiagnostics(User user,
                                         java.lang.String query,
                                         java.util.Hashtable parameters)
                                  throws PermissionDeniedException,
                                         EXistException
Description copied from interface: RpcAPI
Returns a diagnostic dump of the expression structure after compiling the query. The query is read from the query cache if it has already been run before.

Specified by:
printDiagnostics in interface RpcAPI
Parameters:
user -
query -
Throws:
EXistException
PermissionDeniedException

releaseQueryResult

public boolean releaseQueryResult(User user,
                                  int handle)
Specified by:
releaseQueryResult in interface RpcAPI

query

public byte[] query(User user,
                    byte[] xquery,
                    int howmany,
                    int start,
                    java.util.Hashtable parameters)
             throws EXistException,
                    PermissionDeniedException
execute XPath query and return howmany nodes from the result set, starting at position start. If prettyPrint is set to >0 (true), results are pretty printed.

Specified by:
query in interface RpcAPI
Parameters:
xquery -
parameters -
howmany - maximum number of results to return.
start - item in the result set to start with.
user -
Throws:
EXistException
PermissionDeniedException

querySummary

public java.util.Hashtable querySummary(User user,
                                        int resultId)
                                 throws EXistException,
                                        PermissionDeniedException,
                                        XPathException
Description copied from interface: RpcAPI
Retrieve a summary of the result set identified by it's result-set-id. This method returns a struct with the following fields: "queryTime" int "hits" int "documents" array of array: Object[][3] "doctypes" array of array: Object[][2] Documents and doctypes represent tables where each row describes one document or doctype for which hits were found. Each document entry has the following structure: docId (int), docName (string), hits (int) The doctype entry has this structure: doctypeName (string), hits (int)

Specified by:
querySummary in interface RpcAPI
Parameters:
resultId - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
PermissionDeniedException - Description of the Exception
EXistException - Description of the Exception
XPathException

querySummary

public java.util.Hashtable querySummary(User user,
                                        java.lang.String xpath)
                                 throws EXistException,
                                        PermissionDeniedException
execute XPath query and return a summary of hits per document and hits per doctype. This method returns a struct with the following fields: "queryTime" int "hits" int "documents" array of array: Object[][3] "doctypes" array of array: Object[][2] Documents and doctypes represent tables where each row describes one document or doctype for which hits were found. Each document entry has the following structure: docId (int), docName (string), hits (int) The doctype entry has this structure: doctypeName (string), hits (int)

Specified by:
querySummary in interface RpcAPI
Parameters:
xpath - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

remove

public boolean remove(User user,
                      java.lang.String docName)
               throws EXistException,
                      PermissionDeniedException
remove a document from the repository.

Specified by:
remove in interface RpcAPI
Parameters:
docName - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

copyCollection

public boolean copyCollection(User user,
                              java.lang.String collectionPath,
                              java.lang.String destinationPath,
                              java.lang.String newName)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
copyCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

moveCollection

public boolean moveCollection(User user,
                              java.lang.String collectionPath,
                              java.lang.String destinationPath,
                              java.lang.String newName)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
moveCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

moveResource

public boolean moveResource(User user,
                            java.lang.String docPath,
                            java.lang.String destinationPath,
                            java.lang.String newName)
                     throws EXistException,
                            PermissionDeniedException
Specified by:
moveResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

copyResource

public boolean copyResource(User user,
                            java.lang.String docPath,
                            java.lang.String destinationPath,
                            java.lang.String newName)
                     throws EXistException,
                            PermissionDeniedException
Specified by:
copyResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

removeCollection

public boolean removeCollection(User user,
                                java.lang.String name)
                         throws EXistException,
                                PermissionDeniedException
Description copied from interface: RpcAPI
Remove an entire collection from the database.

Specified by:
removeCollection in interface RpcAPI
Parameters:
name - path to the collection to be removed.
user -
Throws:
EXistException
PermissionDeniedException

removeUser

public boolean removeUser(User user,
                          java.lang.String name)
                   throws EXistException,
                          PermissionDeniedException
Specified by:
removeUser in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

retrieve

public byte[] retrieve(User user,
                       java.lang.String doc,
                       java.lang.String id)
                throws EXistException,
                       PermissionDeniedException
retrieve a single node from a document. The node is identified by it's internal id.

Specified by:
retrieve in interface RpcAPI
Parameters:
doc - the document containing the node
id - the node's internal id
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

retrieve

public byte[] retrieve(User user,
                       java.lang.String doc,
                       java.lang.String id,
                       java.util.Hashtable parameters)
                throws EXistException,
                       PermissionDeniedException
retrieve a single node from a document. The node is identified by it's internal id.

Specified by:
retrieve in interface RpcAPI
Parameters:
doc - the document containing the node
id - the node's internal id
user - Description of the Parameter
parameters -
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

retrieveAsString

public java.lang.String retrieveAsString(User user,
                                         java.lang.String doc,
                                         java.lang.String id,
                                         java.util.Hashtable parameters)
                                  throws EXistException,
                                         PermissionDeniedException
Specified by:
retrieveAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

retrieve

public byte[] retrieve(User user,
                       int resultId,
                       int num,
                       java.util.Hashtable parameters)
                throws EXistException,
                       PermissionDeniedException
Description copied from interface: RpcAPI
Retrieve a single result from the result-set identified by resultId. The XML fragment at position num in the result set is returned.

Specified by:
retrieve in interface RpcAPI
Parameters:
parameters -
resultId -
num -
user -
Returns:
Description of the Return Value
Throws:
EXistException
PermissionDeniedException

retrieveAll

public byte[] retrieveAll(User user,
                          int resultId,
                          java.util.Hashtable parameters)
                   throws EXistException,
                          PermissionDeniedException
Specified by:
retrieveAll in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

setPermissions

public boolean setPermissions(User user,
                              java.lang.String resource,
                              java.lang.String permissions)
                       throws EXistException,
                              PermissionDeniedException
Sets the permissions attribute of the RpcServer object

Specified by:
setPermissions in interface RpcAPI
Parameters:
user - The new permissions value
resource - The new permissions value
permissions - The new permissions value
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

setPermissions

public boolean setPermissions(User user,
                              java.lang.String resource,
                              java.lang.String owner,
                              java.lang.String ownerGroup,
                              java.lang.String permissions)
                       throws EXistException,
                              PermissionDeniedException
Sets the permissions attribute of the RpcServer object

Specified by:
setPermissions in interface RpcAPI
Parameters:
user - The new permissions value
resource - The new permissions value
permissions - The new permissions value
owner - The new permissions value
ownerGroup - The new permissions value
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

setPermissions

public boolean setPermissions(User user,
                              java.lang.String resource,
                              int permissions)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
setPermissions in interface RpcAPI
Throws:
EXistException
PermissionDeniedException
See Also:
RpcAPI.setPermissions(org.exist.security.User, java.lang.String, int)

setPermissions

public boolean setPermissions(User user,
                              java.lang.String resource,
                              java.lang.String owner,
                              java.lang.String ownerGroup,
                              int permissions)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
setPermissions in interface RpcAPI
Throws:
EXistException
PermissionDeniedException
See Also:
RpcAPI.setPermissions(org.exist.security.User, java.lang.String, java.lang.String, java.lang.String, int)

setUser

public boolean setUser(User user,
                       java.lang.String name,
                       java.lang.String password,
                       java.lang.String digestPassword,
                       java.util.Vector groups,
                       java.lang.String home)
                throws EXistException,
                       PermissionDeniedException
Sets the password attribute of the RpcServer object

Specified by:
setUser in interface RpcAPI
Parameters:
user - The new password value
name - The new password value
password - The new password value
groups - The new user value
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

setUser

public boolean setUser(User user,
                       java.lang.String name,
                       java.lang.String password,
                       java.lang.String digestPassword,
                       java.util.Vector groups)
                throws EXistException,
                       PermissionDeniedException
Specified by:
setUser in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

xupdate

public int xupdate(User user,
                   java.lang.String collectionName,
                   byte[] xupdate)
            throws PermissionDeniedException,
                   EXistException,
                   org.xml.sax.SAXException
Specified by:
xupdate in interface RpcAPI
Throws:
PermissionDeniedException
EXistException
org.xml.sax.SAXException

xupdateResource

public int xupdateResource(User user,
                           java.lang.String resource,
                           byte[] xupdate)
                    throws PermissionDeniedException,
                           EXistException,
                           org.xml.sax.SAXException
Specified by:
xupdateResource in interface RpcAPI
Throws:
PermissionDeniedException
EXistException
org.xml.sax.SAXException

xupdateResource

public int xupdateResource(User user,
                           java.lang.String resource,
                           byte[] xupdate,
                           java.lang.String encoding)
                    throws PermissionDeniedException,
                           EXistException,
                           org.xml.sax.SAXException
Specified by:
xupdateResource in interface RpcAPI
Throws:
PermissionDeniedException
EXistException
org.xml.sax.SAXException

shutdown

public boolean shutdown(User user)
                 throws PermissionDeniedException
Description copied from interface: RpcAPI
Shut down the database immediately.

Specified by:
shutdown in interface RpcAPI
Returns:
true if the shutdown succeeded, false otherwise
Throws:
PermissionDeniedException

shutdown

public boolean shutdown(User user,
                        long delay)
                 throws PermissionDeniedException
Description copied from interface: RpcAPI
Shut down the database after the specified delay (in milliseconds).

Specified by:
shutdown in interface RpcAPI
Returns:
true if the shutdown succeeded, false otherwise
Throws:
PermissionDeniedException

sync

public boolean sync(User user)
Specified by:
sync in interface RpcAPI

isXACMLEnabled

public boolean isXACMLEnabled(User user)
Description copied from interface: RpcAPI
Returns true if XACML is enabled for the current database instance

Specified by:
isXACMLEnabled in interface RpcAPI
Returns:
if XACML is enabled

dataBackup

public boolean dataBackup(User user,
                          java.lang.String dest)
                   throws PermissionDeniedException
Specified by:
dataBackup in interface RpcAPI
Throws:
PermissionDeniedException

copyCollection

public boolean copyCollection(User user,
                              java.lang.String name,
                              java.lang.String namedest)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
copyCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

lockResource

public boolean lockResource(User user,
                            java.lang.String path,
                            java.lang.String userName)
                     throws EXistException,
                            PermissionDeniedException
Specified by:
lockResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

hasUserLock

public java.lang.String hasUserLock(User user,
                                    java.lang.String path)
                             throws EXistException,
                                    PermissionDeniedException
Specified by:
hasUserLock in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

unlockResource

public boolean unlockResource(User user,
                              java.lang.String path)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
unlockResource in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocumentChunk

public java.util.Vector getDocumentChunk(User user,
                                         java.lang.String name,
                                         java.util.Hashtable parameters)
                                  throws EXistException,
                                         PermissionDeniedException,
                                         java.io.IOException
Specified by:
getDocumentChunk in interface RpcAPI
Throws:
EXistException
PermissionDeniedException
java.io.IOException

getDocumentChunk

public byte[] getDocumentChunk(User user,
                               java.lang.String name,
                               int start,
                               int len)
                        throws EXistException,
                               PermissionDeniedException,
                               java.io.IOException
Specified by:
getDocumentChunk in interface RpcAPI
Throws:
EXistException
PermissionDeniedException
java.io.IOException

reindexCollection

public boolean reindexCollection(User user,
                                 java.lang.String name)
                          throws EXistException,
                                 PermissionDeniedException
Specified by:
reindexCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

backup

public boolean backup(User user,
                      java.lang.String userbackup,
                      java.lang.String password,
                      java.lang.String destcollection,
                      java.lang.String collection)
               throws EXistException,
                      PermissionDeniedException
Specified by:
backup in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

configureCollection

public boolean configureCollection(User user,
                                   java.lang.String collection,
                                   java.lang.String configuration)
                            throws EXistException,
                                   PermissionDeniedException
Specified by:
configureCollection in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

isValid

public boolean isValid(User user,
                       java.lang.String name)
                throws EXistException,
                       PermissionDeniedException
Specified by:
isValid in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocType

public java.util.Vector getDocType(User user,
                                   java.lang.String documentName)
                            throws PermissionDeniedException,
                                   EXistException
Specified by:
getDocType in interface RpcAPI
Throws:
PermissionDeniedException
EXistException

setDocType

public boolean setDocType(User user,
                          java.lang.String documentName,
                          java.lang.String doctypename,
                          java.lang.String publicid,
                          java.lang.String systemid)
                   throws EXistException,
                          PermissionDeniedException
Specified by:
setDocType in interface RpcAPI
Throws:
EXistException
PermissionDeniedException


Copyright (C) Wolfgang Meier. All rights reserved.