magoffin.matt.ma2.support
Class SmetaMediaMetadata

java.lang.Object
  extended by magoffin.matt.ma2.support.AbstractMediaMetadata
      extended by magoffin.matt.ma2.support.SmetaMediaMetadata
All Implemented Interfaces:
EmbeddedImageMetadata, MediaMetadata

public class SmetaMediaMetadata
extends AbstractMediaMetadata
implements MediaMetadata, EmbeddedImageMetadata

General purpose MediaMetadata using sMeta.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Constructor Summary
SmetaMediaMetadata()
          Default consstructor.
SmetaMediaMetadata(java.util.Locale locale)
          Construct with a specific locale.
 
Method Summary
 java.lang.String getCreationDateKey()
           
 java.awt.image.BufferedImage getEmbeddedImage()
          Get a BufferedImage for the embedded image.
 int getEmbeddedImageHeight()
          Get the height, in pixels, of the embedded image.
 java.lang.String getEmbeddedImageKey()
           
 java.lang.String getEmbeddedImageMimeType()
          Get the MIME type of the embedded image.
 org.springframework.core.io.Resource getEmbeddedImageResource()
          Get the embedded image as a Resource (original image data).
 int getEmbeddedImageWidth()
          Get the width, in pixels, of the embedded image.
 magoffin.matt.meta.MetadataResourceFactoryManager getFactoryManager()
           
 java.util.Set<java.lang.Class<?>> getTreatAsStrings()
           
 boolean hasEmbeddedImage()
          Return true if an embedded image is available.
 void setCreationDateKey(java.lang.String creationDateKey)
           
 void setEmbeddedImageKey(java.lang.String embeddedImageKey)
           
 void setFactoryManager(magoffin.matt.meta.MetadataResourceFactoryManager factoryManager)
           
 MediaMetadata setMediaResource(org.springframework.core.io.Resource resource)
          Set the media resource from which to extract metadata from.
 void setTreatAsStrings(java.util.Set<java.lang.Class<?>> treatAsStrings)
           
 
Methods inherited from class magoffin.matt.ma2.support.AbstractMediaMetadata
addToMap, getCreationDate, getMetadataMap, setCreationDate, setMetadataMap
 
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
getCreationDate, getMetadataMap
 

Constructor Detail

SmetaMediaMetadata

public SmetaMediaMetadata()
Default consstructor.


SmetaMediaMetadata

public SmetaMediaMetadata(java.util.Locale locale)
Construct with a specific locale.

Parameters:
locale - the Locale to use
Method Detail

hasEmbeddedImage

public boolean hasEmbeddedImage()
Description copied from interface: EmbeddedImageMetadata
Return true if an embedded image is available.

Specified by:
hasEmbeddedImage in interface EmbeddedImageMetadata
Returns:
boolean

setMediaResource

public MediaMetadata setMediaResource(org.springframework.core.io.Resource resource)
Description copied from interface: MediaMetadata
Set the media resource from which to extract metadata from.

After this method is called, the other methods on the returned instance should return meta data extracted from this resource. Note the returned instance may not be the same instance as the one the method is called on, so that during the extraction process a more-specific instance can be returned (e.g. for a digital camera metadata instance, a generic image metadata might be instantiated, but a more specific one returned by this method when it discovers the type of camera make/model the media resource was taken with).

Specified by:
setMediaResource in interface MediaMetadata
Parameters:
resource - the media resource being processed
Returns:
a MediaMetadata instance, may be a new instance or the same instance this method was called on

getEmbeddedImageHeight

public int getEmbeddedImageHeight()
Description copied from interface: EmbeddedImageMetadata
Get the height, in pixels, of the embedded image.

Specified by:
getEmbeddedImageHeight in interface EmbeddedImageMetadata
Returns:
height

getEmbeddedImageWidth

public int getEmbeddedImageWidth()
Description copied from interface: EmbeddedImageMetadata
Get the width, in pixels, of the embedded image.

Specified by:
getEmbeddedImageWidth in interface EmbeddedImageMetadata
Returns:
width

getEmbeddedImageResource

public org.springframework.core.io.Resource getEmbeddedImageResource()
Description copied from interface: EmbeddedImageMetadata
Get the embedded image as a Resource (original image data).

If EmbeddedImageMetadata.hasEmbeddedImage() returns true, this method will extract the image data and return it as-is, without any alteration, so it can be returned directly as the original image data.

Specified by:
getEmbeddedImageResource in interface EmbeddedImageMetadata
Returns:
Resource for the original embedded image data

getEmbeddedImageMimeType

public java.lang.String getEmbeddedImageMimeType()
Description copied from interface: EmbeddedImageMetadata
Get the MIME type of the embedded image.

Specified by:
getEmbeddedImageMimeType in interface EmbeddedImageMetadata
Returns:
MIME type

getEmbeddedImage

public java.awt.image.BufferedImage getEmbeddedImage()
Description copied from interface: EmbeddedImageMetadata
Get a BufferedImage for the embedded image.

If EmbeddedImageMetadata.hasEmbeddedImage() returns true, this method will extract the image data and return it as a BufferedImage.

Specified by:
getEmbeddedImage in interface EmbeddedImageMetadata
Returns:
BufferedImage

getFactoryManager

public magoffin.matt.meta.MetadataResourceFactoryManager getFactoryManager()
Returns:
the factoryManager

setFactoryManager

public void setFactoryManager(magoffin.matt.meta.MetadataResourceFactoryManager factoryManager)
Parameters:
factoryManager - the factoryManager to set

getCreationDateKey

public java.lang.String getCreationDateKey()
Returns:
the creationDateKey

setCreationDateKey

public void setCreationDateKey(java.lang.String creationDateKey)
Parameters:
creationDateKey - the creationDateKey to set

getTreatAsStrings

public java.util.Set<java.lang.Class<?>> getTreatAsStrings()
Returns:
the treatAsStrings

setTreatAsStrings

public void setTreatAsStrings(java.util.Set<java.lang.Class<?>> treatAsStrings)
Parameters:
treatAsStrings - the treatAsStrings to set

getEmbeddedImageKey

public java.lang.String getEmbeddedImageKey()
Returns:
the embeddedImageKey

setEmbeddedImageKey

public void setEmbeddedImageKey(java.lang.String embeddedImageKey)
Parameters:
embeddedImageKey - the embeddedImageKey to set