edu.uky.rch.ept.data
Interface ICollectionAccessMethods

All Known Subinterfaces:
IDataAccessMethods, IDataSourceDriver
All Known Implementing Classes:
DataFactory, DataSourceDriver, Project, Repository

public interface ICollectionAccessMethods

This interface defines all the data access methods for collections. Wherever addresses are involved in creating new collections, all non-existing collections in the specified path will be created automatically.

All the methods throw the following exceptions:

Author:
Sandeep Bodapati

Method Summary
 boolean createCollection(String address)
          Creates a collection specified by the address.
 boolean deleteCollection(String address, boolean force)
          Deletes the collection specified by the address.
 ResourceList getCollectionContents(String collectionAddress)
          Returns a ResourceList containing resource descriptors for each of the resources and collections in the specified collection.
 boolean isCollection(String address)
          Returns true if the specified address points to a collection.
 ResourceList scanCollection(String address, Pattern pattern, boolean includeCollections)
          Returns a ResourceList containing resource descriptors for each of the resources (and possibly collections) located within the specified collection which match the given pattern.
 

Method Detail

isCollection

public boolean isCollection(String address)
                     throws MalformedAddressException,
                            IOException
Returns true if the specified address points to a collection.

Parameters:
address - the address to check
Returns:
true if the address points to an existing collection
Throws:
MalformedAddressException
IOException

createCollection

public boolean createCollection(String address)
                         throws MalformedAddressException,
                                IOException
Creates a collection specified by the address.

Parameters:
address - address of the collection
Returns:
true if the collection did not exist and was succesfully created, false otherwise.
Throws:
MalformedAddressException
IOException

deleteCollection

public boolean deleteCollection(String address,
                                boolean force)
                         throws MalformedAddressException,
                                IOException
Deletes the collection specified by the address.

Parameters:
address - address of the collection
force - if true, then the collection will be deleted even if it contains resources and other sub-collections. Use with caution, as all resources contained within the collection will be deleted
Returns:
true if the collection existed and was succesfully deleted, false otherwise.
Throws:
MalformedAddressException
IOException

getCollectionContents

public ResourceList getCollectionContents(String collectionAddress)
                                   throws MalformedAddressException,
                                          ResourceNotFoundException,
                                          IOException
Returns a ResourceList containing resource descriptors for each of the resources and collections in the specified collection.

There is no guarantee that the resource descriptors in the resulting resourcelist will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order of resource names.

Parameters:
collectionAddress - path to the collection
Returns:
a ResourceList with ResourceDescriptors pointing to the resources and collections in the specified collection. The ResourceList will be empty if the collection is empty.
Throws:
ResourceNotFoundException - if the specified collection doesnt exist
MalformedAddressException
IOException

scanCollection

public ResourceList scanCollection(String address,
                                   Pattern pattern,
                                   boolean includeCollections)
                            throws MalformedAddressException,
                                   ResourceNotFoundException,
                                   IOException
Returns a ResourceList containing resource descriptors for each of the resources (and possibly collections) located within the specified collection which match the given pattern. Unlike getCollectionContents(java.lang.String), this method perfoms a recursive search.

There is no guarantee that the resource descriptors in the resulting resourcelist will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order of resource names.

Parameters:
address - path to the collection
pattern - pattern to match against
includeCollections -
Returns:
a ResourceList with ResourceDescriptors pointing to the resources with addresses matching the pattern which are located within the specified collection. The ResourceList will be empty if the collection is empty.
Throws:
ResourceNotFoundException - if the specified collection doesnt exist
MalformedAddressException
IOException