com.izforge.izpack.compressor
Class PackCompressorFactory

java.lang.Object
  extended by com.izforge.izpack.compressor.PackCompressorFactory

public class PackCompressorFactory
extends java.lang.Object

IzPack will be able to support different compression methods for the packs included in the installation jar file. This class is the factory which offers different "compressors" to IzPack. It is made to mask the internal structure of each "compressor" and gaves a common API for all supported compression methods to IzPack. IzPacks compiler uses this class to get an encoder and the informations which are needed to support the decompression in the installation. All "compressors" should use this class as API and should not be included directly in the IzPack compiler.

Author:
Klaus Bartz

Field Summary
private static CompilerException ShitHappens
           
private static java.util.HashMap typeMap
          This map contains all registered "compressors".
 
Constructor Summary
private PackCompressorFactory()
          No object of this factory needed.
 
Method Summary
static void catchedRegister(PackCompressor pc)
          Register a particular pack compressor to this factory.
static PackCompressor get(java.lang.String type)
          Returns a newly created pack compressor with the given compression format.
static CompilerException getRegisterException()
          Returns the exception which was thrown during registering of a pack compressor.
static boolean good()
           
static boolean isTypeSupported(java.lang.String type)
          Returns whether a compressor exists for the given symbolic name or not.
static void register(PackCompressor pc)
          Register a particular pack compressor to this factory.
static void setRegisterException(CompilerException registerException)
          Sets an exception which was thrown during registering a pack compressor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeMap

private static java.util.HashMap typeMap
This map contains all registered "compressors". The keys are the symbolic names which are used for a particular compression format.


ShitHappens

private static CompilerException ShitHappens
Constructor Detail

PackCompressorFactory

private PackCompressorFactory()
No object of this factory needed.

Method Detail

catchedRegister

public static void catchedRegister(PackCompressor pc)
Register a particular pack compressor to this factory. The used symbolic name will be handled case insensitive.

Parameters:
pc - an instance of the pack compressor which describes encoder and decoder for a special compression format
Throws:
CompilerException - if the symbol already exist or if the compressor is not valid

register

public static void register(PackCompressor pc)
                     throws CompilerException
Register a particular pack compressor to this factory. The used symbolic name will be handled case insensitive.

Parameters:
pc - an instance of the pack compressor which describes encoder and decoder for a special compression format
Throws:
CompilerException - if the symbol already exist or if the compressor is not valid

isTypeSupported

public static boolean isTypeSupported(java.lang.String type)
                               throws CompilerException
Returns whether a compressor exists for the given symbolic name or not.

Parameters:
type - symbolic compression name to be tested
Returns:
whether the given compression format will be supported or not
Throws:
CompilerException

get

public static PackCompressor get(java.lang.String type)
                          throws CompilerException
Returns a newly created pack compressor with the given compression format.

Parameters:
type - symbol name of compression format to be used
Returns:
a newly created pack compressor
Throws:
CompilerException - if no encoder is registered for the chosen compression format

getRegisterException

public static CompilerException getRegisterException()
Returns the exception which was thrown during registering of a pack compressor.

Returns:
the exception which was thrown during registering of a pack compressor

setRegisterException

public static void setRegisterException(CompilerException registerException)
Sets an exception which was thrown during registering a pack compressor.

Parameters:
registerException - The register exception to set.

good

public static boolean good()