DLESE Tools
v1.6.0

org.dlese.dpc.repository
Class SetInfo

java.lang.Object
  extended by org.dlese.dpc.repository.SetInfo
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
DcsSetInfo

public class SetInfo
extends Object
implements Serializable, Comparable

Data structure used in the RepositoryManager to hold information about a set of metadata files. Note that as of jOAI v3.x (Feb 2006), this class is no longer used to define OAI sets but is now only used to define the files that are configured in the RepositoryManager. OAI sets are now defined separately.

Author:
John Weatherley
See Also:
DirInfo, Serialized Form

Nested Class Summary
static class SetInfo.FormatComparator
          Implements Comparator to enable sorting by format.
static class SetInfo.NameComparator
          Implements Comparator to enable sorting by name.
static class SetInfo.NumDeletedComparator
          Implements Comparator to enable sorting by numDeleted.
static class SetInfo.NumFilesComparator
          Implements Comparator to enable sorting by numFiles.
static class SetInfo.NumIndexedComparator
          Implements Comparator to enable sorting by numIndexed.
static class SetInfo.NumIndexingErrorsComparator
          Implements Comparator to enable sorting by numIndexingErrors.
static class SetInfo.SetSpecComparator
          Implements Comparator to enable sorting by setSpec.
static class SetInfo.StatusComparator
          Implements Comparator to enable sorting by status.
 
Constructor Summary
SetInfo()
          Constructor for the SetInfo object
SetInfo(String name, String setSpec, String description, String enabled, String dir, String format, String id)
          Constructor for the SetInfo object
 
Method Summary
 void addDirInfo(String format, String dir)
          Adds a feature to the DirInfo attribute of the SetInfo object
 int compareTo(Object o)
          Compares two SetInfos by the Set Name.
 boolean containsDirectory(File directory)
          Determines whether a directory is configured in this SetInfo.
 boolean containsDirInfo(DirInfo dirInfo)
          Determines whether a DirInfo that matches the attributes of the given DirInfo already exists in this SetInfo.
 boolean equals(Object o)
          Checks equality of two SetInfo objects.
 String getAccessionStatus()
          Gets the accession status of this Set.
 Object getAttribute(String key)
          Gets an attribute Object from this SetInfo.
static Comparator getComparator(String type)
          Gets the comparator attribute of the SetInfo class
 String getDescription()
          Gets the XML description.
 String getDescriptionHtml()
          Gets the descriptionHtml attribute of the SetInfo object
 String getDirectory()
          Gets the primary directory path configured for this set, or an empty String if none is configured.
 DirInfo getDirInfo(int i)
          Gets the dirInfo attribute of the SetInfo object
 ArrayList getDirInfos()
          Gets the dirInfos attribute of the SetInfo object
 String getEnabled()
          Gets the enabled status String [true | false].
 String getFormat()
          Gets the metadata format of the files in the primary directory configured for this set, or an empty String if none is configured.
 String getId()
          Gets the record ID for this SetInfo.
 String getName()
          Gets the name attribute of the SetInfo object
 String getNameEncoded()
          Gets the name attribute of the SetInfo object, encoded for use in a URL.
 String getNumDeleted()
          Gets the number of items deleted for this collection.
 int getNumDeletedInt()
          Gets the number of items deleted for this collection.
 String getNumFiles()
          Gets the number of files for this collection.
 int getNumFilesInt()
          Gets the numFiles attribute of the SetInfo object
 String getNumIndexed()
          Gets the number of items indexed for this collection.
 int getNumIndexedInt()
          Gets the number of items indexed for this collection.
 String getNumIndexingErrors()
          Gets the number of indexing errors that were found for this collection.
 int getNumIndexingErrorsInt()
          Gets the number of indexing errors that were found for this collection.
 String getSetSpec()
          Gets the setSpec attribute of the SetInfo object
 String getUniqueID()
          Gets the unique ID for this SetInfo.
 long getUniqueIDLong()
          Gets the unique ID for this SetInfo.
 boolean isEnabled()
          Gets the enabled status boolean [true | false].
 void removeDirInfo(int i)
          DESCRIPTION
 void setAccessionStatus(String val)
          Sets the accession status for this Set.
 void setAttribute(String key, Object attribute)
          Sets an attribute Object that will be available for access using the given key.
 void setDescription(String val)
          Sets the description, which must be in XML form.
 void setDirInfo(int i, DirInfo dirInfo)
          Sets the dirInfo attribute of the SetInfo object
 void setDirInfo(int i, String dir, String format)
          Sets the dirInfo attribute of the SetInfo object
 void setEnabled(String val)
          Sets the enabled status [true | false].
 void setId(String id)
          Sets the record ID for this SetInfo.
 void setName(String val)
          Sets the name attribute of the SetInfo object
 void setSetInfoData(RepositoryManager rm)
          Sets data in the SetInfo for display in the UI.
 void setSetSpec(String val)
          Sets the setSpec attribute of the SetInfo object
 String toString()
          Provides a String representataion for this SetInfo.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetInfo

public SetInfo()
Constructor for the SetInfo object


SetInfo

public SetInfo(String name,
               String setSpec,
               String description,
               String enabled,
               String dir,
               String format,
               String id)
Constructor for the SetInfo object

Parameters:
name - The human-readable name of the set
setSpec - The oai setSpec that will be used to reference this set
dir - A directory where files for this set are located
format - The native metadata format for the files in the above directory
description - A description for this set, in XML form.
enabled - [true | false]
id - DESCRIPTION
Method Detail

getName

public String getName()
Gets the name attribute of the SetInfo object

Returns:
The name value

getId

public String getId()
Gets the record ID for this SetInfo.

Returns:
The record ID.

setId

public void setId(String id)
Sets the record ID for this SetInfo.

Parameters:
id - The record ID.

getUniqueID

public String getUniqueID()
Gets the unique ID for this SetInfo.

Returns:
The unique ID.

getUniqueIDLong

public long getUniqueIDLong()
Gets the unique ID for this SetInfo.

Returns:
The unique ID.

getNameEncoded

public String getNameEncoded()
Gets the name attribute of the SetInfo object, encoded for use in a URL.

Returns:
The name encoded with URL encoing.

setName

public void setName(String val)
Sets the name attribute of the SetInfo object

Parameters:
val - The new name value

getSetSpec

public String getSetSpec()
Gets the setSpec attribute of the SetInfo object

Returns:
The setSpec value

setSetSpec

public void setSetSpec(String val)
Sets the setSpec attribute of the SetInfo object

Parameters:
val - The new setSpec value

getDescription

public String getDescription()
Gets the XML description.

Returns:
The description value

getFormat

public String getFormat()
Gets the metadata format of the files in the primary directory configured for this set, or an empty String if none is configured. The primary directory is the first one configured.

Returns:
The metadta format of the files.

getDirectory

public String getDirectory()
Gets the primary directory path configured for this set, or an empty String if none is configured. The primary directory is the first one configured.

Returns:
The directory path.

getDescriptionHtml

public String getDescriptionHtml()
Gets the descriptionHtml attribute of the SetInfo object

Returns:
The descriptionHtml value

setDescription

public void setDescription(String val)
Sets the description, which must be in XML form.

Parameters:
val - The new description value

getEnabled

public String getEnabled()
Gets the enabled status String [true | false].

Returns:
The enabled status.

isEnabled

public boolean isEnabled()
Gets the enabled status boolean [true | false].

Returns:
The enabled status.

setEnabled

public void setEnabled(String val)
Sets the enabled status [true | false].

Parameters:
val - The String 'true' or 'false'.

getDirInfos

public ArrayList getDirInfos()
Gets the dirInfos attribute of the SetInfo object

Returns:
The dirInfos value

getDirInfo

public DirInfo getDirInfo(int i)
Gets the dirInfo attribute of the SetInfo object

Parameters:
i - DESCRIPTION
Returns:
The dirInfo value

setDirInfo

public void setDirInfo(int i,
                       DirInfo dirInfo)
Sets the dirInfo attribute of the SetInfo object

Parameters:
i - The new dirInfo value
dirInfo - The new dirInfo value

setDirInfo

public void setDirInfo(int i,
                       String dir,
                       String format)
Sets the dirInfo attribute of the SetInfo object

Parameters:
i - The new dirInfo value
dir - The new dirInfo value
format - The new dirInfo value

containsDirInfo

public boolean containsDirInfo(DirInfo dirInfo)
Determines whether a DirInfo that matches the attributes of the given DirInfo already exists in this SetInfo.

Parameters:
dirInfo - A DirInfo to check for existance.
Returns:
True if the DirInfo exists in this SetInfo.

getNumFiles

public String getNumFiles()
Gets the number of files for this collection.

Returns:
The numFiles value

getNumFilesInt

public int getNumFilesInt()
Gets the numFiles attribute of the SetInfo object

Returns:
The numFiles value

setSetInfoData

public void setSetInfoData(RepositoryManager rm)
Sets data in the SetInfo for display in the UI. This includes things like the number of items indexed for this collection, the number if items that are discoverable for this collection, the number of files for this collection, and the number of index errors that were detected for this collection. Also the collection accession status.

Parameters:
rm - The RepositoryManager whoes index contains the collections configured by this SetSpec.

getAccessionStatus

public String getAccessionStatus()
Gets the accession status of this Set.

Returns:
The accession status

setAccessionStatus

public void setAccessionStatus(String val)
Sets the accession status for this Set.

Parameters:
val - The accession status.

getNumIndexed

public String getNumIndexed()
Gets the number of items indexed for this collection.

Returns:
The numIndexed value

getNumIndexedInt

public int getNumIndexedInt()
Gets the number of items indexed for this collection.

Returns:
The numIndexed value

getNumDeleted

public String getNumDeleted()
Gets the number of items deleted for this collection.

Returns:
The numDeleted value

getNumDeletedInt

public int getNumDeletedInt()
Gets the number of items deleted for this collection.

Returns:
The numDeleted value

getNumIndexingErrors

public String getNumIndexingErrors()
Gets the number of indexing errors that were found for this collection.

Returns:
The numIndexingErrors value

getNumIndexingErrorsInt

public int getNumIndexingErrorsInt()
Gets the number of indexing errors that were found for this collection.

Returns:
The numIndexingErrors value

containsDirectory

public boolean containsDirectory(File directory)
Determines whether a directory is configured in this SetInfo.

Parameters:
directory - A file directory.
Returns:
True if the directory is configured in this SetInfo.

removeDirInfo

public void removeDirInfo(int i)
DESCRIPTION

Parameters:
i - DESCRIPTION

addDirInfo

public void addDirInfo(String format,
                       String dir)
Adds a feature to the DirInfo attribute of the SetInfo object

Parameters:
format - The feature to be added to the DirInfo attribute
dir - The feature to be added to the DirInfo attribute

setAttribute

public void setAttribute(String key,
                         Object attribute)
Sets an attribute Object that will be available for access using the given key. The object MUST be serializable.

Parameters:
key - The key used to reference the attribute.
attribute - Any Java Object that is Serializable.

getAttribute

public Object getAttribute(String key)
Gets an attribute Object from this SetInfo.

Parameters:
key - The key used to reference the attribute.
Returns:
The Java Object that was stored under the given key or null if none exists.

toString

public String toString()
Provides a String representataion for this SetInfo. This method may be used for debugging to see what is in the SetInfo. This method is also used it the equals(Object) method.

Overrides:
toString in class Object
Returns:
String describing all data in the SetInfo.

equals

public boolean equals(Object o)
Checks equality of two SetInfo objects.

Overrides:
equals in class Object
Parameters:
o - The SetInfo to compare to this
Returns:
True iff the compared object is equal

compareTo

public int compareTo(Object o)
              throws ClassCastException
Compares two SetInfos by the Set Name. Collections.sort() or Arrays.sort() can thus be used to sort a list of SetInfos by Name.

Specified by:
compareTo in interface Comparable
Parameters:
o - The SetInfo to compare
Returns:
Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - If the object passed in is not a SetInfo.

getComparator

public static Comparator getComparator(String type)
Gets the comparator attribute of the SetInfo class

Parameters:
type - The comparator type, for example 'key'
Returns:
The comparator value

DLESE Tools
v1.6.0