001/* 002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved. 003 * 004 * http://www.izforge.com/izpack/ 005 * http://developer.berlios.de/projects/izpack/ 006 * 007 * Copyright 2004 Klaus Bartz 008 * 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 */ 021 022package com.izforge.izpack.event; 023 024import java.util.Map; 025 026import net.n3.nanoxml.XMLElement; 027 028import com.izforge.izpack.compiler.CompilerException; 029import com.izforge.izpack.compiler.Packager; 030 031/** 032 * <p> 033 * Implementations of this class are used to add extensions to the packs at compilation. 034 * </p> 035 * 036 * @author Klaus Bartz 037 * 038 */ 039public interface CompilerListener 040{ 041 042 public final static int BEGIN = 1; 043 044 public final static int END = 2; 045 046 /** 047 * This method is called from the compiler for each file (or dir) parsing. The XMLElement is a 048 * node of the file related children of the XML element "pack" (see installation.dtd). Current 049 * these are "file", "singlefile" or "fileset". If an additional data should be set, it should 050 * be added to the given data map (if exist). If no map exist a new should be created and 051 * filled. The data map will be added to the PackFile object after all registered 052 * CompilerListener are called. If the map contains an not common object, it is necessary to add 053 * the needed class to the installer. 054 * 055 * @param existentDataMap attribute set with previos setted attributes 056 * @param element current file related XML node 057 * @return the given or a new attribute set. If no attribute set is given and no attribute was 058 * added, null returns 059 * @throws CompilerException 060 */ 061 Map reviseAdditionalDataMap(Map existentDataMap, XMLElement element) throws CompilerException; 062 063 /** 064 * This method will be called from each step of packaging. 065 * 066 * @param position name of the calling method, e.g. "addVariables" 067 * @param state BEGIN or END 068 * @param data current install data 069 * @param packager current packager object 070 */ 071 void notify(String position, int state, XMLElement data, Packager packager); 072 073}