org.cishell.service.conversion
Interface DataConversionService


public interface DataConversionService

A service for converting data to different formats. This service should utilize the pool of AlgorithmFactory services which have registered with the OSGi service registry and specified in its service dictionary that they are a converter. A converter will specify what data format it takes in ('in_data'), what it converts it to ('out_data'), and whether any information will be lost in the conversion ('conversion'='lossless'|'lossy'). Using this and other standard algorithm properties, a DataConversionService will try and find the fastest, most efficient way to convert from one format to another.

Author:
Bruce Herr (bh2@bh2.net)

Method Summary
 Data convert(Data data, String outFormat)
          Tries to convert a given Data object to the specified output format
 Converter[] findConverters(Data data, String outFormat)
          Tries to find all the converters that can be used to transform the given Data object to the specified output format
 Converter[] findConverters(String inFormat, String outFormat)
          Finds converters from one format to another if at all possible.
 

Method Detail

findConverters

Converter[] findConverters(String inFormat,
                           String outFormat)
Finds converters from one format to another if at all possible. The returned Converters, which may be a composite of multiple algorithms, will take a Data object of the specified inFormat and convert it to a Data object of type outFormat.

Parameters:
inFormat - The type of Data object to be converted. This String should be formatted in the same way as an algorithm's AlgorithmProperty.IN_DATA.
outFormat - The type of Data object that should be produced. This String should be formatted in the same way as an algorithm's AlgorithmProperty.OUT_DATA.
Returns:
An array of Converters that can convert a Data object of the given inFormat to the specified outFormat

findConverters

Converter[] findConverters(Data data,
                           String outFormat)
Tries to find all the converters that can be used to transform the given Data object to the specified output format

Parameters:
data - The Data object to convert
outFormat - The output format to convert to
Returns:
An array of Converters that can convert the given Data object to the specified output format

convert

Data convert(Data data,
             String outFormat)
             throws ConversionException
Tries to convert a given Data object to the specified output format

Parameters:
data - The Data to convert
outFormat - The format of the Data object to be returned
Returns:
A Data object with the specified output format
Throws:
ConversionException - If the data conversion fails while converting