com.mmoui.manager.services
Interface ExtractorFactoryService

All Superinterfaces:
Service

public interface ExtractorFactoryService
extends Service

Defines an OSGi service which can be used to create Extractor instances which extract packaged archives. This allows for a "mini-library" to exist inside OSGi which knows how to handle various types of archives (e.g., zip, gz, bz2, rar, etc.) without duplication of code across modules.

Version:
$Id: ExtractorFactoryService.java 170 2009-04-22 06:48:10Z mpdelbuono $
Author:
Matthew P. Del Buono
See Also:
Extractor

Method Summary
 boolean canExtract(java.io.File inputFile)
          Determines if this extractor factory can produce an extractor which services the input file.
 Extractor createExtractor(java.io.File inputFile)
          Creates a new Extractor object which can be used to extract the specified archive file
 
Methods inherited from interface com.mmoui.manager.services.Service
getAdvertisements, getFullProviderName, getPermissions, getShortProviderName
 

Method Detail

canExtract

boolean canExtract(java.io.File inputFile)
                   throws java.lang.IllegalArgumentException,
                          java.io.IOException
Determines if this extractor factory can produce an extractor which services the input file. This should only be a cursory check, such as checking for a magic number or a file extension. Deeper inconsistencies can be checked (or throw an exception) later during the extraction process.

Parameters:
inputFile - the file which is to be checked
Returns:
true if this File appears to be able to be extracted by this factory, or false if it can not service the specified file
Throws:
java.lang.IllegalArgumentException - if the input file is a directory or does not exist
java.io.IOException - if the file cannot be read

createExtractor

Extractor createExtractor(java.io.File inputFile)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
Creates a new Extractor object which can be used to extract the specified archive file

Parameters:
inputFile - the file to extract
Returns:
the new Extractor object
Throws:
java.lang.IllegalArgumentException - if this file cannot be extracted by any Extractor implementations that this factory supports
java.io.IOException - if an error occurs while initializing the file for extraction