org.basex.api.xmldb
Class BXCollection

java.lang.Object
  extended by org.basex.api.xmldb.BXCollection
All Implemented Interfaces:
org.xmldb.api.base.Collection, org.xmldb.api.base.Configurable

public final class BXCollection
extends Object
implements org.xmldb.api.base.Collection

Implementation of the Collection Interface for the XMLDB:API.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Andreas Weiler, Christian Gruen

Field Summary
static String CONFORMANCE_LEVEL
          Conformance level of the implementation.
static String DBURI
          DB URI.
static String ERR_BINARY
          Error message.
static String ERR_CONT
          Error message.
static String ERR_DOC
          Error message.
static String ERR_EMPTY
          Error message.
static String ERR_ID
          Error message.
static String ERR_ITER
          Error message.
static String ERR_NSURI
          Error message.
static String ERR_PROP
          Error message.
static String ERR_RES
          Error message.
static String ERR_TYPE
          Error message.
static String ERR_UNKNOWN
          Error message.
static String ERR_URI
          Error message.
static String LOCALHOST
          Localhost name.
static String XMLDB
          XMLDB URI.
static String XMLDBURI
          XMLDB URI.
 
Constructor Summary
BXCollection(String name, boolean open)
          Constructor to create/open a collection.
BXCollection(String name, boolean open, Context c)
          Constructor to create/open a collection.
 
Method Summary
 void close()
           
 String createId()
          Creates a random numeric id and check if it's not already contained in the database.
 org.basex.api.xmldb.BXXMLResource createResource(String id, String type)
           
 org.xmldb.api.base.Collection getChildCollection(String name)
           
 int getChildCollectionCount()
           
 String getName()
           
 org.xmldb.api.base.Collection getParentCollection()
           
 String getProperty(String key)
           
 org.basex.api.xmldb.BXXMLResource getResource(String id)
           
 int getResourceCount()
           
 org.xmldb.api.base.Service getService(String nm, String ver)
           
 org.xmldb.api.base.Service[] getServices()
           
 boolean isOpen()
           
 String[] listChildCollections()
           
 String[] listResources()
           
 void removeResource(org.xmldb.api.base.Resource res)
           
 void setProperty(String key, String val)
          Be aware what you're doing here..
 void storeResource(org.xmldb.api.base.Resource res)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBURI

public static final String DBURI
DB URI.


XMLDB

public static final String XMLDB
XMLDB URI.

See Also:
Constant Field Values

XMLDBURI

public static final String XMLDBURI
XMLDB URI.


LOCALHOST

public static final String LOCALHOST
Localhost name.

See Also:
Constant Field Values

CONFORMANCE_LEVEL

public static final String CONFORMANCE_LEVEL
Conformance level of the implementation.

See Also:
Constant Field Values

ERR_URI

public static final String ERR_URI
Error message.

See Also:
Constant Field Values

ERR_PROP

public static final String ERR_PROP
Error message.

See Also:
Constant Field Values

ERR_BINARY

public static final String ERR_BINARY
Error message.

See Also:
Constant Field Values

ERR_TYPE

public static final String ERR_TYPE
Error message.

See Also:
Constant Field Values

ERR_EMPTY

public static final String ERR_EMPTY
Error message.

See Also:
Constant Field Values

ERR_ID

public static final String ERR_ID
Error message.

See Also:
Constant Field Values

ERR_UNKNOWN

public static final String ERR_UNKNOWN
Error message.

See Also:
Constant Field Values

ERR_CONT

public static final String ERR_CONT
Error message.

See Also:
Constant Field Values

ERR_NSURI

public static final String ERR_NSURI
Error message.

See Also:
Constant Field Values

ERR_RES

public static final String ERR_RES
Error message.

See Also:
Constant Field Values

ERR_ITER

public static final String ERR_ITER
Error message.

See Also:
Constant Field Values

ERR_DOC

public static final String ERR_DOC
Error message.

See Also:
Constant Field Values
Constructor Detail

BXCollection

public BXCollection(String name,
                    boolean open)
             throws org.xmldb.api.base.XMLDBException
Constructor to create/open a collection.

Parameters:
name - name of the database
open - open existing database
Throws:
org.xmldb.api.base.XMLDBException - exception

BXCollection

public BXCollection(String name,
                    boolean open,
                    Context c)
             throws org.xmldb.api.base.XMLDBException
Constructor to create/open a collection.

Parameters:
name - name of the database
open - open existing database
c - database context
Throws:
org.xmldb.api.base.XMLDBException - exception
Method Detail

getName

public String getName()
Specified by:
getName in interface org.xmldb.api.base.Collection

getServices

public org.xmldb.api.base.Service[] getServices()
                                         throws org.xmldb.api.base.XMLDBException
Specified by:
getServices in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getService

public org.xmldb.api.base.Service getService(String nm,
                                             String ver)
                                      throws org.xmldb.api.base.XMLDBException
Specified by:
getService in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getParentCollection

public org.xmldb.api.base.Collection getParentCollection()
                                                  throws org.xmldb.api.base.XMLDBException
Specified by:
getParentCollection in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getChildCollection

public org.xmldb.api.base.Collection getChildCollection(String name)
                                                 throws org.xmldb.api.base.XMLDBException
Specified by:
getChildCollection in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getChildCollectionCount

public int getChildCollectionCount()
                            throws org.xmldb.api.base.XMLDBException
Specified by:
getChildCollectionCount in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

listChildCollections

public String[] listChildCollections()
                              throws org.xmldb.api.base.XMLDBException
Specified by:
listChildCollections in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getResourceCount

public int getResourceCount()
                     throws org.xmldb.api.base.XMLDBException
Specified by:
getResourceCount in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

listResources

public String[] listResources()
                       throws org.xmldb.api.base.XMLDBException
Specified by:
listResources in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

createResource

public org.basex.api.xmldb.BXXMLResource createResource(String id,
                                                        String type)
                                                 throws org.xmldb.api.base.XMLDBException
Specified by:
createResource in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

removeResource

public void removeResource(org.xmldb.api.base.Resource res)
                    throws org.xmldb.api.base.XMLDBException
Specified by:
removeResource in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

storeResource

public void storeResource(org.xmldb.api.base.Resource res)
                   throws org.xmldb.api.base.XMLDBException
Specified by:
storeResource in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

getResource

public org.basex.api.xmldb.BXXMLResource getResource(String id)
                                              throws org.xmldb.api.base.XMLDBException
Specified by:
getResource in interface org.xmldb.api.base.Collection
Throws:
org.xmldb.api.base.XMLDBException

createId

public String createId()
                throws org.xmldb.api.base.XMLDBException
Creates a random numeric id and check if it's not already contained in the database. Collisions can still occur, if resources are not immediately stored in the database, so it's advisable in general to specify your own IDs.

Specified by:
createId in interface org.xmldb.api.base.Collection
Returns:
id
Throws:
org.xmldb.api.base.XMLDBException - exception

isOpen

public boolean isOpen()
Specified by:
isOpen in interface org.xmldb.api.base.Collection

close

public void close()
Specified by:
close in interface org.xmldb.api.base.Collection

getProperty

public String getProperty(String key)
                   throws org.xmldb.api.base.XMLDBException
Specified by:
getProperty in interface org.xmldb.api.base.Configurable
Throws:
org.xmldb.api.base.XMLDBException

setProperty

public void setProperty(String key,
                        String val)
                 throws org.xmldb.api.base.XMLDBException
Be aware what you're doing here..

Specified by:
setProperty in interface org.xmldb.api.base.Configurable
Parameters:
key - key
val - value
Throws:
org.xmldb.api.base.XMLDBException - exception