org.exist.validation.internal
Class DatabaseResources

java.lang.Object
  extended byorg.exist.validation.internal.DatabaseResources

public class DatabaseResources
extends java.lang.Object

Helper class for accessing grammars.

Author:
Dannes Wessels

Field Summary
 java.lang.String DTDBASE
           
 java.lang.String DTDCATALOG
           
static java.lang.String FINDCATALOG
           
static java.lang.String FINDDTD
           
static java.lang.String FINDDTDINCATALOG
           
static java.lang.String FINDPUBLICIDINCATALOGS
           
static java.lang.String FINDSCHEMA
           
static java.lang.String FINDXSDINCATALOG
           
static int GRAMMAR_DTD
           
static int GRAMMAR_XSD
           
 java.lang.String GRAMMARBASE
          Path to grammar in database
static java.lang.String NOGRAMMAR
           
static java.lang.String OASISCATALOGURN
           
 java.lang.String XSDBASE
           
 
Constructor Summary
DatabaseResources(BrokerPool pool)
          Creates a new instance of DatabaseResources.
 
Method Summary
 java.util.List getCatalogs(java.lang.String collection)
          Find catalogs in database recursively.
static java.lang.String getCollectionPath(java.lang.String path)
          Get collection pathname from path.
static java.lang.String getDocumentName(java.lang.String path)
          Get document name from path.
 java.lang.String getDtdPath(XmldbURI collection, java.lang.String publicId)
          Find document catalogPath of DTD describing a publicId.
 java.lang.String getDtdPathFromCatalog(XmldbURI collection, java.lang.String docName, java.lang.String publicId)
          Get DTD path information from catalog.
 byte[] getGrammar(boolean isBinary, java.lang.String documentPath)
          Get document from database.
 java.lang.String getSchemaPath(XmldbURI collection, java.lang.String namespace)
          Find document path of XSD describing a namespace.
 java.lang.String getSchemaPathFromCatalog(XmldbURI collection, java.lang.String docName, java.lang.String namespace)
          Get schema path information from catalog.
 boolean insertGrammar(boolean isBinary, java.lang.String documentPath, byte[] grammar)
          Inser document to database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAMMARBASE

public java.lang.String GRAMMARBASE
Path to grammar in database


XSDBASE

public java.lang.String XSDBASE

DTDBASE

public java.lang.String DTDBASE

DTDCATALOG

public java.lang.String DTDCATALOG

NOGRAMMAR

public static java.lang.String NOGRAMMAR

GRAMMAR_XSD

public static int GRAMMAR_XSD

GRAMMAR_DTD

public static int GRAMMAR_DTD

OASISCATALOGURN

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

FINDSCHEMA

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

FINDCATALOG

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

FINDDTD

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

FINDXSDINCATALOG

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

FINDDTDINCATALOG

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

FINDPUBLICIDINCATALOGS

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

DatabaseResources

public DatabaseResources(BrokerPool pool)
Creates a new instance of DatabaseResources.

Parameters:
pool - Instance shared broker pool.
Method Detail

getSchemaPath

public java.lang.String getSchemaPath(XmldbURI collection,
                                      java.lang.String namespace)
Find document path of XSD describing a namespace.

Parameters:
collection - Start point for search, e.g. '/db'.
namespace - Namespace that needs to be found.
Returns:
Document path (e.g. '/db/foo/bar.xsd') if found, null if namespace could not be found.

getCatalogs

public java.util.List getCatalogs(java.lang.String collection)
Find catalogs in database recursively.

Parameters:
collection - Start point for search, e.g. /db
Returns:
List of document paths (strings), e.g. /db/foo/bar/catalog.xml.

getDtdPath

public java.lang.String getDtdPath(XmldbURI collection,
                                   java.lang.String publicId)
Find document catalogPath of DTD describing a publicId.

Parameters:
collection - Start point for search, e.g. '/db'.
publicId - PublicID that needs to be found.
Returns:
Document catalogPath (e.g. '/db/foo/bar.dtd') if found, null if publicID could not be found.

getGrammar

public byte[] getGrammar(boolean isBinary,
                         java.lang.String documentPath)
Get document from database.

Parameters:
isBinary - Indicate wether resource is binary.
documentPath - Path to the resource.
Returns:
Byte array of resource, null if not found.

insertGrammar

public boolean insertGrammar(boolean isBinary,
                             java.lang.String documentPath,
                             byte[] grammar)
Inser document to database. Not well tested yet.

Parameters:
grammar - ByteArray containing file.
isBinary - Indicate wether resource is binary.
documentPath - Path to the resource.
Returns:
TRUE if successfull, FALSE if not.

getDocumentName

public static java.lang.String getDocumentName(java.lang.String path)
Get document name from path. /db/foo/bar/doc.xml gives doc.xml xmldb:exist:///db/fo/bar/doc.xml gives doc.xml

Parameters:
path - The Path
Returns:
Document name.

getCollectionPath

public static java.lang.String getCollectionPath(java.lang.String path)
Get collection pathname from path. /db/foo/bar/doc.xml gives /db/foo/bar xmldb:exist:///db/fo/bar/doc.xml gives xmldb:exist:///db/fo/bar

Parameters:
path - The Path
Returns:
Collection path name, "" if none available (doc.xml)

getSchemaPathFromCatalog

public java.lang.String getSchemaPathFromCatalog(XmldbURI collection,
                                                 java.lang.String docName,
                                                 java.lang.String namespace)
Get schema path information from catalog.

Parameters:
collection - Collection containing the catalog file
docName - Catalog filename
namespace - This namespace needs to be resolved
Returns:
Path to schema, or null if not found.

getDtdPathFromCatalog

public java.lang.String getDtdPathFromCatalog(XmldbURI collection,
                                              java.lang.String docName,
                                              java.lang.String publicId)
Get DTD path information from catalog.

Parameters:
collection - Collection containing the catalog file
docName - Catalog filename
publicId - This publicId needs to be resolved
Returns:
Path to DTD, or null if not found.


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.