com.centrasite.registry.revision.query
Class RevisionQuery

java.lang.Object
  extended by com.centrasite.registry.revision.query.RevisionQuery

public final class RevisionQuery
extends java.lang.Object

Handles and executes xqueries. The queries are usually given in a separate file.


Field Summary
static java.lang.String PREFIX_CSTYPE
           
static java.lang.String PREFIX_SYSTEM
           
 
Constructor Summary
RevisionQuery(javax.xml.registry.Connection connection)
          The simple constructor.
 
Method Summary
 javax.xml.registry.Connection getConnection()
           
static java.lang.String getMajorElement(boolean versionable)
          Get the majorVersion XML element for using in xquery.
static java.lang.String getMinorElement(boolean versionable)
          Get the minorVersion XML element for using in xquery.
 java.lang.String getQueryFromFile(java.lang.String queryFile)
          Get the XQUERY content of the specified file.
 java.lang.String replaceDoctypeInQuery(java.lang.String query, RevisionDoctypeQuery revDQ)
          Replace the doctype and the namespace declaration in given xquery with the values of RevisionDoctypeQuery.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_SYSTEM

public static final java.lang.String PREFIX_SYSTEM
See Also:
Constant Field Values

PREFIX_CSTYPE

public static final java.lang.String PREFIX_CSTYPE
See Also:
Constant Field Values
Constructor Detail

RevisionQuery

public RevisionQuery(javax.xml.registry.Connection connection)
The simple constructor.

Parameters:
connection - open jaxr connection
Method Detail

getConnection

public javax.xml.registry.Connection getConnection()

getQueryFromFile

public java.lang.String getQueryFromFile(java.lang.String queryFile)
                                  throws java.io.IOException
Get the XQUERY content of the specified file. The file should contain a valid XQUERY flow without the standard namespace declarations. They will be done here.

Parameters:
queryFile - file name of locatable file with xquery code
Returns:
the full query
Throws:
java.io.IOException

replaceDoctypeInQuery

public java.lang.String replaceDoctypeInQuery(java.lang.String query,
                                              RevisionDoctypeQuery revDQ)
Replace the doctype and the namespace declaration in given xquery with the values of RevisionDoctypeQuery. Assumes: __NSECL__ for $i in collection("v.CentraSite")/__DOCTYPE__

Parameters:
query - a xquery with __NSDECL__ and __DOCTYPE__
revDQ - the doctype query environment
Returns:
the modified xquery

getMajorElement

public static java.lang.String getMajorElement(boolean versionable)
Get the majorVersion XML element for using in xquery.

Parameters:
versionable - true: versionable (e.g. RegistryEntry) false: pure RegistryObject
Returns:
major version element, starting with $x

getMinorElement

public static java.lang.String getMinorElement(boolean versionable)
Get the minorVersion XML element for using in xquery.

Parameters:
versionable - true: versionable (e.g. RegistryEntry) false: pure RegistryObject
Returns:
minor version element, starting with $x