SMILA 1.0 API documentation

org.eclipse.smila.importing.compounds
Interface CompoundExtractor

All Known Implementing Classes:
SimpleCompoundExtractorService

public interface CompoundExtractor

Service interface for extracting compounds and to determine if a file is a compound that can be handled by this service.


Field Summary
static java.lang.String KEY_COMMENT
          key for entry comment.
static java.lang.String KEY_COMPOUNDS
          key for the compound list.
static java.lang.String KEY_COMPRESSED_SIZE
          key for entry compressed size.
static java.lang.String KEY_FILE_NAME
          key for entry name.
static java.lang.String KEY_IS_COMPOUND
          key to mark compounds.
static java.lang.String KEY_IS_ROOT_COMPOUND_RECORD
          key for the base compound record flag.
static java.lang.String KEY_SIZE
          key for entry size.
static java.lang.String KEY_TIME
          key for entry time.
 
Method Summary
 boolean canExtract(java.io.File file)
          Can the file be extracted by the CompoundExtractor service?
 boolean canExtract(java.lang.String fileName, java.lang.String mimeType)
          Can the file be extracted by the CompoundExtractor service?
 boolean canExtract(java.net.URL url, java.lang.String mimeType)
          Can the file be extracted by the CompoundExtractor service?
 java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream, java.lang.String fileName, java.lang.String contentAttachmentName)
          Extract the compounds (recursively) and return an iterator over the resulting records that have been created from the extracted compound.
 java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream, java.lang.String fileName, java.lang.String mimeType, java.lang.String contentAttachmentName)
          Extract the compounds (recursively) and return an iterator over the resulting records that have been created from the extracted compound.
 

Field Detail

KEY_SIZE

static final java.lang.String KEY_SIZE
key for entry size.

See Also:
Constant Field Values

KEY_TIME

static final java.lang.String KEY_TIME
key for entry time.

See Also:
Constant Field Values

KEY_COMPRESSED_SIZE

static final java.lang.String KEY_COMPRESSED_SIZE
key for entry compressed size.

See Also:
Constant Field Values

KEY_COMMENT

static final java.lang.String KEY_COMMENT
key for entry comment.

See Also:
Constant Field Values

KEY_FILE_NAME

static final java.lang.String KEY_FILE_NAME
key for entry name.

See Also:
Constant Field Values

KEY_IS_COMPOUND

static final java.lang.String KEY_IS_COMPOUND
key to mark compounds.

See Also:
Constant Field Values

KEY_COMPOUNDS

static final java.lang.String KEY_COMPOUNDS
key for the compound list.

See Also:
Constant Field Values

KEY_IS_ROOT_COMPOUND_RECORD

static final java.lang.String KEY_IS_ROOT_COMPOUND_RECORD
key for the base compound record flag. The record for the initial compound (and only this one) will be flagged with this flag.

See Also:
Constant Field Values
Method Detail

canExtract

boolean canExtract(java.io.File file)
Can the file be extracted by the CompoundExtractor service? The service may or may not invest the file more closely or may simply guess by the file extension. So a true result does not guarantee, that the file may be extracted without any exceptions.

Parameters:
file - the file in question.
Returns:
true if the given file can be extracted, false if not.

canExtract

boolean canExtract(java.net.URL url,
                   java.lang.String mimeType)
Can the file be extracted by the CompoundExtractor service? The service may or may not invest the file more closely or may simply guess by the given mime type and the file extension. So a true result does not guarantee, that the file may be extracted without any exceptions.

Parameters:
url - URL in question
mimeType - mimetype (if any could be determined)
Returns:

canExtract

boolean canExtract(java.lang.String fileName,
                   java.lang.String mimeType)
Can the file be extracted by the CompoundExtractor service? The service may or may not invest the file more closely or may simply guess by the given mime type and the file extension. So a true result does not guarantee, that the file may be extracted without any exceptions.

Parameters:
fileName - the name of the file in question.
mimeType - mimetype (if any could be determined)
Returns:

extract

java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream,
                                   java.lang.String fileName,
                                   java.lang.String contentAttachmentName)
                                   throws CompoundExtractorException
Extract the compounds (recursively) and return an iterator over the resulting records that have been created from the extracted compound. The Extractor should also return a Record for the compound itself, also if the content of that record might be empty.

Parameters:
compoundInputStream - the input stream of the compound object.
fileName - the name of the file in question.
contentAttachmentName - name of attachment to store content of extracted elements in.
Returns:
an iterator for the records that resulted from the entries included in the compound along with their content. The Iterator must not be null but empty if there are no records to be extracted.
Throws:
CompoundExtractorException - on errors while extracting the compound.

extract

java.util.Iterator<Record> extract(java.io.InputStream compoundInputStream,
                                   java.lang.String fileName,
                                   java.lang.String mimeType,
                                   java.lang.String contentAttachmentName)
                                   throws CompoundExtractorException
Extract the compounds (recursively) and return an iterator over the resulting records that have been created from the extracted compound. The Extractor should also return a Record for the compound itself, also if the content of that record might be empty.

Parameters:
compoundInputStream - the input stream of the compound object.
fileName - the name of the file in question.
mimeType - mimetype (if any could be determined)
contentAttachmentName - name of attachment to store content of extracted elements in.
Returns:
an iterator for the records that resulted from the entries included in the compound along with their content. The Iterator must not be null but empty if there are no records to be extracted.
Throws:
CompoundExtractorException - on errors while extracting the compound.

SMILA 1.0 API documentation