com.izforge.izpack.compiler
Class Packager

java.lang.Object
  extended bycom.izforge.izpack.compiler.Packager
Direct Known Subclasses:
StdPackager, WebPackager

public abstract class Packager
extends java.lang.Object

The packager class. A packager is used by the compiler to actually do the packaging job.

Author:
Julien Ponge

Field Summary
protected  java.util.ArrayList langpacks
          The langpacks ISO3 names.
protected  PackagerListener listener
          The listeners.
protected  java.util.ArrayList packs
          The packs informations.
static java.lang.String SKELETON_SUBPATH
          The path to the skeleton installer.
 
Constructor Summary
Packager()
           
 
Method Summary
abstract  void addJarContent(java.lang.String file)
          Adds a jar file content to the installer.
abstract  void addLangPack(java.lang.String iso3, java.io.InputStream input)
          Adds a language pack.
abstract  void addNativeLibrary(java.lang.String name, java.io.InputStream input)
          Adds a native library.
abstract  java.util.zip.ZipOutputStream addPack(int packNumber, java.lang.String name, java.util.List osConstraints, boolean required, java.lang.String description, boolean preselected)
          Adds a pack (the compiler sends the merged data).
abstract  void addPanelClass(java.lang.String classFilename, java.io.InputStream input)
          Adds a panel.
abstract  void addResource(java.lang.String resId, java.io.InputStream input)
          Adds a resource.
protected  long copyStream(java.io.InputStream in, java.io.OutputStream out)
          Copies all the data from the specified input stream to the specified output stream.
abstract  void finish()
          Tells the packager to finish the job (misc writings, cleanups, closings , ...).
protected  void packAdded(int number, long nbytes)
          Called by the Compiler when the pack content adding is done.
protected  void sendMsg(java.lang.String job)
          Dispatches a message to the listeners.
protected  void sendStart()
          Dispatches a start event to the listeners.
protected  void sendStop()
          Dispatches a stop event to the listeners.
abstract  void setGUIPrefs(GUIPrefs prefs)
          Sets the GUI preferences.
abstract  void setInfo(Info info)
          Sets the informations related to this installation.
 void setPackagerListener(PackagerListener listener)
          Adds a listener.
abstract  void setPanelsOrder(java.util.ArrayList order)
          Sets the panels order.
abstract  void setVariables(java.util.Properties varDef)
          Adds Variable Declaration.
 void writeSkeletonInstaller(java.util.jar.JarOutputStream out)
          Write the skeleton installer to the output JAR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SKELETON_SUBPATH

public static final java.lang.String SKELETON_SUBPATH
The path to the skeleton installer.


packs

protected java.util.ArrayList packs
The packs informations.


langpacks

protected java.util.ArrayList langpacks
The langpacks ISO3 names.


listener

protected PackagerListener listener
The listeners.

Constructor Detail

Packager

public Packager()
Method Detail

setPackagerListener

public void setPackagerListener(PackagerListener listener)
Adds a listener.

Parameters:
listener - The listener.

sendMsg

protected void sendMsg(java.lang.String job)
Dispatches a message to the listeners.

Parameters:
job - The job description.

sendStart

protected void sendStart()
Dispatches a start event to the listeners.


sendStop

protected void sendStop()
Dispatches a stop event to the listeners.


writeSkeletonInstaller

public void writeSkeletonInstaller(java.util.jar.JarOutputStream out)
                            throws java.lang.Exception
Write the skeleton installer to the output JAR.

Throws:
java.lang.Exception

addPack

public abstract java.util.zip.ZipOutputStream addPack(int packNumber,
                                                      java.lang.String name,
                                                      java.util.List osConstraints,
                                                      boolean required,
                                                      java.lang.String description,
                                                      boolean preselected)
                                               throws java.lang.Exception
Adds a pack (the compiler sends the merged data).

Parameters:
packNumber - The pack number.
name - The pack name.
required - Is the pack required ?
osConstraints - The target operation system(s) of this pack.
description - The pack description.
Returns:
Description of the Return Value
Throws:
java.lang.Exception - Description of the Exception

addPanelClass

public abstract void addPanelClass(java.lang.String classFilename,
                                   java.io.InputStream input)
                            throws java.lang.Exception
Adds a panel.

Parameters:
classFilename - The class filename.
input - The stream to get the file data from.
Throws:
java.lang.Exception - Description of the Exception

setGUIPrefs

public abstract void setGUIPrefs(GUIPrefs prefs)
                          throws java.lang.Exception
Sets the GUI preferences.

Parameters:
prefs - The new gUIPrefs value
Throws:
java.lang.Exception - Description of the Exception

setPanelsOrder

public abstract void setPanelsOrder(java.util.ArrayList order)
                             throws java.lang.Exception
Sets the panels order.

Parameters:
order - The ordered list of the panels.
Throws:
java.lang.Exception - Description of the Exception

setInfo

public abstract void setInfo(Info info)
                      throws java.lang.Exception
Sets the informations related to this installation.

Parameters:
info - The info section.
Throws:
java.lang.Exception - Description of the Exception

setVariables

public abstract void setVariables(java.util.Properties varDef)
                           throws java.lang.Exception
Adds Variable Declaration.

Parameters:
varDef - The variables definitions.
Throws:
java.lang.Exception - Description of the Exception

addResource

public abstract void addResource(java.lang.String resId,
                                 java.io.InputStream input)
                          throws java.lang.Exception
Adds a resource.

Parameters:
resId - The resource Id.
input - The stream to get the data from.
Throws:
java.lang.Exception - Description of the Exception

addLangPack

public abstract void addLangPack(java.lang.String iso3,
                                 java.io.InputStream input)
                          throws java.lang.Exception
Adds a language pack.

Parameters:
iso3 - The ISO3 code.
input - The stream to get the data from.
Throws:
java.lang.Exception - Description of the Exception

addNativeLibrary

public abstract void addNativeLibrary(java.lang.String name,
                                      java.io.InputStream input)
                               throws java.lang.Exception
Adds a native library.

Parameters:
name - The native library name.
input - The stream to get the data from.
Throws:
java.lang.Exception - Description of the Exception

addJarContent

public abstract void addJarContent(java.lang.String file)
                            throws java.lang.Exception
Adds a jar file content to the installer.

Parameters:
file - The jar filename.
Throws:
java.lang.Exception - Description of the Exception

finish

public abstract void finish()
                     throws java.lang.Exception
Tells the packager to finish the job (misc writings, cleanups, closings , ...).

Throws:
java.lang.Exception - Description of the Exception

copyStream

protected 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. This is an utility method which may be used by the subclasses. by Johannes Lehtinen

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

packAdded

protected void packAdded(int number,
                         long nbytes)
Called by the Compiler when the pack content adding is done. (JP)

Parameters:
number - the pack number
nbytes - the number of bytes written