SMILA (incubation) API documentation

org.eclipse.smila.processing.pipelets.mimetype
Class SimpleMimeTypeIdentifier

java.lang.Object
  extended by org.eclipse.smila.processing.pipelets.mimetype.SimpleMimeTypeIdentifier
All Implemented Interfaces:
MimeTypeIdentifier, ProcessingService

public class SimpleMimeTypeIdentifier
extends java.lang.Object
implements ProcessingService, MimeTypeIdentifier

The simple MIME type identifier is able to detect MIME types based on a static extension mapping.

Author:
August Georg Schmidt (BROX)

Field Summary
static java.lang.String BUNDLE_NAME
          name of bundle.
static java.lang.String CONFIG_FILE
          name of configuration file.
static java.lang.String FILE_EXTENSION_ATTRIBUTE
          Constant for the configuration property FileExtensionAttribute.
static java.lang.String META_DATA_ATTRIBUTE
          Constant for the configuration property MimeTypeAttribute.
static java.lang.String MIME_TYPE_ATTRIBUTE
          Constant for the configuration property MimeTypeAttribute.
 
Fields inherited from interface org.eclipse.smila.processing.ProcessingService
PROPERTY_NAME
 
Constructor Summary
SimpleMimeTypeIdentifier()
           
 
Method Summary
 java.lang.String identify(Id id, byte[] data)
          Identifies a MimeType based an the given data.
 java.lang.String identify(Id id, byte[] data, java.lang.String extension)
          Identifies a MimeType based an the given data and file extension.
 java.lang.String identify(Id id, java.lang.String extension)
          Identifies a MimeType based an the file extension.
 Id[] process(Blackboard blackboard, Id[] recordIds)
          process records on Blackboard service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_NAME

public static final java.lang.String BUNDLE_NAME
name of bundle. Used in configuration reading.

See Also:
Constant Field Values

CONFIG_FILE

public static final java.lang.String CONFIG_FILE
name of configuration file. Hardcoded for now (or fallback), configuration properties should be received from configuration service later.

See Also:
Constant Field Values

FILE_EXTENSION_ATTRIBUTE

public static final java.lang.String FILE_EXTENSION_ATTRIBUTE
Constant for the configuration property FileExtensionAttribute.

See Also:
Constant Field Values

META_DATA_ATTRIBUTE

public static final java.lang.String META_DATA_ATTRIBUTE
Constant for the configuration property MimeTypeAttribute.

See Also:
Constant Field Values

MIME_TYPE_ATTRIBUTE

public static final java.lang.String MIME_TYPE_ATTRIBUTE
Constant for the configuration property MimeTypeAttribute.

See Also:
Constant Field Values
Constructor Detail

SimpleMimeTypeIdentifier

public SimpleMimeTypeIdentifier()
Method Detail

process

public Id[] process(Blackboard blackboard,
                    Id[] recordIds)
             throws ProcessingException
process records on Blackboard service.

Specified by:
process in interface ProcessingService
Parameters:
blackboard - Blackboard service managing the records.
recordIds - Ids of records to process.
Returns:
Ids of result records.
Throws:
ProcessingException - error during processing.
See Also:
ProcessingService.process(Blackboard, Id[])

identify

public java.lang.String identify(Id id,
                                 byte[] data)
                          throws MimeTypeParseException
Identifies a MimeType based an the given data.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
id - the record Id
data - a byte[] containing the data
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
MimeTypeIdentifier.identify(org.eclipse.smila.datamodel.id.Id, byte[])

identify

public java.lang.String identify(Id id,
                                 java.lang.String extension)
                          throws MimeTypeParseException
Identifies a MimeType based an the file extension.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
id - the record Id
extension - the extension of the filename
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
MimeTypeIdentifier.identify(org.eclipse.smila.datamodel.id.Id, java.lang.String)

identify

public java.lang.String identify(Id id,
                                 byte[] data,
                                 java.lang.String extension)
                          throws MimeTypeParseException
Identifies a MimeType based an the given data and file extension.

Specified by:
identify in interface MimeTypeIdentifier
Parameters:
id - the record Id
data - a byte[] containing the data
extension - the extension of the filename
Returns:
the detected MimeType
Throws:
MimeTypeParseException - if any error occurs
See Also:
MimeTypeIdentifier.identify(org.eclipse.smila.datamodel.id.Id, byte[], java.lang.String)

SMILA (incubation) API documentation