org.jboss.dna.sequencer.images
Class ImageMetadataSequencer

java.lang.Object
  extended by org.jboss.dna.sequencer.images.ImageMetadataSequencer
All Implemented Interfaces:
StreamSequencer

public class ImageMetadataSequencer
extends java.lang.Object
implements StreamSequencer

A sequencer that processes the binary content of an image file, extracts the metadata for the image, and then writes that image metadata to the repository.

This sequencer produces data that corresponds to the following structure:

This structure could be extended in the future to add EXIF and IPTC metadata as child nodes. For example, EXIF metadata is structured as tags in directories, where the directories form something like namespaces, and which are used by different camera vendors to store custom metadata. This structure could be mapped with each directory (e.g. "EXIF" or "Nikon Makernote" or "IPTC") as the name of a child node, with the EXIF tags values stored as either properties or child nodes.

Author:
Randall Hauch

Field Summary
static java.lang.String IMAGE_BITS_PER_PIXEL
           
static java.lang.String IMAGE_ENCODING
           
static java.lang.String IMAGE_FORMAT_NAME
           
static java.lang.String IMAGE_HEIGHT
           
static java.lang.String IMAGE_MIME_TYPE
           
static java.lang.String IMAGE_MIXINS
           
static java.lang.String IMAGE_NUMBER_OF_IMAGES
           
static java.lang.String IMAGE_PHYSICAL_HEIGHT_DPI
           
static java.lang.String IMAGE_PHYSICAL_HEIGHT_INCHES
           
static java.lang.String IMAGE_PHYSICAL_WIDTH_DPI
           
static java.lang.String IMAGE_PHYSICAL_WIDTH_INCHES
           
static java.lang.String IMAGE_PRIMARY_TYPE
           
static java.lang.String IMAGE_PROGRESSIVE
           
static java.lang.String IMAGE_WIDTH
           
static java.lang.String METADATA_NODE
           
 
Constructor Summary
ImageMetadataSequencer()
           
 
Method Summary
 void sequence(java.io.InputStream stream, SequencerOutput output, ProgressMonitor progressMonitor)
          Sequence the data found in the supplied stream, placing the output information into the supplied map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METADATA_NODE

public static final java.lang.String METADATA_NODE
See Also:
Constant Field Values

IMAGE_PRIMARY_TYPE

public static final java.lang.String IMAGE_PRIMARY_TYPE
See Also:
Constant Field Values

IMAGE_MIXINS

public static final java.lang.String IMAGE_MIXINS
See Also:
Constant Field Values

IMAGE_MIME_TYPE

public static final java.lang.String IMAGE_MIME_TYPE
See Also:
Constant Field Values

IMAGE_ENCODING

public static final java.lang.String IMAGE_ENCODING
See Also:
Constant Field Values

IMAGE_FORMAT_NAME

public static final java.lang.String IMAGE_FORMAT_NAME
See Also:
Constant Field Values

IMAGE_WIDTH

public static final java.lang.String IMAGE_WIDTH
See Also:
Constant Field Values

IMAGE_HEIGHT

public static final java.lang.String IMAGE_HEIGHT
See Also:
Constant Field Values

IMAGE_BITS_PER_PIXEL

public static final java.lang.String IMAGE_BITS_PER_PIXEL
See Also:
Constant Field Values

IMAGE_PROGRESSIVE

public static final java.lang.String IMAGE_PROGRESSIVE
See Also:
Constant Field Values

IMAGE_NUMBER_OF_IMAGES

public static final java.lang.String IMAGE_NUMBER_OF_IMAGES
See Also:
Constant Field Values

IMAGE_PHYSICAL_WIDTH_DPI

public static final java.lang.String IMAGE_PHYSICAL_WIDTH_DPI
See Also:
Constant Field Values

IMAGE_PHYSICAL_HEIGHT_DPI

public static final java.lang.String IMAGE_PHYSICAL_HEIGHT_DPI
See Also:
Constant Field Values

IMAGE_PHYSICAL_WIDTH_INCHES

public static final java.lang.String IMAGE_PHYSICAL_WIDTH_INCHES
See Also:
Constant Field Values

IMAGE_PHYSICAL_HEIGHT_INCHES

public static final java.lang.String IMAGE_PHYSICAL_HEIGHT_INCHES
See Also:
Constant Field Values
Constructor Detail

ImageMetadataSequencer

public ImageMetadataSequencer()
Method Detail

sequence

public void sequence(java.io.InputStream stream,
                     SequencerOutput output,
                     ProgressMonitor progressMonitor)
Sequence the data found in the supplied stream, placing the output information into the supplied map.

JBoss DNA's SequencingService determines the sequencers that should be executed by monitoring the changes to one or more workspaces that it is monitoring. Changes in those workspaces are aggregated and used to determine which sequencers should be called. If the sequencer implements this interface, then this method is called with the property that is to be sequenced along with the interface used to register the output. The framework takes care of all the rest.

This operation should report progress to the supplied ProgressMonitor. At the beginning of the operation, call ProgressMonitor.beginTask(double, org.jboss.dna.common.i18n.I18n, Object...) with a meaningful message describing the operation and a total for the amount of work that will be done by this sequencer. Then perform the sequencing work, periodically reporting work by specifying the amount of work that has was just completed or by creating a subtask and reporting work against that subtask monitor.

The implementation should also periodically check whether the operation has been cancelled. If this method returns true, the implementation should abort all work as soon as possible and close any resources that were acquired or opened.

Finally, the implementation should call ProgressMonitor.done() when the operation has finished.

Specified by:
sequence in interface StreamSequencer
Parameters:
stream - the stream with the data to be sequenced; never null
output - the output from the sequencing operation; never null
progressMonitor - the progress monitor that should be kept updated with the sequencer's progress and that should be frequently consulted as to whether this operation has been cancelled.


Copyright © 2008. All Rights Reserved.