Package digilib.io
Class CdstarArchiveDocuDirectory
java.lang.Object
digilib.io.DocuDirectory
digilib.io.CdstarArchiveDocuDirectory
- All Implemented Interfaces:
Iterable<DocuDirent>
DocuDirectory backed by a CDSTAR archive.
Initialized with the CDSTAR archive URL.
Reads and caches all file entries in the archive on first access.
Treats all file entries in the archive as files in this DocuDirectory
(even if their file names contain slashes).
Reads image sizes from "exif:Image.ImageHeight" and "exif:Image.ImageWidth"
attributes in CDSTAR file metadata.
- Author:
- casties
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Small data class with information about the CDSTAR archive. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
number of files to read in one requestprotected String
static final String
digilib-config key for the info request batch sizestatic final int
maximum number of info requestsstatic final String
key for image height in CDSTAR metadatastatic final String
key for image width in CDSTAR metadatastatic final int
time in ms to delay the next archive info call and reuse existing informationstatic final String
digilib-config key for the CDSTAR base URLFields inherited from class digilib.io.DocuDirectory
dirMTime, dirName, fileClass, files, isValid, logger, meta, objectATime, parent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(String path, FileOps.FileClass fileClass, DigilibConfiguration dlConfig) Configure object with digilib directory path and a parent DocuDirCache.createFilename
(String fn) Returns a possible file name for path fn.Returns a possible parent directory name for path fn.protected CdstarArchiveDocuDirectory.ArchiveInfo
readArchiveInfo
(org.apache.http.impl.client.CloseableHttpClient httpclient, int offset, int limit, CdstarArchiveDocuDirectory.ArchiveInfo info) boolean
readDir()
Read the filesystem directory and fill this object.protected CdstarArchiveDocuDirectory.ArchiveInfo
readFilesJson
(InputStream instream, CdstarArchiveDocuDirectory.ArchiveInfo info) boolean
refresh()
Check to see if the directory has been modified and reread if necessary.Methods inherited from class digilib.io.DocuDirectory
checkMeta, find, get, getAccessTime, getDirMTime, getDirName, getMeta, getParent, indexOf, isBasenameAt, isPrefixBasenameAt, isRead, isValid, iterator, readMeta, setParent, size, touch
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
META_IMAGE_HEIGHT_KEY
key for image height in CDSTAR metadata- See Also:
-
META_IMAGE_WIDTH_KEY
key for image width in CDSTAR metadata- See Also:
-
REFRESH_DELAY
public static final int REFRESH_DELAYtime in ms to delay the next archive info call and reuse existing information- See Also:
-
FILES_BATCH_SIZE_KEY
digilib-config key for the info request batch size- See Also:
-
archiveBatchSize
protected int archiveBatchSizenumber of files to read in one request -
MAX_INFO_REQUESTS
public static final int MAX_INFO_REQUESTSmaximum number of info requests- See Also:
-
STORAGE_URL_KEY
digilib-config key for the CDSTAR base URL- See Also:
-
archiveUrl
-
-
Constructor Details
-
CdstarArchiveDocuDirectory
public CdstarArchiveDocuDirectory()
-
-
Method Details
-
configure
Description copied from class:DocuDirectory
Configure object with digilib directory path and a parent DocuDirCache. Directory names at the given path are appended to the base directories from the cache. The directory is checked on disk and isValid is set.- Overrides:
configure
in classDocuDirectory
- Parameters:
path
- digilib directory path namefileClass
- type of files in this DocuDirectorydlConfig
- digilib config- See Also:
-
readDir
public boolean readDir()Description copied from class:DocuDirectory
Read the filesystem directory and fill this object. Clears the List and (re)reads all files.- Specified by:
readDir
in classDocuDirectory
- Returns:
- boolean the directory exists
-
readArchiveInfo
protected CdstarArchiveDocuDirectory.ArchiveInfo readArchiveInfo(org.apache.http.impl.client.CloseableHttpClient httpclient, int offset, int limit, CdstarArchiveDocuDirectory.ArchiveInfo info) throws IOException, URISyntaxException - Parameters:
httpclient
-offset
-info
-- Returns:
- Throws:
IOException
URISyntaxException
-
readFilesJson
protected CdstarArchiveDocuDirectory.ArchiveInfo readFilesJson(InputStream instream, CdstarArchiveDocuDirectory.ArchiveInfo info) - Parameters:
instream
-info
-- Returns:
-
refresh
public boolean refresh()Description copied from class:DocuDirectory
Check to see if the directory has been modified and reread if necessary.- Specified by:
refresh
in classDocuDirectory
- Returns:
- boolean the directory is valid
-
createParentName
Description copied from class:DocuDirectory
Returns a possible parent directory name for path fn.- Specified by:
createParentName
in classDocuDirectory
- Parameters:
fn
- the fn- Returns:
- the parent name
-
createFilename
Description copied from class:DocuDirectory
Returns a possible file name for path fn.- Specified by:
createFilename
in classDocuDirectory
- Parameters:
fn
- the fn- Returns:
- the name
-