org.sixdml.xindice
Class xiSixdmlCollectionManagementService

java.lang.Object
  |
  +--org.sixdml.xindice.xiServiceBase
        |
        +--org.sixdml.xindice.xiSixdmlCollectionManagementService
All Implemented Interfaces:
CollectionManagementService, Configurable, Service, SixdmlCollectionManagementService, SixdmlConstants

class xiSixdmlCollectionManagementService
extends xiServiceBase
implements SixdmlCollectionManagementService, SixdmlConstants

  
 xiSixdmlCollectionManagementService.java

 Manages the creation and deletion of collections in the database. 
 

Version:
1.0

Field Summary
private  xiSixdmlCollection collection
          The underlying collection object that provides the context for this service.
 
Fields inherited from class org.sixdml.xindice.xiServiceBase
properties
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
(package private) xiSixdmlCollectionManagementService(xiSixdmlCollection collection)
          Initializes the service.
 
Method Summary
 Collection createCollection(String name)
          Creates a new Collection in the database.
 Collection createCollection(String name, URL schemaFile)
          Creates a collection that is constrained by a particular schema.
 SixdmlIndex createIndex(String name, HashMap indexFields)
          Creates an index with a name and an indexFields table in the Xindice database.
 String getName()
          Gets the name of the service.
 SixdmlIndexType[] getSupportedIndexTypes()
          Gets the types of index that are supported by the this database.
static void main(String[] args)
          Main used for testing class.
 void removeCollection(String name)
          Removes a collection from the database.
 
Methods inherited from class org.sixdml.xindice.xiServiceBase
getProperty, getVersion, setCollection, setProperty
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Service
getVersion, setCollection
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Field Detail

collection

private xiSixdmlCollection collection
The underlying collection object that provides the context for this service.
Constructor Detail

xiSixdmlCollectionManagementService

xiSixdmlCollectionManagementService(xiSixdmlCollection collection)
Initializes the service.
Parameters:
collection - the collection that owns this CollectionManagementService
Method Detail

getSupportedIndexTypes

public SixdmlIndexType[] getSupportedIndexTypes()
Gets the types of index that are supported by the this database.
Specified by:
getSupportedIndexTypes in interface SixdmlCollectionManagementService
Returns:
an array of SixdmlIndexTypes which the database supports.

createIndex

public SixdmlIndex createIndex(String name,
                               HashMap indexFields)
                        throws UnsupportedIndexTypeException
Creates an index with a name and an indexFields table in the Xindice database.
NOTE: Runtime error may occur if table not properly populated.
Specified by:
createIndex in interface SixdmlCollectionManagementService
Parameters:
name - the name of the index.
indexFields - the index fields for the class.
Throws:
UnsupportedIndexTypeException - if the type of index requested is unsupported by the database.

createCollection

public Collection createCollection(String name)
                            throws XMLDBException
Creates a new Collection in the database.
Specified by:
createCollection in interface CollectionManagementService
Parameters:
name - The name of the collection to create.
Returns:
The created Collection instance.
Throws:
XMLDBException - if the collection already exists or one of the collections in the path given does not exist.
See Also:
ErrorCodes.NO_SUCH_COLLECTION, ErrorMessages.DUPLICATE_COLLECTION

createCollection

public Collection createCollection(String name,
                                   URL schemaFile)
                            throws XMLDBException,
                                   IOException,
                                   InvalidSchemaException
Creates a collection that is constrained by a particular schema.
Specified by:
createCollection in interface SixdmlCollectionManagementService
Parameters:
name - The name of the collection to create.
schemaFile - the location of the schema file either on the local file system or over the internet.
Throws:
XMLDBException - if the collection already exists or one of the collections in the path given does not exist.
IOException - if an error occurs while trying to retrieve the file.
InvalidSchemaException - if the schema is invalid.
See Also:
ErrorCodes.NO_SUCH_COLLECTION, ErrorMessages.DUPLICATE_COLLECTION

removeCollection

public void removeCollection(String name)
                      throws XMLDBException
Removes a collection from the database.
Specified by:
removeCollection in interface CollectionManagementService
Parameters:
name - The name of the collection to delete.
Throws:
XMLDBException - if the path is invalid.
See Also:
ErrorCodes.NO_SUCH_COLLECTION

getName

public String getName()
Gets the name of the service.
Specified by:
getName in interface Service
Overrides:
getName in class xiServiceBase
Returns:
the name of the service.

main

public static void main(String[] args)
                 throws Exception
Main used for testing class.
Parameters:
args - IGNORED