org.exist.xmldb
Class ResourceSetImpl

java.lang.Object
  extended byorg.exist.xmldb.ResourceSetImpl
All Implemented Interfaces:
ResourceSet

public class ResourceSetImpl
extends java.lang.Object
implements ResourceSet


Field Summary
protected  RemoteCollection collection
           
protected  java.lang.String encoding
           
protected  int handle
           
protected  int indentXML
           
protected  java.util.Vector resources
           
protected  org.apache.xmlrpc.XmlRpcClient rpcClient
           
 
Constructor Summary
ResourceSetImpl(RemoteCollection col)
           
ResourceSetImpl(RemoteCollection col, java.util.Vector resources, int handle, int indentXML, java.lang.String encoding)
           
 
Method Summary
 void addResource(Resource resource)
          Adds a Resource instance to the set.
 void clear()
          Removes all Resource instances from the set.
protected  void finalize()
           
 ResourceIterator getIterator()
          Returns an iterator over all Resource instances stored in the set.
 ResourceIterator getIterator(long start)
           
 Resource getMembersAsResource()
          Returns a Resource containing an XML representation of all resources stored in the set.
 Resource getResource(long pos)
          Returns the Resource instance stored at the index specified by index.
 long getSize()
          Returns the number of resources contained in the set.
 void removeResource(long pos)
          Removes the Resource located at index from the set.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collection

protected RemoteCollection collection

encoding

protected java.lang.String encoding

indentXML

protected int indentXML

handle

protected int handle

resources

protected java.util.Vector resources

rpcClient

protected org.apache.xmlrpc.XmlRpcClient rpcClient
Constructor Detail

ResourceSetImpl

public ResourceSetImpl(RemoteCollection col)

ResourceSetImpl

public ResourceSetImpl(RemoteCollection col,
                       java.util.Vector resources,
                       int handle,
                       int indentXML,
                       java.lang.String encoding)
Method Detail

addResource

public void addResource(Resource resource)
Description copied from interface: ResourceSet
Adds a Resource instance to the set.

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

clear

public void clear()
           throws XMLDBException
Description copied from interface: ResourceSet
Removes all Resource instances from the set.

Specified by:
clear in interface ResourceSet
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

getIterator

public ResourceIterator getIterator()
                             throws XMLDBException
Description copied from interface: ResourceSet
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 - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

getIterator

public ResourceIterator getIterator(long start)
                             throws XMLDBException
Throws:
XMLDBException

getMembersAsResource

public Resource getMembersAsResource()
                              throws XMLDBException
Description copied from interface: ResourceSet
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.

getResource

public Resource getResource(long pos)
                     throws XMLDBException
Description copied from interface: ResourceSet
Returns the Resource instance stored at the index specified by index.

If the underlying implementation uses a paging or streaming optimization for retrieving Resource instances. Calling this method MAY result in a block until the requested Resource has been downloaded.

Specified by:
getResource in interface ResourceSet
Parameters:
pos - the index of the resource to retrieve.
Returns:
The Resource instance
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.
ErrorCodes.NO_SUCH_RESOURCE if the index is out of range for the set.

getSize

public long getSize()
             throws XMLDBException
Description copied from interface: ResourceSet
Returns the number of resources contained in the set.

If the underlying implementation uses a paging or streaming optimization for retrieving Resource instances. Calling this method MAY force the downloading of all set members before the size can be determined.

Specified by:
getSize in interface ResourceSet
Returns:
The number of Resource instances in the set.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

removeResource

public void removeResource(long pos)
                    throws XMLDBException
Description copied from interface: ResourceSet
Removes the Resource located at index from the set.

Specified by:
removeResource in interface ResourceSet
Parameters:
pos - The index of the Resource instance to remove.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable


Copyright (C) Wolfgang Meier. All rights reserved.