uk.ac.ed.inf.ogsaconfig.garm.collections
Class ConcreteCollection

java.lang.Object
  |
  +--uk.ac.ed.inf.ogsaconfig.garm.collections.ConcreteCollection
All Implemented Interfaces:
FileCollection
Direct Known Subclasses:
Archive, Directory, LayoutCollection

public abstract class ConcreteCollection
extends java.lang.Object
implements FileCollection

A concrete collection typically represents the bottom of a FileCollection layering. The name is intended to imply the inverse of a MetaCollection. In practise this means that concrete collections show a view of the files in them that is related the them and not obviously to any layers below them. The concrete collection class maintains the files in the collection for its client subclass.


Constructor Summary
protected ConcreteCollection()
           
 
Method Summary
 boolean add(VFile vfile)
          Adds a new file to the collection, which may or may not replace the existing file.
 FileCollection[] bases()
          Returns the list of file collections which presently have files in this collection.
 VFile[] contents()
          Returns all the files present in this collection
 VFile[] contents(FileType type)
          Returns all the files of the given type in this collection
 void destroy()
          Informs the collection of an impending shutdown, and instructs it to save all necessary state.
protected  void includeAll(VFile[] vfiles)
          includeAll() provides a shorthand way to add an array of files to the collection using includeFile()
protected  void includeFile(VFile vfile)
          includeFile() provides a means for subclasses to add a file to the set used by the system.
protected abstract  VFile performAdd(VFile vfile)
          performAdd is the interface subclasses should use to perform any logic they need to do when a file is added to the collection.
protected abstract  VFile performRemove(VFile vfile)
          performRemove is the interface subclasses should use to perform any logic they need when a file is removed from the collection.
 boolean remove(VFile vfile)
          Removes a file from the collection.
 VFile retrieve(VFile vfile)
          Returns the file in the collection corresponding to the given file.
 FileCollection root()
          Returns the base layer of the stack of file collections of which this is top.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcreteCollection

protected ConcreteCollection()
Method Detail

contents

public final VFile[] contents()
Description copied from interface: FileCollection
Returns all the files present in this collection

Specified by:
contents in interface FileCollection

contents

public final VFile[] contents(FileType type)
Description copied from interface: FileCollection
Returns all the files of the given type in this collection

Specified by:
contents in interface FileCollection

retrieve

public final VFile retrieve(VFile vfile)
Description copied from interface: FileCollection
Returns the file in the collection corresponding to the given file. Many file collections are layered on other collections, and this can be used to determine the file in this collection corresponding to one in another collection

Specified by:
retrieve in interface FileCollection

add

public final boolean add(VFile vfile)
Description copied from interface: FileCollection
Adds a new file to the collection, which may or may not replace the existing file. Returns true if the operation was successful, false otherwise.

Specified by:
add in interface FileCollection

remove

public final boolean remove(VFile vfile)
Description copied from interface: FileCollection
Removes a file from the collection. Returns true if the particular (source specific) file is no longer present in the collection

Specified by:
remove in interface FileCollection

destroy

public void destroy()
Description copied from interface: FileCollection
Informs the collection of an impending shutdown, and instructs it to save all necessary state. This is guaranteed to be called before the collection is destroyed.

Specified by:
destroy in interface FileCollection

root

public FileCollection root()
Description copied from interface: FileCollection
Returns the base layer of the stack of file collections of which this is top. This is commonly used to identify collections from different points in the stack.

Specified by:
root in interface FileCollection

bases

public final FileCollection[] bases()
Description copied from interface: FileCollection
Returns the list of file collections which presently have files in this collection.

Specified by:
bases in interface FileCollection

performAdd

protected abstract VFile performAdd(VFile vfile)
performAdd is the interface subclasses should use to perform any logic they need to do when a file is added to the collection.

Parameters:
vfile - is the file that is being added
Returns:
is the new file that was actually added, or null

performRemove

protected abstract VFile performRemove(VFile vfile)
performRemove is the interface subclasses should use to perform any logic they need when a file is removed from the collection.

Parameters:
vfile - is the file that is being added
Returns:
is the file that was actually removed, or null

includeFile

protected final void includeFile(VFile vfile)
includeFile() provides a means for subclasses to add a file to the set used by the system. This routine is typically invoked during initialisation, for example if the collection was a directory this would be used to add all the files actually found in the directory to the collection


includeAll

protected final void includeAll(VFile[] vfiles)
includeAll() provides a shorthand way to add an array of files to the collection using includeFile()