XML:DB API

org.xmldb.api.sdk
Class SimpleResourceSet

java.lang.Object
  extended byorg.xmldb.api.sdk.SimpleResourceSet
All Implemented Interfaces:
ResourceSet
Direct Known Subclasses:
ResourceSetImpl

public abstract class SimpleResourceSet
extends java.lang.Object
implements ResourceSet

Provides a base ResourceSet implementation that utilizes a synchronized list to contain the set of resources.


Field Summary
static java.lang.String RESOURCE_SET_NS
           
 
Constructor Summary
SimpleResourceSet()
           
 
Method Summary
 void addAll(ResourceSet rSet)
          Adds all Resource instances in the resourceSet to this set.
 void addResource(Resource res)
          Adds a Resource instance to the set.
 org.w3c.dom.Document buildMembersAsResourceDocument()
          Turns the List into the proper XML format to implement getMembersAsResource.
 void clear()
          Removes all Resource instances from the set.
 ResourceIterator getIterator()
          Returns an iterator over all Resource instances stored in the set.
 Resource getMembersAsResource()
          Returns a Resource containing an XML representation of all resources stored in the set.
 Resource getResource(int index)
          Returns the Resource instance stored at the index specified by index.

 int getSize()
          Returns the number of resources contained in the set.

 void removeResource(int index)
          Removes the Resource located at index from the set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_SET_NS

public static final java.lang.String RESOURCE_SET_NS
See Also:
Constant Field Values
Constructor Detail

SimpleResourceSet

public SimpleResourceSet()
Method Detail

getIterator

public ResourceIterator getIterator()
                             throws XMLDBException
Returns an iterator over all Resource instances stored in the set.

Specified by:
getIterator in interface ResourceSet
Returns:
a ResourceIterator over all Resource instances in the set.
Throws:
XMLDBException

getResource

public Resource getResource(int index)
                     throws XMLDBException
Returns the Resource instance stored at the index specified by index.

Specified by:
getResource in interface ResourceSet
Parameters:
index - the index of the resource to retrieve.
Returns:
the Resource instance.
Throws:
XMLDBException

getSize

public int getSize()
            throws XMLDBException
Returns the number of resources contained in the set.

Specified by:
getSize in interface ResourceSet
Returns:
the number of Resource instances in the set.
Throws:
XMLDBException

addResource

public void addResource(Resource res)
                 throws XMLDBException
Adds a Resource instance to the set.

Specified by:
addResource in interface ResourceSet
Parameters:
res - The Resource to add to the set.
Throws:
XMLDBException

addAll

public void addAll(ResourceSet rSet)
            throws XMLDBException
Adds all Resource instances in the resourceSet to this set.

Specified by:
addAll in interface ResourceSet
Parameters:
rSet - The ResourceSet containing all the Resource's to add to the set.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

clear

public void clear()
           throws XMLDBException
Removes all Resource instances from the set.

Specified by:
clear in interface ResourceSet
Throws:
XMLDBException

removeResource

public void removeResource(int index)
                    throws XMLDBException
Removes the Resource located at index from the set.

Specified by:
removeResource in interface ResourceSet
Parameters:
index - The index of the Resource instance to remove.
Throws:
XMLDBException

getMembersAsResource

public Resource getMembersAsResource()
                              throws XMLDBException
Returns a Resource containing an XML representation of all resources stored in the set.

TODO: Specify the schema used for this

Specified by:
getMembersAsResource in interface ResourceSet
Returns:
A Resource instance containing an XML representation of all set members.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

buildMembersAsResourceDocument

public org.w3c.dom.Document buildMembersAsResourceDocument()
                                                    throws XMLDBException
Turns the List into the proper XML format to implement getMembersAsResource. This is a helper method to make implementing getMembersAsResource easier. The result is a DOM document that should be converted into a proper XMLResource implementation by the implementing driver.

Throws:
XMLDBException

XML:DB API

Copyright (C) XML:DB Initiative. All rights reserved.%lt;/font>