uk.ac.soton.itinnovation.registry.component.xml.db
Interface XmlDbAccess<E>

All Superinterfaces:
Access, PermissionManagement
All Known Implementing Classes:
XmlDbAccessAdapter, XmlDbAccessXmlDb

public interface XmlDbAccess<E>
extends Access, PermissionManagement


Method Summary
 boolean createCollection(String directoryPath)
          Creates a collection specified by the directory name, if not already exists.
 ResultIterator<E> executePredefinedQuery(String name, ParameterValue... parameterValues)
          Execute predefined query.
 HashSet<String> getIdentifierByFile(String file)
          Checks identity of an inserted object.
 HashSet<String> getIdentifierByTemporyResource(E resource, String dir)
           
 HashSet<String> getIdentifierByTemporyResource(String tempId, String dir)
           
 HashSet<String> getIdentifierByXQuery(String xquery)
          This methods returns a set of document identifiers that correspond to the result of the xquery.
 String getIdentifierOfResource(E resource)
          Get identifier of specific resource.
 ArrayList<String> getIdentifiesByRelation(E resource, String relation)
          Get referenced identifiers of a specified relationship based on a specified entity.
 ArrayList<String> getIdentifiesByRelation(String id, String relation)
          Get referenced identifiers of a specified relationship based on the entity with specified id.
 String getLocalDirectoryName(String docId)
          Get the local name of the collection storing a specific entity.
 ArrayList<String> getRelationships(E resource)
          Get the provided relationships of a persistent resource.
 ArrayList<String> getRelationships(String id)
          Get the provided relationships of an object specified by its identifier.
 ArrayList<E> getResourcesByRelation(E resource, String relation)
          Get referenced objects of a specified relationship based on a specified entity.
 ArrayList<E> getResourcesByRelation(String id, String relation)
          Get referenced objects of a specified relationship based on the entity with specified id.
 void insertRelationship(String fromId, String fromConcept, String relationshipName, String toId, String toConcept)
          Stores a relationship with specific name between two documents specified by their ids.
 E lookup(String docId)
          Lookup a specific XML resource by its document identifier.
 E lookup(String docId, String directoryPath)
          Lookup a specific XML resource by its document identifier and the directoryPath it belongs to.
 ResultIterator<E> lookupByDirectory(String directoryPath)
          Returns documents (resources) that are stored in the specified directory.
 ArrayList<E> lookupByFile(String file)
           
 ArrayList<E> lookupByTemporaryResource(E resource, String dir)
           
 ResultIterator<E> query(String xquery)
          Execute an xquery statement on the registry.
 void registerPredefinedQuery(String name, String query, String... parameterNames)
          Register a predefined query expression with the database.
 void removeAllDocumentsFromRegistry(String directoryPath)
          Removes all resources from the registry specified by the directory.
 void removeDocumentFromRegistry(String directoryPath, String id)
          Remove a resource (xml document) from a specified collection.
 void resetPredefinedQueries()
          Reset the predefined queries.
 String storeDocumentInRegistry(String directoryPath, Document content, String id)
          Stores a resource (dom) in the registry.
 String storeDocumentInRegistry(String directoryPath, File file, String id)
          Stores a resource (xml document) that is specified by a file.
 String storeDocumentInRegistry(String directoryPath, String filename, String id)
          Stores a resource (xml document) that is specified by a file.
 String storeDocumentInRegistry(String directoryPath, URI uri, String id)
          Stores a resource (xml document) that is specified by a URI.
 void storePredefinedQuery(String name, String query, String... parameterNames)
          Stores a predefined query in the database.
 String storeStringDocumentInRegistry(String directoryPath, String content, String id)
          Stores a resource (xml document) that is specified by a string.
 
Methods inherited from interface uk.ac.soton.itinnovation.registry.icomponent.access.Access
getCacheManagement
 
Methods inherited from interface uk.ac.soton.itinnovation.registry.component.xml.db.PermissionManagement
setPermission, setPermission
 

Method Detail

createCollection

boolean createCollection(String directoryPath)
                         throws DatabaseException
Creates a collection specified by the directory name, if not already exists.

Parameters:
directoryPath - dir has to start with an '/'
Returns:
true, if the collection is created, otherwise false.
Throws:
DatabaseException

storeDocumentInRegistry

String storeDocumentInRegistry(String directoryPath,
                               String filename,
                               String id)
                               throws DatabaseException,
                                      IOException
Stores a resource (xml document) that is specified by a file.

Parameters:
directoryPath - concept under which the document is stored (beginning with '/')
filename -
id - identifier of the resource. If null then a new identifier will be generated.
Returns:
The id of the resource.
Throws:
DatabaseException
IOException

storeDocumentInRegistry

String storeDocumentInRegistry(String directoryPath,
                               URI uri,
                               String id)
                               throws DatabaseException,
                                      IOException
Stores a resource (xml document) that is specified by a URI.

Parameters:
directoryPath - concept under which the document is stored (beginning with '/')
uri -
id - identifier of the resource. If null then a new identifier will be generated.
Returns:
The id of the resource.
Throws:
DatabaseException
IOException

storeDocumentInRegistry

String storeDocumentInRegistry(String directoryPath,
                               File file,
                               String id)
                               throws DatabaseException,
                                      IOException
Stores a resource (xml document) that is specified by a file.

Parameters:
directoryPath - concept under which the document is stored (beginning with '/')
file -
id - identifier of the resource. If null then a new identifier will be generated.
Returns:
The id of the resource.
Throws:
DatabaseException
IOException

storeDocumentInRegistry

String storeDocumentInRegistry(String directoryPath,
                               Document content,
                               String id)
                               throws DatabaseException,
                                      IOException
Stores a resource (dom) in the registry.

Parameters:
directoryPath -
content -
id -
Returns:
the id of the resource in the registry
Throws:
DatabaseException
IOException

storeStringDocumentInRegistry

String storeStringDocumentInRegistry(String directoryPath,
                                     String content,
                                     String id)
                                     throws DatabaseException,
                                            IOException
Stores a resource (xml document) that is specified by a string.

Parameters:
directoryPath - concept under which the document is stored (beginning with '/')
content - xml content
id - identifier of the resource. If null then a new identifier will be generated.
Returns:
The id of the resource.
Throws:
DatabaseException
IOException

removeDocumentFromRegistry

void removeDocumentFromRegistry(String directoryPath,
                                String id)
                                throws DatabaseException
Remove a resource (xml document) from a specified collection.

Parameters:
directoryPath - directory under which the document is stored (beginning with '/')
id -
Throws:
DatabaseException

removeAllDocumentsFromRegistry

void removeAllDocumentsFromRegistry(String directoryPath)
                                    throws DatabaseException
Removes all resources from the registry specified by the directory.

Parameters:
directoryPath -
Throws:
DatabaseException

insertRelationship

void insertRelationship(String fromId,
                        String fromConcept,
                        String relationshipName,
                        String toId,
                        String toConcept)
                        throws DatabaseException
Stores a relationship with specific name between two documents specified by their ids.

Parameters:
fromId -
fromConcept -
relationshipName -
toId -
toConcept -
Throws:
DatabaseException

getRelationships

ArrayList<String> getRelationships(String id)
                                   throws DatabaseException
Get the provided relationships of an object specified by its identifier.

Parameters:
id -
Throws:
DatabaseException

getRelationships

ArrayList<String> getRelationships(E resource)
                                   throws DatabaseException
Get the provided relationships of a persistent resource.

Parameters:
resource -
Throws:
DatabaseException

getIdentifiesByRelation

ArrayList<String> getIdentifiesByRelation(String id,
                                          String relation)
                                          throws DatabaseException
Get referenced identifiers of a specified relationship based on the entity with specified id.

Parameters:
id -
relation -
Throws:
DatabaseException

getIdentifiesByRelation

ArrayList<String> getIdentifiesByRelation(E resource,
                                          String relation)
                                          throws DatabaseException
Get referenced identifiers of a specified relationship based on a specified entity.

Parameters:
resource -
relation -
Throws:
DatabaseException

getResourcesByRelation

ArrayList<E> getResourcesByRelation(String id,
                                    String relation)
                                    throws DatabaseException
Get referenced objects of a specified relationship based on the entity with specified id.

Parameters:
id -
relation -
Throws:
DatabaseException

getResourcesByRelation

ArrayList<E> getResourcesByRelation(E resource,
                                    String relation)
                                    throws DatabaseException
Get referenced objects of a specified relationship based on a specified entity.

Parameters:
resource -
relation -
Throws:
DatabaseException

executePredefinedQuery

ResultIterator<E> executePredefinedQuery(String name,
                                         ParameterValue... parameterValues)
                                         throws DatabaseException
Execute predefined query.

Parameters:
name - name under with the query is stored.
parameterValues -
Throws:
DatabaseException

getLocalDirectoryName

String getLocalDirectoryName(String docId)
                             throws DatabaseException,
                                    AccessException
Get the local name of the collection storing a specific entity.

Parameters:
docId -
Throws:
DatabaseException
AccessException

lookup

E lookup(String docId)
         throws DatabaseException
Lookup a specific XML resource by its document identifier.

Parameters:
docId -
Returns:
xml resource of null if it is not found
Throws:
DatabaseException

lookup

E lookup(String docId,
         String directoryPath)
         throws DatabaseException
Lookup a specific XML resource by its document identifier and the directoryPath it belongs to.

Parameters:
docId -
directoryPath - (begins with '/')
Returns:
xml resource or null if it is not found
Throws:
DatabaseException

lookupByFile

ArrayList<E> lookupByFile(String file)
                          throws DatabaseException,
                                 IOException
Parameters:
file -
Throws:
DatabaseException
IOException

lookupByTemporaryResource

ArrayList<E> lookupByTemporaryResource(E resource,
                                       String dir)
                                       throws DatabaseException
Parameters:
resource -
Throws:
DatabaseException

lookupByDirectory

ResultIterator<E> lookupByDirectory(String directoryPath)
                                    throws DatabaseException
Returns documents (resources) that are stored in the specified directory.

Parameters:
directoryPath -
Throws:
DatabaseException

getIdentifierByFile

HashSet<String> getIdentifierByFile(String file)
                                    throws DatabaseException,
                                           IOException
Checks identity of an inserted object. Remark: order of childs is important, i.e. exact matching (==) and not equals

Parameters:
file -
Throws:
DatabaseException
IOException

getIdentifierByTemporyResource

HashSet<String> getIdentifierByTemporyResource(String tempId,
                                               String dir)
                                               throws DatabaseException
Parameters:
tempId - identifier of temporal resource
dir - search directory
Throws:
DatabaseException

getIdentifierByTemporyResource

HashSet<String> getIdentifierByTemporyResource(E resource,
                                               String dir)
                                               throws DatabaseException
Parameters:
resource -
dir - search directory
Throws:
DatabaseException

getIdentifierOfResource

String getIdentifierOfResource(E resource)
                               throws DatabaseException
Get identifier of specific resource.

Parameters:
resource -
Throws:
DatabaseException

getIdentifierByXQuery

HashSet<String> getIdentifierByXQuery(String xquery)
                                      throws DatabaseException
This methods returns a set of document identifiers that correspond to the result of the xquery.

Parameters:
xquery -
Throws:
DatabaseException

query

ResultIterator<E> query(String xquery)
                        throws DatabaseException
Execute an xquery statement on the registry.

Parameters:
xquery -
Throws:
DatabaseException

storePredefinedQuery

void storePredefinedQuery(String name,
                          String query,
                          String... parameterNames)
                          throws DatabaseException
Stores a predefined query in the database. The name must be unique. If this name is already used, the content will be overwritten.

Parameters:
collection -
name - name of the query
query - xquery expression
parameterNames - parameters used in the query
Throws:
DatabaseException

registerPredefinedQuery

void registerPredefinedQuery(String name,
                             String query,
                             String... parameterNames)
                             throws DatabaseException
Register a predefined query expression with the database.

Parameters:
collection -
name -
query -
parameterNames -
Throws:
DatabaseException

resetPredefinedQueries

void resetPredefinedQueries()
Reset the predefined queries.



Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.