|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.meta.image.EXIFMetadataResourceFactory
public class EXIFMetadataResourceFactory
MetadataResourceFactory
for EXIF metadata, eg. JPEG images.
This class manages finding camera-specific MetadataResource
implementations for EXIF-based images based on a classpath Properties
resource. This class will search in the following locations:
The properties are searched until the first suitable key is found. The
properties resource is loaded via the same ClassLoader that loaded this class, i.e.
getClass().getClassLoader().getResource()
is used. The properties
file must have the format
smeta.camera.MAKE.MODEL = CLASS
where MAKE
is an EXIF camera make (spaces removed),
MODEL
is an EXIF camera model (spaces removed), and
CLASS
is a fully-qualified class name that implements
MetadataResource
. The MetadataResource
implementation
must provide a constructor that takes a single Metadata
object
as a parameter, which will be invoked by this factory. The class will
be loaded via the same ClassLoader that loaded this class, i.e.
getClass().getClassLoader().loadClass()
is used.
The MODEL
may also be specified as a wildcard by
using a *
value. In this case, if a specific model match
is not found, the wildcard value will be used.
An example of the property format looks like this:
smeta.camera.canon.canon20d=meta.image.camera.Canon20D smeta.camera.canon.canonpowershotg5=meta.image.camera.CanonG5 smeta.camera.canon.*=meta.image.camera.Canon
Field Summary | |
---|---|
static java.lang.String |
CAMERA_PROPERTY_KEY_PREFIX
The prefix used for MetadataResource configuration properties. |
static java.lang.String |
CUSTOM_CAMERA_PROPERTIES
A custom class-path properties file. |
static java.lang.String |
DEFAULT_CAMERA_PROPERTIES
The default class-path properties file. |
static java.lang.String |
MATCH_ANY_MODEL
Special key for the makeModelMap to match any camera model. |
Constructor Summary | |
---|---|
EXIFMetadataResourceFactory()
Default constructor. |
Method Summary | |
---|---|
protected java.lang.String |
extractCameraMakeKey(com.drew.metadata.Metadata exif)
Extract the camera make as a property key. |
protected java.lang.String |
extractCameraModelKey(com.drew.metadata.Metadata exif)
Extract the cameral model as a property key. |
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Class<? extends MetadataResource>>> |
getMakeModelMap()
|
MetadataResource |
getMetadataResourceInstance(java.io.File file)
Get a MetadataResource for a given file. |
protected void |
setMakeModelMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Class<? extends MetadataResource>>> makeModelMap)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CUSTOM_CAMERA_PROPERTIES
public static final java.lang.String DEFAULT_CAMERA_PROPERTIES
public static final java.lang.String CAMERA_PROPERTY_KEY_PREFIX
MetadataResource
configuration properties.
public static final java.lang.String MATCH_ANY_MODEL
Constructor Detail |
---|
public EXIFMetadataResourceFactory()
Method Detail |
---|
public MetadataResource getMetadataResourceInstance(java.io.File file) throws java.io.IOException, MetadataNotSupportedException
MetadataResourceFactory
MetadataResource
for a given file.
getMetadataResourceInstance
in interface MetadataResourceFactory
file
- the file
java.io.IOException
- if an IO error occurs
MetadataNotSupportedException
- if the file is not supported for any reasonprotected java.lang.String extractCameraMakeKey(com.drew.metadata.Metadata exif)
exif
- the Metadata to extract from
protected java.lang.String extractCameraModelKey(com.drew.metadata.Metadata exif)
exif
- the Metadata to extract from
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Class<? extends MetadataResource>>> getMakeModelMap()
protected void setMakeModelMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Class<? extends MetadataResource>>> makeModelMap)
makeModelMap
- the makeModelMap to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |