Package org.xmldb.api.sdk
Class SimpleResourceSet
- java.lang.Object
-
- org.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
Fields Modifier and Type Field Description static java.lang.StringRESOURCE_SET_NS
-
Constructor Summary
Constructors Constructor Description SimpleResourceSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAll(ResourceSet rSet)Adds allResourceinstances in the resourceSet to this set.voidaddResource(Resource res)Adds aResourceinstance to the set.org.w3c.dom.DocumentbuildMembersAsResourceDocument()Turns the List into the proper XML format to implement getMembersAsResource.voidclear()Removes allResourceinstances from the set.ResourceIteratorgetIterator()Returns an iterator over allResourceinstances stored in the set.ResourcegetMembersAsResource()Returns a Resource containing an XML representation of all resources stored in the set.ResourcegetResource(int index)Returns theResourceinstance stored at the index specified byindex.intgetSize()Returns the number of resources contained in the set.voidremoveResource(int index)Removes theResourcelocated atindexfrom the set.
-
-
-
Field Detail
-
RESOURCE_SET_NS
public static final java.lang.String RESOURCE_SET_NS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getIterator
public ResourceIterator getIterator() throws XMLDBException
Returns an iterator over allResourceinstances stored in the set.- Specified by:
getIteratorin interfaceResourceSet- Returns:
- a ResourceIterator over all
Resourceinstances in the set. - Throws:
XMLDBException
-
getResource
public Resource getResource(int index) throws XMLDBException
Returns theResourceinstance stored at the index specified byindex.- Specified by:
getResourcein interfaceResourceSet- Parameters:
index- the index of the resource to retrieve.- Returns:
- the
Resourceinstance. - Throws:
XMLDBException
-
getSize
public int getSize() throws XMLDBExceptionReturns the number of resources contained in the set.- Specified by:
getSizein interfaceResourceSet- Returns:
- the number of
Resourceinstances in the set. - Throws:
XMLDBException
-
addResource
public void addResource(Resource res) throws XMLDBException
Adds aResourceinstance to the set.- Specified by:
addResourcein interfaceResourceSet- Parameters:
res- TheResourceto add to the set.- Throws:
XMLDBException
-
addAll
public void addAll(ResourceSet rSet) throws XMLDBException
Adds allResourceinstances in the resourceSet to this set.- Specified by:
addAllin interfaceResourceSet- Parameters:
rSet- TheResourceSetcontaining all theResource's to add to the set.- Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
clear
public void clear() throws XMLDBExceptionRemoves allResourceinstances from the set.- Specified by:
clearin interfaceResourceSet- Throws:
XMLDBException
-
removeResource
public void removeResource(int index) throws XMLDBExceptionRemoves theResourcelocated atindexfrom the set.- Specified by:
removeResourcein interfaceResourceSet- Parameters:
index- The index of theResourceinstance 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:
getMembersAsResourcein interfaceResourceSet- Returns:
- A
Resourceinstance containing an XML representation of all set members. - Throws:
XMLDBException- with expected error codes.
ErrorCodes.VENDOR_ERRORfor any vendor specific errors that occur.
-
buildMembersAsResourceDocument
public org.w3c.dom.Document buildMembersAsResourceDocument() throws XMLDBExceptionTurns 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
-
-