KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Map JavaDoc;
25
26 import net.n3.nanoxml.XMLElement;
27
28 import com.izforge.izpack.compiler.CompilerException;
29 import com.izforge.izpack.compiler.IPackager;
30
31 /**
32  * <p>
33  * Implementations of this class are used to add extensions to the packs at compilation.
34  * </p>
35  *
36  * @author Klaus Bartz
37  *
38  */

39 public interface CompilerListener
40 {
41
42     public final static int BEGIN = 1;
43
44     public final static int END = 2;
45
46     /**
47      * This method is called from the compiler for each file (or dir) parsing. The XMLElement is a
48      * node of the file related children of the XML element "pack" (see installation.dtd). Current
49      * these are "file", "singlefile" or "fileset". If an additional data should be set, it should
50      * be added to the given data map (if exist). If no map exist a new should be created and
51      * filled. The data map will be added to the PackFile object after all registered
52      * CompilerListener are called. If the map contains an not common object, it is necessary to add
53      * the needed class to the installer.
54      *
55      * @param existentDataMap attribute set with previos setted attributes
56      * @param element current file related XML node
57      * @return the given or a new attribute set. If no attribute set is given and no attribute was
58      * added, null returns
59      * @throws CompilerException
60      */

61     Map JavaDoc reviseAdditionalDataMap(Map JavaDoc existentDataMap, XMLElement element) throws CompilerException;
62
63     /**
64      * This method will be called from each step of packaging.
65      *
66      * @param position name of the calling method, e.g. "addVariables"
67      * @param state BEGIN or END
68      * @param data current install data
69      * @param packager current packager object
70      */

71     void notify(String JavaDoc position, int state, XMLElement data, IPackager packager);
72
73 }
74
Popular Tags