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;
023
024import java.io.Serializable;
025import java.util.List;
026
027/**
028 * Container for serialized custom data.
029 * 
030 * @author Klaus Bartz
031 */
032public class CustomData implements Serializable
033{
034
035    static final long serialVersionUID = 5504496325961965576L;
036
037    /** Identifier for custom data type "installer listener". */
038    public static final int INSTALLER_LISTENER = 0;
039
040    /** Identifier for custom data typ "uninstaller listener". */
041    public static final int UNINSTALLER_LISTENER = 1;
042
043    /**
044     * Identifier for custom data typ "uninstaller lib". This is used for binary libs (DLLs or SHLs
045     * or SOs or ...) which will be needed from the uninstaller.
046     */
047    public static final int UNINSTALLER_LIB = 2;
048
049    /** Identifier for custom data typ "uninstaller jar files". */
050    public static final int UNINSTALLER_JAR = 3;
051
052    /**
053     * The contens of the managed custom data. If it is a listener or a uninstaller jar, all
054     * contained files are listed with it complete sub path. If it is a uninstaller native library,
055     * this value is the path in the installer jar.
056     */
057    public List contents;
058
059    /**
060     * Full qualified name of the managed listener. If type is not a listener, this value is
061     * undefined.
062     */
063    public String listenerName;
064
065    /** The target operation system of this custom action */
066    public List osConstraints = null;
067
068    /**
069     * Type of this custom action data; possible are INSTALLER_LISTENER, UNINSTALLER_LISTENER,
070     * UNINSTALLER_LIB and UNINSTALLER_JAR.
071     */
072    public int type = 0;
073
074    /**
075     * Constructs an CustomData object with the needed values. If a listener will be managed with
076     * this object, the full qualified name of the listener self must be set as listener name. If a
077     * listener or a jar file for uninstall will be managed, all needed files (class, properties and
078     * so on) must be referenced in the contents with the path which they have in the installer jar
079     * file.
080     * 
081     * @param listenerName path of the listener
082     * @param contents also needed objects referenced with the path in install.jar
083     * @param osConstraints target operation system of this custom action
084     * @param type type of this custom data
085     */
086    public CustomData(String listenerName, List contents, List osConstraints, int type)
087    {
088        this.listenerName = listenerName;
089        this.contents = contents;
090        this.osConstraints = osConstraints;
091        this.type = type;
092    }
093
094}