org.basex.api.xmldb
Class BXCollectionManagementService

java.lang.Object
  extended by org.basex.api.xmldb.BXCollectionManagementService
All Implemented Interfaces:
BXXMLDBText, Configurable, Service, CollectionManagementService

public final class BXCollectionManagementService
extends java.lang.Object
implements CollectionManagementService, BXXMLDBText

Implementation of the CollectionManagementService Interface for the XMLDB:API. Note that a BaseX database has one collection at a time, so creating a new collection creates a new database as well, and the specified collection reference is reset every time a database is created.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Field Summary
 
Fields inherited from interface org.basex.api.xmldb.BXXMLDBText
CONFORMANCE_LEVEL, DBURI, ERR_BINARY, ERR_CONT, ERR_DOC, ERR_EMPTY, ERR_ID, ERR_INV, ERR_ITER, ERR_NSURI, ERR_PROP, ERR_RES, ERR_TYPE, ERR_UNKNOWN, ERR_URI, LOCALHOST, XMLDB, XMLDBURI
 
Constructor Summary
BXCollectionManagementService(Collection c)
          Standard Constructor.
 
Method Summary
static Context create(java.lang.String name)
          Creates a new collection and returns the context.
 Collection createCollection(java.lang.String name)
          Creates a new collection.
 java.lang.String getName()
          Returns the name associated with the Service instance.
 java.lang.String getProperty(java.lang.String nm)
          Returns the value of the property identified by name.
 java.lang.String getVersion()
          Gets the Version attribute of the Service object
 void removeCollection(java.lang.String name)
          Removes a named Collection from the system.
 void setCollection(Collection c)
          Sets the Collection attribute of the Service object
 void setProperty(java.lang.String nm, java.lang.String value)
          Sets the property name to have the value provided in value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BXCollectionManagementService

public BXCollectionManagementService(Collection c)
Standard Constructor.

Parameters:
c - Collection reference
Method Detail

createCollection

public Collection createCollection(java.lang.String name)
                            throws XMLDBException
Creates a new collection. Note that a new collection equals the creation of a new database.

Specified by:
createCollection in interface CollectionManagementService
Parameters:
name - name of collection
Returns:
collection
Throws:
XMLDBException - exception

create

public static Context create(java.lang.String name)
                      throws XMLDBException
Creates a new collection and returns the context.

Parameters:
name -
Returns:
context
Throws:
XMLDBException - exception

removeCollection

public void removeCollection(java.lang.String name)
Description copied from interface: CollectionManagementService
Removes a named Collection from the system. The name for the Collection to remove is relative to the Collection from which the CollectionManagementService was retrieved.

Specified by:
removeCollection in interface CollectionManagementService
Parameters:
name - The name of the collection to remove.

getName

public java.lang.String getName()
Description copied from interface: Service
Returns the name associated with the Service instance.

Specified by:
getName in interface Service
Returns:
the name of the object.

getVersion

public java.lang.String getVersion()
Description copied from interface: Service
Gets the Version attribute of the Service object

Specified by:
getVersion in interface Service
Returns:
The Version value

setCollection

public void setCollection(Collection c)
Description copied from interface: Service
Sets the Collection attribute of the Service object

Specified by:
setCollection in interface Service
Parameters:
c - The new Collection value

getProperty

public java.lang.String getProperty(java.lang.String nm)
Description copied from interface: Configurable
Returns the value of the property identified by name.

Specified by:
getProperty in interface Configurable
Parameters:
nm - the name of the property to retrieve.
Returns:
the property value or null if no property exists.

setProperty

public void setProperty(java.lang.String nm,
                        java.lang.String value)
                 throws XMLDBException
Description copied from interface: Configurable
Sets the property name to have the value provided in value.

Specified by:
setProperty in interface Configurable
Parameters:
nm - the name of the property to set.
value - the value to set for the property.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.