|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.AccessionData
public final class AccessionData
Immutable, Serializable collection of all the accession data for an exhibit. This contains all of the available accession data for an exhibit, ie data collected at or after the exhibit was added to the library, such as checksums to verify that the exhibit has not become corrupted.
In some cases not all fields will be complete.
The core fields are made available as public final fields for speed of access.
We do not ever expect two instances for different exhibits to be equal, so the only reason to intern() the whole object is to reduce heap churn between an extant and new/updated exhibit set. We don't do this automatically during deserialisation, and leave it up to a user of this type to do so if they wish. We do not intern() the fields of this object individually, to help avoid pointless space and time being taken in intern().
| Field Summary | |
|---|---|
java.lang.Long |
date
Nominal time/data at which exhibit was added to the Gallery; null or strictly positive. |
private static javax.xml.parsers.DocumentBuilderFactory |
dbf_gAD
Private shared factory_pFX for getAsDOM(); never null. |
static AccessionData |
EMPTY
Public empty instance. |
private static javax.xml.parsers.DocumentBuilderFactory |
factory_pFX
Private shared factory_pFX for parseFromXML(); never null. |
static int |
HASH_BLOCK_SIZE_BYTES
Block size (in bytes) used for partial hashes; strictly positive power of two. |
java.lang.Integer |
hashCRC32
Accession-time CRC32 whole-exhibit hash or null if not available. |
ROByteArray |
hashMD5
Accession-time MD5 whole-exhibit hash or null if not available. |
static java.lang.String |
NAME_ACCESSION_CRC32
Name of the accession-time whole-exhibit CRC32 hash sub-node, if any. |
static java.lang.String |
NAME_ACCESSION_DATE
Name of the accession date sub-node, if any. |
static java.lang.String |
NAME_ACCESSION_MD5
Name of the accession-time whole-exhibit MD5 hash sub-node, if any. |
static java.lang.String |
NAME_ACCESSION_SIZE
Name of the accession-time size sub-node, if any. |
static java.lang.String |
NAME_TOP_NODE
Top-level node name for XML representation, ie tag name. |
private static long |
serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/. |
java.lang.Long |
size
Size of exhibit file at time of accession; null or strictly positive. |
| Constructor Summary | |
|---|---|
private |
AccessionData()
Construct new immutable instance with no data. |
|
AccessionData(java.lang.Long accessionDate,
java.lang.Long accessionSize,
java.lang.Integer accessionCRC32,
ROByteArray accessionMD5)
Construct new immutable instance with the given data. |
| Method Summary | |
|---|---|
static Tuple.Pair<java.lang.Integer,ROByteArray> |
computeFullFileHashes(java.io.InputStream is)
Compute the full-file hashes over an exhibit; never null and neither element of the Pair null. |
boolean |
equals(java.lang.Object o)
All fields are compared. |
static AccessionData |
fromExhibitFile(java.io.File f)
Construct accession data purely from the exhibit file. |
org.w3c.dom.Node |
getAsDOM()
Get exhibit accession metadata as DOM, never null. |
int |
hashCode()
The hashCode is VM-independent. |
boolean |
isIncomplete()
If true, some accession data is missing (eg null). |
static AccessionData |
parseFromXML(java.lang.String xml)
Parse from XML format UNICODE text. |
protected java.lang.Object |
readResolve()
Deserialise: use constructor for validation, defensive copying, etc. |
void |
validateObject()
Validate fields/state. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String NAME_TOP_NODE
public static final java.lang.String NAME_ACCESSION_DATE
public static final java.lang.String NAME_ACCESSION_SIZE
public static final java.lang.String NAME_ACCESSION_CRC32
public static final java.lang.String NAME_ACCESSION_MD5
public static final int HASH_BLOCK_SIZE_BYTES
public final java.lang.Long date
This can the same as, or later than, the exhibit's timestamp. If earlier than the exhibit's timestamp it may mean that the exhibit has been altered in some way.
public final java.lang.Long size
This should be identical to the current exhibit length else it may mean that the exhibit has been altered in some way.
public final java.lang.Integer hashCRC32
public final ROByteArray hashMD5
We use MD5 since it is commonly used elsewhere as a file checksum, and will in practice detect any conceivable corruption in exhibits especially given that we separately record the length.
private static final javax.xml.parsers.DocumentBuilderFactory dbf_gAD
public static final AccessionData EMPTY
private static final javax.xml.parsers.DocumentBuilderFactory factory_pFX
private static final long serialVersionUID
| Constructor Detail |
|---|
private AccessionData()
public AccessionData(java.lang.Long accessionDate,
java.lang.Long accessionSize,
java.lang.Integer accessionCRC32,
ROByteArray accessionMD5)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - in the case of bad data| Method Detail |
|---|
public final boolean isIncomplete()
public org.w3c.dom.Node getAsDOM()
All this data is also accessible by (probably cheaper) direct accessor methods or fields if required.
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object o)
equals in class java.lang.Object
public static AccessionData parseFromXML(java.lang.String xml)
throws java.io.IOException
xml - must be correct XML format and start with '<',
not null, not zero-length
java.io.IOException - in case of difficulty parsing the text
public static AccessionData fromExhibitFile(java.io.File f)
throws java.io.IOException
This does not check that the exhibit is valid except that it is a plain file and not zero-length.
java.io.IOException
public static Tuple.Pair<java.lang.Integer,ROByteArray> computeFullFileHashes(java.io.InputStream is)
throws java.io.IOException
This does not close the InputStream.
The InputStream need not be buffered since we read in large efficient blocks anyway if possible.
java.io.IOExceptionprotected java.lang.Object readResolve()
public void validateObject()
throws java.io.InvalidObjectException
Barf if something bad is found. (Maybe allow some extra info in debug version.)
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException
|
DHD Multimedia Gallery V1.50.55 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||