org.sixdml.dbmanagement
Interface SixdmlCollection

All Superinterfaces:
Collection, Configurable
All Known Implementing Classes:
xiSixdmlCollection

public interface SixdmlCollection
extends Collection

 SixdmlCollection.java

 This is collection represents a group of XML resources that can be queried or 
 updated collectively similarly to how rows in a relational table can be queried 
 and updated collectively. 

 Created: Thu Jan 10 04:23:49 2002
 

Version:
1.0
Author:
Dare Obasanjo

Method Summary
 void addIndex(SixdmlIndex index)
          Adds an index to apply to the collection.
 SixdmlIndex[] getIndices()
          Returns an array of SixdmlIndex objects that apply to this collection.
 void insertDocument(String name, String xmlString)
          Adds an XML document created from the string argument to the collection.
 void insertDocument(String name, URL documentSource)
          Adds an XML document loaded from the specified URL to the collection.
 void removeDocument(String name)
          Removes an XML document from the collection.
 void removeIndex(String name)
          Removes a particular index from the collection.
 void setSchema(URL schemaFile)
          Sets the XML schema or DTD that will be used to constrain the documents in this collection.
 String showSchema()
          Returns the contents of the schema for the collection as a string.
 void unsetSchema()
          Unsets the schema for this collection.
 
Methods inherited from interface org.xmldb.api.base.Collection
close, createId, createResource, getChildCollection, getChildCollectionCount, getName, getParentCollection, getResource, getResourceCount, getService, getServices, isOpen, listChildCollections, listResources, removeResource, storeResource
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Method Detail

setSchema

public void setSchema(URL schemaFile)
               throws InvalidCollectionDocumentException,
                      IOException,
                      InvalidSchemaException,
                      XMLDBException
Sets the XML schema or DTD that will be used to constrain the documents in this collection. For this operation to succeed, all documents in the collection must pass schema validation. If a schema already exists for the collection then it is replaced by the new one if all documents pass validation.
Parameters:
schemaFile - the location of the schema file either on the local file system or over the internet.
Throws:
InvalidCollectionDocumentException - if an XML document in the collection fails to be validated by the schema.
IOException - if an error occurs while trying to retrieve the file.
InvalidSchemaException - if the schema is invalid.
XMLDBException - if a database error occurs.

showSchema

public String showSchema()
                  throws XMLDBException
Returns the contents of the schema for the collection as a string.
Returns:
the schema for the collection or NULL if none exists.
Throws:
XMLDBException - if a database error occurs.

unsetSchema

public void unsetSchema()
                 throws XMLDBException
Unsets the schema for this collection. Does nothing if no schema exists for the collection.
Throws:
XMLDBException - if a database error occurs.

insertDocument

public void insertDocument(String name,
                           String xmlString)
                    throws DocumentAlreadyExistsException,
                           InvalidCollectionDocumentException,
                           NonWellFormedXMLException,
                           XMLDBException
Adds an XML document created from the string argument to the collection.
Parameters:
name - the name of the document.
xmlString - the string representation of a well-formed XML document
Throws:
DocumentAlreadyExistsException - if there already exists a document with the specified name in the database.
InvalidCollectionDocumentException - if the document fails to validate against the collection's schema.
NonWellFormedXMLException - if the XML is not well formed.
XMLDBException - if a database error occurs.

insertDocument

public void insertDocument(String name,
                           URL documentSource)
                    throws DocumentAlreadyExistsException,
                           IOException,
                           InvalidCollectionDocumentException,
                           NonWellFormedXMLException,
                           XMLDBException
Adds an XML document loaded from the specified URL to the collection.
Parameters:
name - the name of the document.
xmlString - the string representation of a well-formed XML document
Throws:
DocumentAlreadyExistsException - if there already exists a document with the specified name in the database.
IOException - if an error occurs while trying to retrieve the file.
InvalidCollectionDocumentException - if the document fails to validate against the collection's schema.
NonWellFormedXMLException - if the XML is not well formed.
XMLDBException - if a database error occurs.

removeDocument

public void removeDocument(String name)
                    throws NonExistentDocumentException,
                           XMLDBException
Removes an XML document from the collection.
Parameters:
name - the name of the document.
Throws:
NonExistentDocumentException - if the document does not exist in the collection.
XMLDBException - if a database error occurs.

addIndex

public void addIndex(SixdmlIndex index)
              throws UnsupportedIndexTypeException,
                     IndexAlreadyExistsException,
                     XMLDBException
Adds an index to apply to the collection.
Parameters:
index - the index to add
Throws:
UnsupportedIndexTypeException - if the index is of a type unsupported by the database.
IndexAlreadyExistsException - if an index with the same name already exists for the collection.
XMLDBException - if a database error occurs.

removeIndex

public void removeIndex(String name)
                 throws NonExistentIndexException,
                        XMLDBException
Removes a particular index from the collection.
Parameters:
index - the index to add
Throws:
XMLDBException - if a database error occurs.

getIndices

public SixdmlIndex[] getIndices()
                         throws XMLDBException
Returns an array of SixdmlIndex objects that apply to this collection. If no indexes exist in the collection then an empty array is returned.
Returns:
an array of SixdmlIndex objects.
Throws:
XMLDBException - if a database error occurs.