org.exist.xmlrpc
Class RpcConnection

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.exist.xmlrpc.RpcConnection
All Implemented Interfaces:
java.lang.Runnable

public class RpcConnection
extends java.lang.Thread

Description of the Class

Author:
wolf

Field Summary
protected  BrokerPool brokerPool
           
protected  org.exist.xmlrpc.RpcServer.ConnectionPool connectionPool
           
protected  javax.xml.parsers.DocumentBuilder docBuilder
           
protected  java.util.WeakHashMap documentCache
           
protected  Parser parser
           
protected  java.util.TreeMap tempFiles
           
protected  boolean terminate
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RpcConnection(Configuration conf, org.exist.xmlrpc.RpcServer.ConnectionPool pool)
          Constructor for the RpcConnection object
 
Method Summary
 void createCollection(User user, java.lang.String name)
          Description of the Method
 java.lang.String createId(User user, java.lang.String collName)
          Description of the Method
protected  Value doQuery(User user, java.lang.String xpath, DocumentSet docs, NodeSet context)
          Description of the Method
 int executeQuery(User user, java.lang.String xpath)
           
protected  java.lang.String formatErrorMsg(java.lang.String message)
          Description of the Method
protected  java.lang.String formatErrorMsg(java.lang.String type, java.lang.String message)
           
 java.util.Hashtable getCollectionDesc(User user, java.lang.String rootCollection)
           
 java.util.Date getCreationDate(User user, java.lang.String collectionPath)
           
 java.lang.String getDocument(User user, java.lang.String name, boolean prettyPrint, java.lang.String encoding, java.lang.String stylesheet)
           
 java.util.Vector getDocumentListing(User user)
          Gets the documentListing attribute of the RpcConnection object
 java.util.Vector getDocumentListing(User user, java.lang.String name)
          Gets the documentListing attribute of the RpcConnection object
 java.util.Vector getGroups(User user)
           
 int getHits(User user, int resultId)
          Gets the hits attribute of the RpcConnection object
 java.util.Vector getIndexedElements(User user, java.lang.String collectionName, boolean inclusive)
           
 java.util.Hashtable getPermissions(User user, java.lang.String name)
          Get permissions for the given collection or resource
 java.util.Vector getTimestamps(User user, java.lang.String documentPath)
           
 java.util.Hashtable getUser(User user, java.lang.String name)
          Gets the permissions attribute of the RpcConnection object
 java.util.Vector getUsers(User user)
           
 boolean hasDocument(User user, java.lang.String name)
           
 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[] xml, java.lang.String docName, boolean replace)
           
 boolean parseLocal(User user, java.lang.String localFile, java.lang.String docName, boolean replace)
          Parse a file previously uploaded with upload.
protected  java.lang.String printAll(DBBroker broker, org.w3c.dom.NodeList resultSet, int howmany, int start, boolean prettyPrint, long queryTime, java.lang.String encoding)
           
protected  java.lang.String printValues(ValueSet resultSet, int howmany, int start, boolean prettyPrint, java.lang.String encoding)
           
 java.util.Vector query(User user, java.lang.String xpath)
           
 java.lang.String query(User user, java.lang.String xpath, int howmany, int start, boolean prettyPrint, boolean summary, java.lang.String encoding)
           
 java.lang.String query(User user, java.lang.String xpath, int howmany, int start, boolean prettyPrint, boolean summary, java.lang.String encoding, java.lang.String sortExpr)
           
 java.util.Vector query(User user, java.lang.String xpath, java.lang.String docName, java.lang.String s_id)
           
 java.util.Hashtable queryP(User user, java.lang.String xpath, java.lang.String docName, java.lang.String s_id, java.lang.String sortBy)
           
 void releaseQueryResult(int handle)
           
 void remove(User user, java.lang.String docName)
           
 boolean removeCollection(User user, java.lang.String name)
           
 boolean removeUser(User user, java.lang.String name)
           
 java.lang.String retrieve(User user, int resultId, int num, boolean prettyPrint, java.lang.String encoding)
          Description of the Method
 java.lang.String retrieve(User user, java.lang.String docName, java.lang.String s_id, boolean prettyPrint, java.lang.String encoding)
           
 void run()
           
 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, 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 RpcConnection object
 boolean setUser(User user, java.lang.String name, java.lang.String passwd, java.util.Vector groups, java.lang.String home)
          Sets the password attribute of the RpcConnection object
 java.util.Hashtable summary(User user, int resultId)
          Description of the Method
 java.util.Hashtable summary(User user, java.lang.String xpath)
          Description of the Method
 boolean sync()
           
 void synchronize()
           
 void terminate()
           
 java.lang.String upload(User user, byte[] chunk, int length, java.lang.String fileName)
           
 int xupdate(User user, java.lang.String collectionName, java.lang.String xupdate)
           
 int xupdateResource(User user, java.lang.String resource, java.lang.String xupdate)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

brokerPool

protected BrokerPool brokerPool

documentCache

protected java.util.WeakHashMap documentCache

parser

protected Parser parser

terminate

protected boolean terminate

docBuilder

protected javax.xml.parsers.DocumentBuilder docBuilder

connectionPool

protected org.exist.xmlrpc.RpcServer.ConnectionPool connectionPool

tempFiles

protected java.util.TreeMap tempFiles
Constructor Detail

RpcConnection

public RpcConnection(Configuration conf,
                     org.exist.xmlrpc.RpcServer.ConnectionPool pool)
              throws EXistException
Constructor for the RpcConnection object

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

createCollection

public void createCollection(User user,
                             java.lang.String name)
                      throws java.lang.Exception,
                             PermissionDeniedException
Description of the Method

Parameters:
name - Description of the Parameter
user - Description of the Parameter
Throws:
java.lang.Exception - Description of the Exception
PermissionDeniedException - Description of the Exception

createId

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

Parameters:
collName - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception

doQuery

protected Value doQuery(User user,
                        java.lang.String xpath,
                        DocumentSet docs,
                        NodeSet context)
                 throws java.lang.Exception
Description of the Method

Parameters:
xpath - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.lang.Exception - Description of the Exception

executeQuery

public int executeQuery(User user,
                        java.lang.String xpath)
                 throws java.lang.Exception
Throws:
java.lang.Exception

formatErrorMsg

protected java.lang.String formatErrorMsg(java.lang.String message)
Description of the Method

Parameters:
message - Description of the Parameter
Returns:
Description of the Return Value

formatErrorMsg

protected java.lang.String formatErrorMsg(java.lang.String type,
                                          java.lang.String message)

getCollectionDesc

public java.util.Hashtable getCollectionDesc(User user,
                                             java.lang.String rootCollection)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getDocument

public java.lang.String getDocument(User user,
                                    java.lang.String name,
                                    boolean prettyPrint,
                                    java.lang.String encoding,
                                    java.lang.String stylesheet)
                             throws java.lang.Exception
Throws:
java.lang.Exception

xupdate

public int xupdate(User user,
                   java.lang.String collectionName,
                   java.lang.String xupdate)
            throws EXistException,
                   PermissionDeniedException,
                   org.xml.sax.SAXException
Throws:
EXistException
PermissionDeniedException
org.xml.sax.SAXException

xupdateResource

public int xupdateResource(User user,
                           java.lang.String resource,
                           java.lang.String xupdate)
                    throws EXistException,
                           PermissionDeniedException,
                           org.xml.sax.SAXException
Throws:
EXistException
PermissionDeniedException
org.xml.sax.SAXException

sync

public boolean sync()

getDocumentListing

public java.util.Vector getDocumentListing(User user)
                                    throws EXistException
Gets the documentListing attribute of the RpcConnection object

Parameters:
user - Description of the Parameter
Returns:
The documentListing value
Throws:
EXistException - Description of the Exception

getDocumentListing

public java.util.Vector getDocumentListing(User user,
                                           java.lang.String name)
                                    throws EXistException,
                                           PermissionDeniedException
Gets the documentListing attribute of the RpcConnection object

Parameters:
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
Throws:
EXistException
PermissionDeniedException

listCollectionPermissions

public java.util.Hashtable listCollectionPermissions(User user,
                                                     java.lang.String name)
                                              throws EXistException,
                                                     PermissionDeniedException
Throws:
EXistException
PermissionDeniedException

getHits

public int getHits(User user,
                   int resultId)
            throws EXistException
Gets the hits attribute of the RpcConnection object

Parameters:
resultId - Description of the Parameter
user - Description of the Parameter
Returns:
The hits value
Throws:
EXistException - Description of the Exception

getPermissions

public java.util.Hashtable getPermissions(User user,
                                          java.lang.String name)
                                   throws EXistException,
                                          PermissionDeniedException
Get permissions for the given collection or resource

Parameters:
name - 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 collectionPath)
                               throws PermissionDeniedException,
                                      EXistException
Throws:
PermissionDeniedException
EXistException

getTimestamps

public java.util.Vector getTimestamps(User user,
                                      java.lang.String documentPath)
                               throws PermissionDeniedException,
                                      EXistException
Throws:
PermissionDeniedException
EXistException

getUser

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

Parameters:
user - Description of the Parameter
name - Description of the Parameter
Returns:
The permissions value
Throws:
EXistException - Description of the Exception
PermissionDeniedException - Description of the Exception

getUsers

public java.util.Vector getUsers(User user)
                          throws EXistException,
                                 PermissionDeniedException
Throws:
EXistException
PermissionDeniedException

getGroups

public java.util.Vector getGroups(User user)
                           throws EXistException,
                                  PermissionDeniedException
Throws:
EXistException
PermissionDeniedException

hasDocument

public boolean hasDocument(User user,
                           java.lang.String name)
                    throws java.lang.Exception
Throws:
java.lang.Exception

parse

public boolean parse(User user,
                     byte[] xml,
                     java.lang.String docName,
                     boolean replace)
              throws java.lang.Exception
Throws:
java.lang.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.

Parameters:
user -
localFile -
Throws:
EXistException
java.io.IOException
PermissionDeniedException
org.xml.sax.SAXException

upload

public java.lang.String upload(User user,
                               byte[] chunk,
                               int length,
                               java.lang.String fileName)
                        throws EXistException,
                               java.io.IOException
Throws:
EXistException
java.io.IOException

printAll

protected java.lang.String printAll(DBBroker broker,
                                    org.w3c.dom.NodeList resultSet,
                                    int howmany,
                                    int start,
                                    boolean prettyPrint,
                                    long queryTime,
                                    java.lang.String encoding)
                             throws java.lang.Exception
Throws:
java.lang.Exception

printValues

protected java.lang.String printValues(ValueSet resultSet,
                                       int howmany,
                                       int start,
                                       boolean prettyPrint,
                                       java.lang.String encoding)
                                throws java.lang.Exception
Throws:
java.lang.Exception

query

public java.lang.String query(User user,
                              java.lang.String xpath,
                              int howmany,
                              int start,
                              boolean prettyPrint,
                              boolean summary,
                              java.lang.String encoding)
                       throws java.lang.Exception
Throws:
java.lang.Exception

query

public java.lang.String query(User user,
                              java.lang.String xpath,
                              int howmany,
                              int start,
                              boolean prettyPrint,
                              boolean summary,
                              java.lang.String encoding,
                              java.lang.String sortExpr)
                       throws java.lang.Exception
Throws:
java.lang.Exception

query

public java.util.Vector query(User user,
                              java.lang.String xpath)
                       throws java.lang.Exception
Throws:
java.lang.Exception

query

public java.util.Vector query(User user,
                              java.lang.String xpath,
                              java.lang.String docName,
                              java.lang.String s_id)
                       throws java.lang.Exception
Throws:
java.lang.Exception

queryP

public java.util.Hashtable queryP(User user,
                                  java.lang.String xpath,
                                  java.lang.String docName,
                                  java.lang.String s_id,
                                  java.lang.String sortBy)
                           throws java.lang.Exception
Throws:
java.lang.Exception

releaseQueryResult

public void releaseQueryResult(int handle)

remove

public void remove(User user,
                   java.lang.String docName)
            throws java.lang.Exception
Throws:
java.lang.Exception

removeCollection

public boolean removeCollection(User user,
                                java.lang.String name)
                         throws java.lang.Exception
Throws:
java.lang.Exception

removeUser

public boolean removeUser(User user,
                          java.lang.String name)
                   throws EXistException,
                          PermissionDeniedException
Throws:
EXistException
PermissionDeniedException

retrieve

public java.lang.String retrieve(User user,
                                 java.lang.String docName,
                                 java.lang.String s_id,
                                 boolean prettyPrint,
                                 java.lang.String encoding)
                          throws java.lang.Exception
Throws:
java.lang.Exception

retrieve

public java.lang.String retrieve(User user,
                                 int resultId,
                                 int num,
                                 boolean prettyPrint,
                                 java.lang.String encoding)
                          throws java.lang.Exception
Description of the Method

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:
java.lang.Exception - Description of the Exception

run

public void run()

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 RpcConnection object

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,
                              java.lang.String owner,
                              java.lang.String ownerGroup,
                              int permissions)
                       throws EXistException,
                              PermissionDeniedException
Throws:
EXistException
PermissionDeniedException

setUser

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

Parameters:
user - The new password value
name - The new password value
passwd - 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

summary

public java.util.Hashtable summary(User user,
                                   java.lang.String xpath)
                            throws java.lang.Exception
Description of the Method

Parameters:
xpath - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.lang.Exception - Description of the Exception

summary

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

Parameters:
resultId - Description of the Parameter
user - Description of the Parameter
Returns:
Description of the Return Value
Throws:
EXistException - Description of the Exception

getIndexedElements

public java.util.Vector getIndexedElements(User user,
                                           java.lang.String collectionName,
                                           boolean inclusive)
                                    throws EXistException,
                                           PermissionDeniedException
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
Throws:
PermissionDeniedException
EXistException

synchronize

public void synchronize()

terminate

public void terminate()


Copyright (C) Wolfgang Meier. All rights reserved.