Package org.cdlib.mrt.core
Class FileComponent
java.lang.Object
org.cdlib.mrt.core.FileComponent
- All Implemented Interfaces:
Serializable
,StateInf
- Author:
- dloy
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pattern
protected File
protected DateState
protected String
protected String
final String
protected String
protected URL
final String
protected String
final String
protected static final String
protected HashSet<MessageDigest>
protected String
protected static final String
protected static final String
protected String
protected long
final String
protected String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionGeneric constructorprotected
FileComponent
(FileComponent fileComponent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessageDigest
(String digest, String algorithmS) Save a new MessageDigest for this filevoid
copy
(FileComponent fileState) copy "Constructor" Copy another FileState to this FileStateDump FileState informationboolean
equals
(FileComponent test) See if this FileState is equal to another FileStateGet a file for this ComponentLast modified DategetDate()
protected String
Display LastModifiedDate as Iso Dateprotected String
Dump Set of Digest valuesName of file including relative path valuesget LocalID valueReturn the first Message digest in digest set Typically there will only be one as saved in manifestgetMessageDigest
(String algorithmS) Return a specific digest based on algorithm e.g.getMessageDigest
(MessageDigestType algorithm) Return a specific digest based on an algorithm enumset of MessageDigest - each containing a unique MessageDigest type (e.g.File Mime typeget primaryID valuelong
getSize()
Size of file in bytesgetTitle()
getURL()
URL reference to fileprotected boolean
matchDigests
(FileComponent test) Match available digests - a successful match completes testboolean
matchFixity
(FileComponent test) Match this FileState to another FileState on MessageDigestprotected boolean
matchString
(String val1, String val2) local definition of string comparisonprotected boolean
local definition of URL comparisonstatic URL
void
setComponentFile
(File componentFile) Set file for this Componentvoid
set date/time of last modification using current Datevoid
setCreated
(DateState created) set date/time of last modificationvoid
setCreator
(String creator) void
void
setFirstMessageDigest
(String digest, String algorithmS) Save a new MessageDigest for this file as only digestvoid
setIdentifier
(String name) Set file Namevoid
setLastModifiedDate
(String lastModifiedDate) set date/time of last modification using the Iso date format as Stringvoid
setLocalID
(String localID) set localID valuevoid
setMessageDigests
(HashSet<MessageDigest> messageDigests) void
setMimeType
(String MimeType) Set MimeTypevoid
setPrimaryID
(String primaryID) set primaryID valuevoid
setSize
(long size) File sizevoid
File size as stringvoid
void
Set link to file passed as stringvoid
Set link to file
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
SIZE
- See Also:
-
MD5
- See Also:
-
FILEPATH
- See Also:
-
LINK
- See Also:
-
NL
-
size
protected long size -
messageDigests
-
identifier
-
link
-
created
-
MimeType
-
componentFile
-
-
localID
-
creator
-
title
-
date
-
boxToken
-
-
Constructor Details
-
FileComponent
-
FileComponent
public FileComponent()Generic constructor
-
-
Method Details
-
getComponentFile
Get a file for this Component- Returns:
- file for this Component
-
setComponentFile
Set file for this Component- Parameters:
file
- for this Component
-
getMimeType
File Mime type- Returns:
- file Mime Type
-
setMimeType
Set MimeType- Parameters:
MimeType
- set using this value
-
setCreated
set date/time of last modification- Parameters:
lastModifiedDate
-
-
setCreated
public void setCreated()set date/time of last modification using current Date -
getCreated
Last modified Date- Returns:
- last modified date
-
setLastModifiedDate
set date/time of last modification using the Iso date format as String- Parameters:
lastModifiedDate
-
-
addMessageDigest
Save a new MessageDigest for this file- Parameters:
digest
- character hex form of digest (checksum)algorithmS
- Digest type (checksumtype)- Throws:
TException
-
setFirstMessageDigest
Save a new MessageDigest for this file as only digest- Parameters:
digest
- character hex form of digest (checksum)algorithmS
- Digest type (checksumtype)- Throws:
TException
-
getMessageDigest
Return a specific digest based on algorithm e.g. return a checksum based on checksum type- Parameters:
algorithmS
- checksum type- Returns:
- hex character checksum
-
getMessageDigest
Return a specific digest based on an algorithm enum- Parameters:
algorithm
- enum form of checksum- Returns:
- hex character checksum
-
getIdentifier
Name of file including relative path values- Returns:
- File name
-
setIdentifier
Set file Name- Parameters:
name
- file Name
-
getURL
URL reference to file- Returns:
- file reference
-
getURLNorm
-
setURL
Set link to file- Parameters:
link
- file link
-
setURL
Set link to file passed as string- Parameters:
linkS
- String form of link to file- Throws:
TException
- argument not URL
-
getSize
public long getSize()Size of file in bytes- Returns:
- file size
-
setSize
public void setSize(long size) File size- Parameters:
size
- file Size
-
setSize
File size as string- Parameters:
sizeS
- file size as String- Throws:
TException
- non-numeric file size string
-
setMessageDigests
-
getMessageDigests
set of MessageDigest - each containing a unique MessageDigest type (e.g. checksum type)- Returns:
- Set of message digests for this specific file
-
getMessageDigest
Return the first Message digest in digest set Typically there will only be one as saved in manifest- Returns:
- first (or only) message digest
-
getLocalID
get LocalID value- Returns:
- LocalID value
-
setLocalID
set localID value- Parameters:
localID
- LocalID value
-
getPrimaryID
get primaryID value- Returns:
- primary ID
-
setPrimaryID
set primaryID value- Parameters:
primaryID
- primary ID
-
copy
copy "Constructor" Copy another FileState to this FileState- Parameters:
fileState
- copy from
-
matchFixity
Match this FileState to another FileState on MessageDigest- Parameters:
test
- comparison FileState- Returns:
- true=FileStates match, false=FileStates do not match
-
equals
See if this FileState is equal to another FileState- Parameters:
test
- comparison FileState- Returns:
- true=FileStates match, false=FileStates do not match
-
matchString
local definition of string comparison- Parameters:
val1
- match String1val2
- match String2- Returns:
- true=Strings match, false=Strings do not match
-
matchURL
local definition of URL comparison- Parameters:
val1
- match URL 1val2
- match URL 2- Returns:
- true=URLs match, false=URLs do not match
-
matchDigests
Match available digests - a successful match completes test- Parameters:
test
- FileState to match- Returns:
- true=a MessageDigest matches, false=a MessageDigest does not match OR no match was found
-
dump
Dump FileState information- Parameters:
header
- header for dump display- Returns:
- String containing dump information
-
getDigestDisplay
Dump Set of Digest values- Returns:
- String containing Digest values
-
getDateDisplay
Display LastModifiedDate as Iso Date- Returns:
- String containing Iso Date
-
getCreator
-
setCreator
-
getTitle
-
setTitle
-
getDate
-
setDate
-
normBox
-