org.jboss.dna.spi.sequencers
Interface StreamSequencer

All Known Implementing Classes:
ImageMetadataSequencer, Mp3MetadataSequencer

public interface StreamSequencer

The interface for a DNA sequencer that processes a property as a stream to extract information from the content and store in the repository.

Implementations must provide a no-argument constructor.

Author:
Randall Hauch

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.
 

Method Detail

sequence

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.

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.