KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > event > InstallerListener


1 /*
2  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
3  *
4  * http://www.izforge.com/izpack/
5  * http://developer.berlios.de/projects/izpack/
6  *
7  * Copyright 2004 Klaus Bartz
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */

21
22 package com.izforge.izpack.event;
23
24 import java.io.File JavaDoc;
25
26 import com.izforge.izpack.Pack;
27 import com.izforge.izpack.PackFile;
28 import com.izforge.izpack.installer.AutomatedInstallData;
29 import com.izforge.izpack.util.AbstractUIProgressHandler;
30
31 /**
32  * <p>
33  * Implementations of this class are used to handle customizing installation. The defined methods
34  * are called from the unpacker at different, well defined points of installation.
35  * </p>
36  *
37  * @author Klaus Bartz
38  *
39  */

40 public interface InstallerListener
41 {
42
43     // ------------------------------------------------------------------------
44
// Constant Definitions
45
// ------------------------------------------------------------------------
46
public static final int BEFORE_FILE = 1;
47
48     public static final int AFTER_FILE = 2;
49
50     public static final int BEFORE_DIR = 3;
51
52     public static final int AFTER_DIR = 4;
53
54     public static final int BEFORE_PACK = 5;
55
56     public static final int AFTER_PACK = 6;
57
58     public static final int BEFORE_PACKS = 7;
59
60     public static final int AFTER_PACKS = 8;
61
62     /**
63      * This method will be called from the unpacker before the installation of all packs will be
64      * performed.
65      *
66      * @param idata object containing the current installation data
67      * @param npacks number of packs which are defined for this installation
68      * @param handler a handler to the current used UIProgressHandler
69      * @throws Exception
70      */

71     void beforePacks(AutomatedInstallData idata, Integer JavaDoc npacks, AbstractUIProgressHandler handler)
72             throws Exception JavaDoc;
73
74     /**
75      * This method will be called from the unpacker before the installation of one pack will be
76      * performed.
77      *
78      * @param pack current pack object
79      * @param i current pack number
80      * @param handler a handler to the current used UIProgressHandler
81      * @throws Exception
82      */

83     void beforePack(Pack pack, Integer JavaDoc i, AbstractUIProgressHandler handler) throws Exception JavaDoc;
84
85     /**
86      * Returns true if this listener would be informed at every file and directory installation,
87      * else false. If it is true, the listener will be called two times (before and after) for every
88      * action. Handle carefully, else performance problems are possible.
89      *
90      * @return true if this listener would be informed at every file and directory installation,
91      * else false
92      */

93     boolean isFileListener();
94
95     /**
96      * This method will be called from the unpacker before one directory should be created. If
97      * parent directories should be created also, this method will be called for every directory
98      * beginning with the base.
99      *
100      * @param dir current File object of the just directory which should be created
101      * @param pf corresponding PackFile object
102      * @throws Exception
103      */

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

115     void afterDir(File JavaDoc dir, PackFile pf) throws Exception JavaDoc;
116
117     /**
118      * This method will be called from the unpacker before one file should be installed.
119      *
120      * @param file current File object of the file which should be installed
121      * @param pf corresponding PackFile object
122      * @throws Exception
123      */

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

133     void afterFile(File JavaDoc file, PackFile pf) throws Exception JavaDoc;
134
135     /**
136      *
137      * This method will be called from the unpacker after the installation of one pack was
138      * performed.
139      *
140      * @param pack current pack object
141      * @param i current pack number
142      * @param handler a handler to the current used UIProgressHandler
143      */

144     void afterPack(Pack pack, Integer JavaDoc i, AbstractUIProgressHandler handler) throws Exception JavaDoc;
145
146     /**
147      * This method will be called from the unpacker after the installation of all packs was
148      * performed.
149      *
150      * @param idata object containing the current installation data
151      * @param handler a handler to the current used UIProgressHandler
152      * @throws Exception
153      */

154     void afterPacks(AutomatedInstallData idata, AbstractUIProgressHandler handler) throws Exception JavaDoc;
155 }
156
Popular Tags