dbXML API

org.xmldb.api.reference
Class CollectionImpl

java.lang.Object
  |
  +--org.xmldb.api.sdk.SimpleConfigurable
        |
        +--org.xmldb.api.sdk.SimpleCollection
              |
              +--org.xmldb.api.reference.CollectionImpl
All Implemented Interfaces:
Collection, Configurable

public class CollectionImpl
extends SimpleCollection

A Collection is implemented as a directory in the file system.


Constructor Summary
CollectionImpl(java.lang.String path)
           
 
Method Summary
 void close()
          Releases all resources consumed by the Collection.
 java.lang.String createId()
          Creates a new unique ID within the context of the Collection
 Resource createResource(java.lang.String id, java.lang.String type)
          Creates a new empty Resource with the provided id.
 Collection getChildCollection(java.lang.String name)
          Returns a Collection instance for the requested child collection if it exists.
 int getChildCollectionCount()
          Returns the number of child collections under this Collection.
 java.lang.String getName()
          Returns the name of the collection
 Collection getParentCollection()
          Returns the parent collection for this collection or null if no parent collection exists.
 Resource getResource(java.lang.String id)
          Retrieves a Resource from the database.
 int getResourceCount()
          Returns the number of resources currently stored in this collection or 0 if the collection is empty.
 java.lang.String[] listChildCollections()
          Returns a list of collection names naming all child collections of the current collection.
 java.lang.String[] listResources()
          Returns a list of the ids for all resources stored in the collection.
 void removeResource(Resource res)
          Removes the Resource from the database.
 void storeResource(Resource res)
          Stores the provided resource into the database.
 
Methods inherited from class org.xmldb.api.sdk.SimpleCollection
getService, getServices, registerService
 
Methods inherited from class org.xmldb.api.sdk.SimpleConfigurable
getProperty, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Collection
isOpen
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Constructor Detail

CollectionImpl

public CollectionImpl(java.lang.String path)
               throws java.io.FileNotFoundException
Method Detail

getName

public java.lang.String getName()
                         throws XMLDBException
Returns the name of the collection
Overrides:
getName in class SimpleCollection
Returns:
the name of the object.

getParentCollection

public Collection getParentCollection()
                               throws XMLDBException
Returns the parent collection for this collection or null if no parent collection exists.
Overrides:
getParentCollection in class SimpleCollection
Returns:
the parent Collection instance.

getChildCollectionCount

public int getChildCollectionCount()
                            throws XMLDBException
Returns the number of child collections under this Collection.
Overrides:
getChildCollectionCount in class SimpleCollection
Returns:
the number of child collections.

listChildCollections

public java.lang.String[] listChildCollections()
                                        throws XMLDBException
Returns a list of collection names naming all child collections of the current collection.
Overrides:
listChildCollections in class SimpleCollection
Returns:
an array containing collection names for all child collections.

getChildCollection

public Collection getChildCollection(java.lang.String name)
                              throws XMLDBException
Returns a Collection instance for the requested child collection if it exists.
Overrides:
getChildCollection in class SimpleCollection
Parameters:
name - the name of the child collection to retrieve.
Returns:
the requested child collection or null if it couldn't be found.

getResourceCount

public int getResourceCount()
                     throws XMLDBException
Returns the number of resources currently stored in this collection or 0 if the collection is empty.
Overrides:
getResourceCount in class SimpleCollection
Returns:
the number of resources in the collection.

listResources

public java.lang.String[] listResources()
                                 throws XMLDBException
Returns a list of the ids for all resources stored in the collection.
Overrides:
listResources in class SimpleCollection
Returns:
a string array containing the names for all Resources in the collection.

createResource

public Resource createResource(java.lang.String id,
                               java.lang.String type)
                        throws XMLDBException
Creates a new empty Resource with the provided id.
Overrides:
createResource in class SimpleCollection
Parameters:
id - the unique id to associate with the created Resource.
type - the Resource type to create.
Returns:
an empty Resource instance.

removeResource

public void removeResource(Resource res)
                    throws XMLDBException
Removes the Resource from the database.
Overrides:
removeResource in class SimpleCollection
Parameters:
res - the resource to remove.

storeResource

public void storeResource(Resource res)
                   throws XMLDBException
Stores the provided resource into the database.
Overrides:
storeResource in class SimpleCollection
Parameters:
res - the resource to store in the database.

getResource

public Resource getResource(java.lang.String id)
                     throws XMLDBException
Retrieves a Resource from the database.
Overrides:
getResource in class SimpleCollection
Parameters:
id - the unique id for the requested resource.
Returns:
The retrieved Resource instance.

createId

public java.lang.String createId()
                          throws XMLDBException
Creates a new unique ID within the context of the Collection
Overrides:
createId in class SimpleCollection
Returns:
the created id as a string.

close

public void close()
           throws XMLDBException
Releases all resources consumed by the Collection.
Overrides:
close in class SimpleCollection
Following copied from class: org.xmldb.api.sdk.SimpleCollection
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

dbXML API

Copyright (c) 1999-2001 The dbXML Group, All rights reserved