Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / event / InstallerListener.java @ 15280

History | View | Annotate | Download (5.59 KB)

1
/*
2
 *  $Id: InstallerListener.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
3
 *  IzPack
4
 *  Copyright (C) 2004 Klaus Bartz
5
 *
6
 *  File :               InstallerListener.java
7
 *  Description :        Custom action listener interface for install time.
8
 *  Author's email :     klaus.bartz@coi.de
9
 *  Author's Website :   http://www.coi.de/
10
 *
11
 *  This program is free software; you can redistribute it and/or
12
 *  modify it under the terms of the GNU General Public License
13
 *  as published by the Free Software Foundation; either version 2
14
 *  of the License, or any later version.
15
 *
16
 *  This program is distributed in the hope that it will be useful,
17
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 *  GNU General Public License for more details.
20
 *
21
 *  You should have received a copy of the GNU General Public License
22
 *  along with this program; if not, write to the Free Software
23
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
 */
25

    
26
package com.izforge.izpack.event;
27

    
28
import java.io.File;
29

    
30
import com.izforge.izpack.Pack;
31
import com.izforge.izpack.PackFile;
32
import com.izforge.izpack.installer.AutomatedInstallData;
33
import com.izforge.izpack.util.AbstractUIProgressHandler;
34

    
35
/**
36
 * <p>Implementations of this class are used
37
 * to handle customizing installation.
38
 * The defined methods are called from the unpacker at
39
 * different, well defined points of installation.</p>
40
 *
41
 * @author  Klaus Bartz
42
 * 
43
 */
44
public interface InstallerListener
45
{
46
  // ------------------------------------------------------------------------
47
  // Constant Definitions
48
  // ------------------------------------------------------------------------
49
  public static final int BEFORE_FILE = 1;
50
  public static final int AFTER_FILE = 2;
51
  public static final int BEFORE_DIR = 3;
52
  public static final int AFTER_DIR = 4;
53
  public static final int BEFORE_PACK = 5;
54
  public static final int AFTER_PACK = 6;
55
  public static final int BEFORE_PACKS = 7;
56
  public static final int AFTER_PACKS = 8;
57
 
58
  /**
59
   * This method will be called from the unpacker before the installation
60
   * of all packs will be performed.
61
   * @param idata object containing the current installation data
62
   * @param npacks number of packs which are defined for this installation
63
   * @param handler a handler to the current used UIProgressHandler
64
   * @throws Exception
65
   */
66
  void beforePacks(AutomatedInstallData idata, Integer npacks, AbstractUIProgressHandler handler)
67
    throws Exception;
68

    
69
  /**
70
   * This method will be called from the unpacker before the installation
71
   * of one pack will be performed.
72
   * @param pack current pack object
73
   * @param i current pack number
74
   * @param handler a handler to the current used UIProgressHandler
75
   * @throws Exception
76
   */
77
  void beforePack(Pack pack, Integer i, AbstractUIProgressHandler handler)
78
    throws Exception;
79

    
80
  /**
81
   * Returns true if this listener would be informed at every file and directory
82
   * installation, else false. If it is true, the listener will be called two
83
   * times (before and after) for every action. Handle carefully, else
84
   * performance problems are possible.
85
   * @return true if this listener would be informed at every file and directory
86
   * installation, else false
87
   */
88
  boolean isFileListener();
89
 
90
  /**
91
   * This method will be called from the unpacker before one
92
   * directory should be created. If parent directories should be
93
   * created also, this method will be called for every directory
94
   * beginning with the base.
95
   * @param dir current File object of the just directory which should be created
96
   * @param pf corresponding PackFile object
97
   * @throws Exception
98
   */
99
  void beforeDir( File dir, PackFile pf ) throws Exception;
100

    
101
  /**
102
   * This method will be called from the unpacker after one
103
   * directory was created. If parent directories should be
104
   * created, this method will be called for every directory
105
   * beginning with the base.
106
   * @param dir current File object of the just created directory
107
   * @param pf corresponding PackFile object
108
   * @throws Exception
109
   */
110
  void afterDir( File dir, PackFile pf ) throws Exception;
111

    
112
  /**
113
   * This method will be called from the unpacker before one
114
   * file should be installed.
115
   * @param file current File object of the file which should be installed
116
   * @param pf corresponding PackFile object
117
   * @throws Exception
118
   */
119
  void beforeFile( File file, PackFile pf ) throws Exception;
120

    
121
  /**
122
   * This method will be called from the unpacker after one
123
   * file was installed.
124
   * @param file current File object of the just installed file
125
   * @param pf corresponding PackFile object
126
   * @throws Exception
127
   */
128
  void afterFile( File file, PackFile pf ) throws Exception;
129

    
130
  /**
131
   * 
132
   * This method will be called from the unpacker after the installation
133
   * of one pack was performed.
134
   * @param pack current pack object
135
   * @param i current pack number
136
   * @param handler a handler to the current used UIProgressHandler
137
   */
138
  void afterPack(Pack pack, Integer i, AbstractUIProgressHandler handler)
139
    throws Exception;
140

    
141
  /**
142
   * This method will be called from the unpacker after the installation
143
   * of all packs was performed.
144
   * @param idata object containing the current installation data
145
   * @param handler a handler to the current used UIProgressHandler
146
   * @throws Exception
147
   */
148
        void afterPacks(AutomatedInstallData idata, AbstractUIProgressHandler handler)
149
    throws Exception;
150
}