magoffin.matt.ma2.support
Class AbstractMediaMetadata

java.lang.Object
  extended by magoffin.matt.ma2.support.AbstractMediaMetadata
All Implemented Interfaces:
MediaMetadata
Direct Known Subclasses:
SmetaMediaMetadata

public abstract class AbstractMediaMetadata
extends java.lang.Object
implements MediaMetadata

Basic implementation of MediaMetadata.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Constructor Summary
AbstractMediaMetadata()
           
 
Method Summary
protected  void addToMap(java.lang.Object key, java.lang.String value)
          Add a non-null value to the metadata Map.
 java.util.Date getCreationDate()
          Get the date the item was created.
 java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
          Get a Map of all meta data values.
 void setCreationDate(java.util.Date creationDate)
           
 void setMetadataMap(java.util.Map<java.lang.String,java.lang.String> metadataMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface magoffin.matt.ma2.MediaMetadata
setMediaResource
 

Constructor Detail

AbstractMediaMetadata

public AbstractMediaMetadata()
Method Detail

getCreationDate

public java.util.Date getCreationDate()
Description copied from interface: MediaMetadata
Get the date the item was created.

This method should return a "creation date" for the media resource, if found in the resource's metadat. For example the EXIF metadata format stores the date/time the image was created, i.e. the date/time the photo was taken. This method should return that date. If no appropriate date can be found in the media resource's metadata, this method should return null.

This method can only be called after MediaMetadata.setMediaResource(Resource) has been called on this particular MediaMetadata instance.

Specified by:
getCreationDate in interface MediaMetadata
Returns:
Date, or null if unknown

getMetadataMap

public java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
Description copied from interface: MediaMetadata
Get a Map of all meta data values.

This method should return a Map of all avaialble metadata values extracted from the media resource that can be represented as simple String values. These values can then be added to a MediaItem instance's Metadata (i.e. the List returned by MediaItem.getMetadata().

This method can only be called after MediaMetadata.setMediaResource(Resource) has been called on this particular MediaMetadata instance.

Specified by:
getMetadataMap in interface MediaMetadata
Returns:
map of all available meta data extracted from the resource

addToMap

protected void addToMap(java.lang.Object key,
                        java.lang.String value)
Add a non-null value to the metadata Map.

If the value is null then nothing will be added to the Map. The Object.toString() method is called on the key to add to the Map.

Parameters:
key - the Map key
value - the Map value

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Parameters:
creationDate - The creationDate to set.

setMetadataMap

public void setMetadataMap(java.util.Map<java.lang.String,java.lang.String> metadataMap)
Parameters:
metadataMap - The metadataMap to set.