com.izforge.izpack.compiler
Class MultiVolumePackager

java.lang.Object
  extended by com.izforge.izpack.compiler.PackagerBase
      extended by com.izforge.izpack.compiler.MultiVolumePackager
All Implemented Interfaces:
IPackager

public class MultiVolumePackager
extends PackagerBase

The packager class. The packager is used by the compiler to put files into an installer, and create the actual installer files.

This is a packager, which packs everything into multi volumes.

Author:
Dennis Reil,

Field Summary
private  XMLElement configdata
           
static java.lang.String INSTALLER_PAK_NAME
           
private  java.util.zip.ZipOutputStream primaryJarStream
          Executable zipped output stream.
 
Fields inherited from class com.izforge.izpack.compiler.PackagerBase
alreadyWrittenFiles, baseFile, compressor, customDataList, dynamicvariables, guiPrefs, includedJarURLs, info, installerResourceURLMap, langpackNameList, listener, packJarsSeparate, packsList, panelList, rules, SKELETON_SUBPATH, variables
 
Constructor Summary
MultiVolumePackager()
          The constructor.
MultiVolumePackager(java.lang.String compr_format)
          Extended constructor.
MultiVolumePackager(java.lang.String compr_format, int compr_level)
          Extended constructor.
 
Method Summary
 void addConfigurationInformation(XMLElement data)
          Adds configuration information to the packager.
private  void analyzeConfigurationInformation()
          ******************************************************************************************** Listener assistance ********************************************************************************************
private  long copyStream(java.io.InputStream in, java.io.OutputStream out)
          Copies all the data from the specified input stream to the specified output stream.
private  void copyZip(java.util.zip.ZipInputStream zin, java.util.zip.ZipOutputStream out, java.util.List<java.lang.String> files)
          Copies specified contents of one jar to another.
private  void copyZipWithoutExcludes(java.util.zip.ZipInputStream zin, java.util.zip.ZipOutputStream out, java.util.List<java.lang.String> excludes)
          Copies specified contents of one jar to another without the specified files

TODO: it would be useful to be able to keep signature information from signed jar files, can we combine manifests and still have their content signed?

 void createInstaller(java.io.File primaryFile)
          Create the installer, beginning with the specified jar.
private  java.util.zip.ZipOutputStream getJarOutputStream(java.lang.String name)
          Return a stream for the next jar.
protected  void writeIncludedJars()
          Copy included jars to primary jar.
protected  void writeInstallerObject(java.lang.String entryName, java.lang.Object object)
          Write an arbitrary object to primary jar.
protected  void writeInstallerResources()
          Write the data referenced by URL to primary jar.
protected  void writePacks()
           
private  void writePacks(java.io.File primaryfile)
          Write Packs to primary jar or each to a separate jar.
protected  void writeSkeletonInstaller()
          Write skeleton installer to primary jar.
 
Methods inherited from class com.izforge.izpack.compiler.PackagerBase
addCustomJar, addInstallerRequirements, addJarContent, addJarContent, addLangPack, addNativeLibrary, addNativeUninstallerLibrary, addPack, addPanelJar, addResource, getCompressor, getDynamicVariables, getPackagerListener, getPacksList, getRules, getVariables, initPackCompressor, sendMsg, sendMsg, sendStart, sendStop, setDynamicVariables, setGUIPrefs, setInfo, setPackagerListener, setRules, writeInstaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTALLER_PAK_NAME

public static final java.lang.String INSTALLER_PAK_NAME
See Also:
Constant Field Values

primaryJarStream

private java.util.zip.ZipOutputStream primaryJarStream
Executable zipped output stream. First to open, last to close.


configdata

private XMLElement configdata
Constructor Detail

MultiVolumePackager

public MultiVolumePackager()
                    throws CompilerException
The constructor.

Throws:
CompilerException

MultiVolumePackager

public MultiVolumePackager(java.lang.String compr_format)
                    throws CompilerException
Extended constructor.

Parameters:
compr_format - Compression format to be used for packs compression format (if supported)
Throws:
CompilerException

MultiVolumePackager

public MultiVolumePackager(java.lang.String compr_format,
                           int compr_level)
                    throws CompilerException
Extended constructor.

Parameters:
compr_format - Compression format to be used for packs
compr_level - Compression level to be used with the chosen compression format (if supported)
Throws:
CompilerException
Method Detail

createInstaller

public void createInstaller(java.io.File primaryFile)
                     throws java.lang.Exception
Create the installer, beginning with the specified jar. If the name specified does not end in ".jar", it is appended. If secondary jars are created for packs (if the Info object added has a webDirURL set), they are created in the same directory, named sequentially by inserting ".pack#" (where '#' is the pack number) ".jar" suffix: e.g. "foo.pack1.jar". If any file exists, it is overwritten.

Throws:
java.lang.Exception

analyzeConfigurationInformation

private void analyzeConfigurationInformation()
******************************************************************************************** Listener assistance ********************************************************************************************


writeSkeletonInstaller

protected void writeSkeletonInstaller()
                               throws java.io.IOException
Write skeleton installer to primary jar. It is just an included jar, except that we copy the META-INF as well.

Specified by:
writeSkeletonInstaller in class PackagerBase
Throws:
java.io.IOException

writeInstallerObject

protected void writeInstallerObject(java.lang.String entryName,
                                    java.lang.Object object)
                             throws java.io.IOException
Write an arbitrary object to primary jar.

Specified by:
writeInstallerObject in class PackagerBase
Throws:
java.io.IOException

writeInstallerResources

protected void writeInstallerResources()
                                throws java.io.IOException
Write the data referenced by URL to primary jar.

Specified by:
writeInstallerResources in class PackagerBase
Throws:
java.io.IOException

writeIncludedJars

protected void writeIncludedJars()
                          throws java.io.IOException
Copy included jars to primary jar.

Specified by:
writeIncludedJars in class PackagerBase
Throws:
java.io.IOException

writePacks

private void writePacks(java.io.File primaryfile)
                 throws java.lang.Exception
Write Packs to primary jar or each to a separate jar.

Throws:
java.lang.Exception

getJarOutputStream

private java.util.zip.ZipOutputStream getJarOutputStream(java.lang.String name)
                                                  throws java.io.IOException
Return a stream for the next jar.

Throws:
java.io.IOException

copyZip

private void copyZip(java.util.zip.ZipInputStream zin,
                     java.util.zip.ZipOutputStream out,
                     java.util.List<java.lang.String> files)
              throws java.io.IOException
Copies specified contents of one jar to another.

TODO: it would be useful to be able to keep signature information from signed jar files, can we combine manifests and still have their content signed?

Throws:
java.io.IOException
See Also:
copyStream(InputStream, OutputStream)

copyZipWithoutExcludes

private void copyZipWithoutExcludes(java.util.zip.ZipInputStream zin,
                                    java.util.zip.ZipOutputStream out,
                                    java.util.List<java.lang.String> excludes)
                             throws java.io.IOException
Copies specified contents of one jar to another without the specified files

TODO: it would be useful to be able to keep signature information from signed jar files, can we combine manifests and still have their content signed?

Throws:
java.io.IOException
See Also:
copyStream(InputStream, OutputStream)

copyStream

private long copyStream(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException
Copies all the data from the specified input stream to the specified output stream.

Parameters:
in - the input stream to read
out - the output stream to write
Returns:
the total number of bytes copied
Throws:
java.io.IOException - if an I/O error occurs

addConfigurationInformation

public void addConfigurationInformation(XMLElement data)
Description copied from interface: IPackager
Adds configuration information to the packager.

Parameters:
data - - the xml-element packaging from the install.xml

writePacks

protected void writePacks()
                   throws java.lang.Exception
Specified by:
writePacks in class PackagerBase
Throws:
java.lang.Exception