Package digilib.meta
Class IndexMetaAuthLoader
- java.lang.Object
-
- digilib.meta.IndexMetaAuthLoader
-
public class IndexMetaAuthLoader extends Object
Class loading index.meta files extracting image file related information. Extracts into the MetadataMap all tags in the meta/img tag as key-value pairs and information from the meta/access tag under the "access" key.<meta> <img> <original-dpi>600</original-dpi> </img> <access-conditions> <access type="group"> <name>digigroup</name> </access> </access-conditions> </meta>
{ "pageimg/page140r.jpg" : {"original-dpi" : 300} "" : { "access" : "group:digigroup", "original-dpi" : 600}, }
Implemented using javax.xml.stream.XMLStreamReader.- Author:
- Robert Casties
- See Also:
- index.meta spec
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
accessNamePath
protected String[]
accessPath
protected String
accessTag
protected String[]
fileMetaPath
protected String[]
fileNamePath
protected String[]
filePathPath
protected Map<String,MetadataMap>
files
protected String
fileTag
protected String
imgTag
protected static org.slf4j.Logger
logger
protected String
metaTag
-
Constructor Summary
Constructors Constructor Description IndexMetaAuthLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,MetadataMap>
loadUri(URI uri)
Load and parse a file (as URI).protected MetadataMap
readAccessToMap(MetadataMap map)
Reads access tag into map.protected boolean
readAll()
Read the whole stream.protected MetadataMap
readMetaTag(MetadataMap map)
Read meta tag into map.protected MetadataMap
readTagToMap(MetadataMap map)
Reads contents of current tag into map with the tag name as key and the content as value.protected boolean
tagsMatchPath(String[] path)
Returns if the tag names in path match the current stack of tag names in tags.
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
metaTag
protected String metaTag
-
fileTag
protected String fileTag
-
fileNamePath
protected String[] fileNamePath
-
filePathPath
protected String[] filePathPath
-
fileMetaPath
protected String[] fileMetaPath
-
imgTag
protected String imgTag
-
accessTag
protected String accessTag
-
accessPath
protected String[] accessPath
-
accessNamePath
protected String[] accessNamePath
-
files
protected Map<String,MetadataMap> files
-
-
Method Detail
-
tagsMatchPath
protected boolean tagsMatchPath(String[] path)
Returns if the tag names in path match the current stack of tag names in tags.- Parameters:
path
- the path- Returns:
- tags match path
-
readAll
protected boolean readAll() throws XMLStreamException
Read the whole stream.- Returns:
- false
- Throws:
XMLStreamException
- on error
-
readTagToMap
protected MetadataMap readTagToMap(MetadataMap map) throws XMLStreamException
Reads contents of current tag into map with the tag name as key and the content as value.- Parameters:
map
- the MetadataMap- Returns:
- the MetadataMap
- Throws:
XMLStreamException
- on error
-
readAccessToMap
protected MetadataMap readAccessToMap(MetadataMap map) throws XMLStreamException
Reads access tag into map.- Parameters:
map
- the MetadataMap- Returns:
- the MetadataMap
- Throws:
XMLStreamException
- on error
-
readMetaTag
protected MetadataMap readMetaTag(MetadataMap map) throws XMLStreamException
Read meta tag into map.- Parameters:
map
- the MetadataMap- Returns:
- the MetadataMap
- Throws:
XMLStreamException
- on error
-
loadUri
public Map<String,MetadataMap> loadUri(URI uri) throws IOException
Load and parse a file (as URI). returns HashMap with list data- Parameters:
uri
- the URI- Returns:
- the metadata
- Throws:
IOException
- on error
-
-