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
protected static int MAX_CONNECT
           
protected static int MIN_CONNECT
           
protected  org.exist.xmlrpc.RpcServer.ConnectionPool pool
           
 
Constructor Summary
RpcServer(Configuration conf)
          Constructor for the RpcServer object
 
Method Summary
 boolean createCollection(User user, java.lang.String name)
          Description of the Method
 java.lang.String createId(User user, java.lang.String collection)
          Description of the Method
 int executeQuery(User user, byte[] xpath)
          Description of the Method
 int executeQuery(User user, byte[] xpath, java.lang.String encoding)
          Description of the Method
 int executeQuery(User user, java.lang.String xpath)
          Description of the Method
 java.util.Hashtable getCollectionDesc(User user, java.lang.String rootCollection)
          Gets the collectionDesc attribute of the RpcServer object
 java.util.Date getCreationDate(User user, java.lang.String collectionName)
           
 byte[] getDocument(User user, java.lang.String name, java.lang.String encoding, int prettyPrint)
          This method is provided to retrieve a document with encodings other than UTF-8.
 byte[] getDocument(User user, java.lang.String name, java.lang.String encoding, int prettyPrint, java.lang.String stylesheet)
          This method is provided to retrieve a document with encodings other than UTF-8.
 java.lang.String getDocumentAsString(User user, java.lang.String name, int prettyPrint)
          Retrieve a document.
 java.lang.String getDocumentAsString(User user, java.lang.String name, int prettyPrint, java.lang.String stylesheet)
          Retrieve a document.
 java.util.Vector getDocumentListing(User user)
          get a list of all documents contained in the repository.
 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)
          Gets the hits attribute of the RpcServer object
 java.util.Vector getIndexedElements(User user, java.lang.String collectionName, boolean inclusive)
           
 java.util.Hashtable getPermissions(User user, java.lang.String docName)
          Gets the permissions attribute of the RpcServer object
 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 hasDocument(User user, java.lang.String name)
          does a document called name exist in the repository?
 java.util.Hashtable listCollectionPermissions(User user, java.lang.String name)
           
 java.util.Hashtable listDocumentPermissions(User user, java.lang.String name)
           
 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, java.lang.String xml, java.lang.String docName)
          Description of the Method
 boolean parse(User user, java.lang.String xml, java.lang.String docName, int overwrite)
          Description of the Method
 boolean parseLocal(User user, java.lang.String localFile, java.lang.String docName, boolean replace)
          Parse a file previously uploaded with upload.
 java.util.Vector query(User user, byte[] xpath)
           
 java.util.Vector query(User user, java.lang.String xpath)
          Execute XPath query and return a list of results.
 java.lang.String query(User user, java.lang.String xpath, int howmany, int start, int prettyPrint)
          execute XPath query and return howmany nodes from the result set, starting at position start.
 java.lang.String query(User user, java.lang.String xpath, int howmany, int start, int prettyPrint, java.lang.String sortExpr)
          execute XPath query and return howmany nodes from the result set, starting at position start.
 java.util.Vector query(User user, java.lang.String xpath, java.lang.String docId, java.lang.String s_id)
           
 java.util.Hashtable queryP(User user, byte[] xpath)
           
 java.util.Hashtable queryP(User user, byte[] xpath, byte[] sortExpr)
           
 java.util.Hashtable queryP(User user, byte[] xpath, java.lang.String docName, java.lang.String s_id)
           
 java.util.Hashtable queryP(User user, byte[] xpath, java.lang.String docName, java.lang.String s_id, byte[] sortExpr)
           
 java.util.Hashtable querySummary(User user, int resultId)
          Description of the Method
 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.
 void releaseQueryResult(int handle)
           
 boolean remove(User user, java.lang.String docName)
          remove a document from the repository.
 boolean removeCollection(User user, java.lang.String name)
          Description of the Method
 boolean removeUser(User user, java.lang.String name)
          Description of the Method
 byte[] retrieve(User user, int resultId, int num, int prettyPrint, java.lang.String encoding)
          Description of the Method
 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, int prettyPrint)
          retrieve a single node from a document.
 byte[] retrieve(User user, java.lang.String doc, java.lang.String id, int prettyPrint, java.lang.String encoding)
          retrieve a single node from a document.
 java.lang.String retrieveAsString(User user, java.lang.String doc, java.lang.String id, int prettyPrint)
           
 java.util.Vector scanIndexTerms(User user, java.lang.String collectionName, java.lang.String start, java.lang.String end, boolean inclusive)
           
 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.util.Vector groups)
           
 boolean setUser(User user, java.lang.String name, java.lang.String password, java.util.Vector groups, java.lang.String home)
          Sets the password attribute of the RpcServer object
 boolean shutdown(User user)
          Shut down the database.
 boolean sync(User user)
           
 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.
 int xupdate(User user, java.lang.String collectionName, byte[] xupdate)
           
 int xupdateResource(User user, java.lang.String resource, byte[] xupdate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_CONNECT

protected static final int MIN_CONNECT
See Also:
Constant Field Values

MAX_CONNECT

protected static final int MAX_CONNECT
See Also:
Constant Field Values

pool

protected org.exist.xmlrpc.RpcServer.ConnectionPool pool
Constructor Detail

RpcServer

public RpcServer(Configuration conf)
          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 of the Method

Specified by:
createCollection 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

createId

public java.lang.String createId(User user,
                                 java.lang.String collection)
                          throws EXistException,
                                 PermissionDeniedException
Description of the Method

Parameters:
collection - 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,
                        java.lang.String xpath)
                 throws EXistException,
                        PermissionDeniedException
Description of the Method

Specified by:
executeQuery 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

executeQuery

public int executeQuery(User user,
                        byte[] xpath,
                        java.lang.String encoding)
                 throws EXistException,
                        PermissionDeniedException
Description of the Method

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)
                 throws EXistException,
                        PermissionDeniedException
Description of the Method

Specified by:
executeQuery 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

getCollectionDesc

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

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

getDocument

public byte[] getDocument(User user,
                          java.lang.String name,
                          java.lang.String encoding,
                          int prettyPrint)
                   throws EXistException,
                          PermissionDeniedException
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 - Description of the Parameter
encoding - Description of the Parameter
prettyPrint - Description of the Parameter
user - Description of the Parameter
Returns:
The document value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

getDocument

public byte[] getDocument(User user,
                          java.lang.String name,
                          java.lang.String encoding,
                          int prettyPrint,
                          java.lang.String stylesheet)
                   throws EXistException,
                          PermissionDeniedException
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 - Description of the Parameter
encoding - Description of the Parameter
prettyPrint - Description of the Parameter
stylesheet - Description of the Parameter
user - Description of the Parameter
Returns:
The document value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

getDocumentAsString

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

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
Retrieve a document. The document data is returned as a string.

Specified by:
getDocumentAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

getDocumentListing

public java.util.Vector getDocumentListing(User user)
                                    throws EXistException,
                                           PermissionDeniedException
get a list of all documents contained in the repository.

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

getDocumentListing

public java.util.Vector getDocumentListing(User user,
                                           java.lang.String collection)
                                    throws EXistException,
                                           PermissionDeniedException
get a list of all documents contained in the collection.

Specified by:
getDocumentListing in interface RpcAPI
Parameters:
collection - Description of the Parameter
user - Description of the Parameter
Returns:
The documentListing value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - 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
Gets the hits attribute of the RpcServer object

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

getPermissions

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

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

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

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

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
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
overwrite - replace an existing document with the same name? (1=yes, 0=no)
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,
                     java.lang.String xml,
                     java.lang.String docName,
                     int overwrite)
              throws EXistException,
                     PermissionDeniedException
Description of the Method

Specified by:
parse in interface RpcAPI
Parameters:
xml - Description of the Parameter
docName - Description of the Parameter
overwrite - 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

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

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:
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
length - total length of the file
Returns:
Throws:
PermissionDeniedException
EXistException

parse

public boolean parse(User user,
                     java.lang.String xml,
                     java.lang.String docName)
              throws EXistException,
                     PermissionDeniedException
Description of the Method

Specified by:
parse in interface RpcAPI
Parameters:
xml - Description of the Parameter
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

queryP

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

queryP

public java.util.Hashtable queryP(User user,
                                  byte[] xpath,
                                  byte[] sortExpr)
                           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)
                           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,
                                  byte[] sortExpr)
                           throws EXistException,
                                  PermissionDeniedException
Specified by:
queryP in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

releaseQueryResult

public void releaseQueryResult(int handle)
Specified by:
releaseQueryResult in interface RpcAPI

query

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

query

public java.util.Vector query(User user,
                              java.lang.String xpath)
                       throws EXistException,
                              PermissionDeniedException
Description copied from interface: RpcAPI
Execute XPath query and return a list of results. If the result is a node set, it will be returned as array of String[][2], which represents a two dimensional table. Every row in this table consists of a document-name / node-id pair. e.g.:
hamlet.xml 8398
hamlet.xml 8399

You may use this information with the retrieve-call to retrieve the actual nodes.

Otherwise, if the result is a set of values, each value will be converted to string. In this case the return type is an array of strings String[].

Specified by:
query in interface RpcAPI
Parameters:
xpath - the XPath query to execute.
user -
Returns:
string[][2], if result is a node set, string[] otherwise.
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

query

public java.util.Vector query(User user,
                              java.lang.String xpath,
                              java.lang.String docId,
                              java.lang.String s_id)
                       throws EXistException,
                              PermissionDeniedException
Specified by:
query in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

query

public java.lang.String query(User user,
                              java.lang.String xpath,
                              int howmany,
                              int start,
                              int prettyPrint)
                       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:
xpath - the XPath query to execute
howmany - maximum number of results to return.
start - item in the result set to start with.
prettyPrint - turn on pretty printing if >0.
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

query

public java.lang.String query(User user,
                              java.lang.String xpath,
                              int howmany,
                              int start,
                              int prettyPrint,
                              java.lang.String sortExpr)
                       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:
xpath - the XPath query to execute
howmany - maximum number of results to return.
start - item in the result set to start with.
prettyPrint - turn on pretty printing if >0.
sortExpr - 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

querySummary

public java.util.Hashtable querySummary(User user,
                                        int resultId)
                                 throws EXistException,
                                        PermissionDeniedException
Description of the Method

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

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

removeCollection

public boolean removeCollection(User user,
                                java.lang.String name)
                         throws EXistException,
                                PermissionDeniedException
Description of the Method

Specified by:
removeCollection 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

removeUser

public boolean removeUser(User user,
                          java.lang.String name)
                   throws EXistException,
                          PermissionDeniedException
Description of the Method

Specified by:
removeUser in interface RpcAPI
Parameters:
user - Description of the Parameter
name - 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)
                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,
                       int prettyPrint)
                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
prettyPrint - result is pretty printed if >0
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,
                       int prettyPrint,
                       java.lang.String encoding)
                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
prettyPrint - result is pretty printed if >0
encoding - character encoding to use
user - Description of the Parameter
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,
                                         int prettyPrint)
                                  throws EXistException,
                                         PermissionDeniedException
Specified by:
retrieveAsString in interface RpcAPI
Throws:
EXistException
PermissionDeniedException

retrieve

public byte[] retrieve(User user,
                       int resultId,
                       int num,
                       int prettyPrint,
                       java.lang.String encoding)
                throws EXistException,
                       PermissionDeniedException
Description of the Method

Specified by:
retrieve in interface RpcAPI
Parameters:
resultId - Description of the Parameter
num - Description of the Parameter
prettyPrint - 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

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.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.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

shutdown

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

Specified by:
shutdown in interface RpcAPI
Returns:
boolean
Throws:
PermissionDeniedException

sync

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


Copyright (C) Wolfgang Meier. All rights reserved.