001/*
002 * $Id: Info.java,v 1.26 2005/08/26 06:48:50 bartzkau Exp $
003 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
004 * 
005 * http://www.izforge.com/izpack/
006 * http://developer.berlios.de/projects/izpack/
007 * 
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 * 
012 *     http://www.apache.org/licenses/LICENSE-2.0
013 *     
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020
021package com.izforge.izpack;
022
023import java.io.Serializable;
024import java.util.ArrayList;
025
026/**
027 * Contains some informations for an installer, as defined in the <info> section of the XML files.
028 * 
029 * @author Julien Ponge
030 */
031public class Info implements Serializable
032{
033
034    static final long serialVersionUID = 13288410782044775L;
035
036    /** The application name and version */
037    private String appName = "", appVersion = "";
038
039    /** The installation subpath */
040    private String installationSubPath = null;
041
042    /** The application authors */
043    private ArrayList authors = new ArrayList();
044
045    /** The application URL */
046    private String appURL = null;
047
048    /** The required Java version (min) */
049    private String javaVersion = "1.2";
050
051    /** The name of the installer file (name without jar suffix) */
052    private String installerBase = null;
053
054    /** The application Web Directory URL */
055    private String webDirURL = null;
056
057    /** The uninstaller name */
058    private String uninstallerName = "uninstaller.jar";
059
060    /** The path of the summary log file */
061    private String summaryLogFilePath = "$INSTALL_PATH/Uninstaller/InstallSummary.htm";
062
063    /** The full qualified name of the class which should be
064     *  used for decoding the packs.
065     */
066    private String packDecoderClassName = null;
067    
068    /** The constructor, deliberatly void. */
069    public Info()
070    {
071    }
072
073    /**
074     * Sets the application name.
075     * 
076     * @param appName The new application name.
077     */
078    public void setAppName(String appName)
079    {
080        this.appName = appName;
081    }
082
083    /**
084     * Gets the application name.
085     * 
086     * @return The application name.
087     */
088    public String getAppName()
089    {
090        return appName;
091    }
092
093    /**
094     * Sets the version.
095     * 
096     * @param appVersion The application version.
097     */
098    public void setAppVersion(String appVersion)
099    {
100        this.appVersion = appVersion;
101    }
102
103    /**
104     * Gets the version.
105     * 
106     * @return The application version.
107     */
108    public String getAppVersion()
109    {
110        return appVersion;
111    }
112
113    /**
114     * Adds an author to the authors list.
115     * 
116     * @param author The author to add.
117     */
118    public void addAuthor(Author author)
119    {
120        authors.add(author);
121    }
122
123    /**
124     * Gets the authors list.
125     * 
126     * @return The authors list.
127     */
128    public ArrayList getAuthors()
129    {
130        return authors;
131    }
132
133    /**
134     * Sets the application URL.
135     * 
136     * @param appURL The application URL.
137     */
138    public void setAppURL(String appURL)
139    {
140        this.appURL = appURL;
141    }
142
143    /**
144     * Gets the application URL.
145     * 
146     * @return The application URL.
147     */
148    public String getAppURL()
149    {
150        return appURL;
151    }
152
153    /**
154     * Sets the minimum Java version required.
155     * 
156     * @param javaVersion The Java version.
157     */
158    public void setJavaVersion(String javaVersion)
159    {
160        this.javaVersion = javaVersion;
161    }
162
163    /**
164     * Gets the Java version required.
165     * 
166     * @return The Java version.
167     */
168    public String getJavaVersion()
169    {
170        return javaVersion;
171    }
172
173    /**
174     * Sets the installer name.
175     * 
176     * @param installerBase The new installer name.
177     */
178    public void setInstallerBase(String installerBase)
179    {
180        this.installerBase = installerBase;
181    }
182
183    /**
184     * Gets the installer name.
185     * 
186     * @return The name of the installer file, without the jar suffix.
187     */
188    public String getInstallerBase()
189    {
190        return installerBase;
191    }
192
193    /**
194     * Sets the webDir URL.
195     * 
196     * @param url The application URL.
197     */
198    public void setWebDirURL(String url)
199    {
200        this.webDirURL = url;
201    }
202
203    /**
204     * Gets the webDir URL if it has been specified
205     * 
206     * @return The webDir URL from which the installer is retrieved, or <tt>null</tt> if non has
207     * been set.
208     */
209    public String getWebDirURL()
210    {
211        return webDirURL;
212    }
213
214    /**
215     * Sets the name of the uninstaller.
216     * 
217     * @param name the name of the uninstaller.
218     */
219    public void setUninstallerName(String name)
220    {
221        this.uninstallerName = name;
222    }
223
224    /**
225     * Returns the name of the uninstaller.
226     * 
227     * @return the name of the uninstaller.
228     */
229    public String getUninstallerName()
230    {
231        return this.uninstallerName;
232    }
233
234    /**
235     * This class represents an author.
236     * 
237     * @author Julien Ponge
238     */
239    public static class Author implements Serializable
240    {
241
242        static final long serialVersionUID = -3090178155004960243L;
243
244        /** The author name */
245        private String name;
246
247        /** The author email */
248        private String email;
249
250        /**
251         * Gets the author name.
252         * 
253         * @return The author name.
254         */
255        public String getName()
256        {
257            return name;
258        }
259
260        /**
261         * Gets the author email.
262         * 
263         * @return The author email.
264         */
265        public String getEmail()
266        {
267            return email;
268        }
269
270        /**
271         * The constructor.
272         * 
273         * @param name The author name.
274         * @param email The author email.
275         */
276        public Author(String name, String email)
277        {
278            this.name = name;
279            this.email = email;
280        }
281
282        /**
283         * Gets a String representation of the author.
284         * 
285         * @return The String representation of the author, in the form : name <email> .
286         */
287        public String toString()
288        {
289            return name + " <" + email + ">";
290        }
291
292    }
293
294    /**
295     * Gets the installation subpath.
296     * 
297     * @return the installation subpath
298     */
299    public String getInstallationSubPath()
300    {
301        return installationSubPath;
302    }
303
304    /**
305     * Sets the installation subpath.
306     * 
307     * @param string subpath to be set
308     */
309    public void setInstallationSubPath(String string)
310    {
311        installationSubPath = string;
312    }
313
314    /**
315     * Returns the summary log file path.
316     * 
317     * @return the summary log file path
318     */
319    public String getSummaryLogFilePath()
320    {
321        return summaryLogFilePath;
322    }
323
324    /**
325     * Sets the summary log file path.
326     * 
327     * @param summaryLogFilePath the summary log file path to set
328     */
329    public void setSummaryLogFilePath(String summaryLogFilePath)
330    {
331        this.summaryLogFilePath = summaryLogFilePath;
332    }
333    /**
334     * Returns the full qualified class name of the class which
335     * should be used for decoding the packs.
336     * @return Returns the packDecoderClassName.
337     */
338    public String getPackDecoderClassName()
339    {
340        return packDecoderClassName;
341    }
342    /**
343     * Sets the full qualified class name of the class which
344     * should be used for decoding the packs.
345     * @param packDecoderClassName The packDecoderClassName to set.
346     */
347    public void setPackDecoderClassName(String packDecoderClassName)
348    {
349        this.packDecoderClassName = packDecoderClassName;
350    }
351}