001: /*
002: * $Id: Info.java 2056 2008-02-25 08:29:28Z jponge $
003: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
004: *
005: * http://izpack.org/
006: * http://izpack.codehaus.org/
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:
021: package com.izforge.izpack;
022:
023: import java.io.Serializable;
024: import 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: */
031: public class Info implements Serializable {
032:
033: static final long serialVersionUID = 13288410782044775L;
034:
035: /** The application name and version */
036: private String appName = "";
037: private String appVersion = "";
038:
039: /** The installation subpath */
040: private String installationSubPath = null;
041:
042: /** The application authors */
043: private ArrayList<Author> authors = new ArrayList<Author>();
044:
045: /** The application URL */
046: private String appURL = null;
047:
048: /** The required Java version (min) */
049: private String javaVersion = "1.4";
050:
051: /** Is a JDK required? */
052: private boolean jdkRequired = false;
053:
054: /** The name of the installer file (name without jar suffix) */
055: private String installerBase = null;
056:
057: /** The application Web Directory URL */
058: private String webDirURL = null;
059:
060: /** The uninstaller name */
061: private String uninstallerName = "uninstaller.jar";
062:
063: /** The path of the summary log file */
064: private String summaryLogFilePath = "$INSTALL_PATH/Uninstaller/InstallSummary.htm";
065:
066: /** The full qualified name of the class which should be
067: * used for decoding the packs.
068: */
069: private String packDecoderClassName = null;
070:
071: private String unpackerClassName = null;
072:
073: private boolean writeInstallationInformation = true;
074:
075: /** The constructor, deliberatly void. */
076: public Info() {
077: }
078:
079: /**
080: * Sets the application name.
081: *
082: * @param appName The new application name.
083: */
084: public void setAppName(String appName) {
085: this .appName = appName;
086: }
087:
088: /**
089: * Gets the application name.
090: *
091: * @return The application name.
092: */
093: public String getAppName() {
094: return appName;
095: }
096:
097: /**
098: * Sets the version.
099: *
100: * @param appVersion The application version.
101: */
102: public void setAppVersion(String appVersion) {
103: this .appVersion = appVersion;
104: }
105:
106: /**
107: * Gets the version.
108: *
109: * @return The application version.
110: */
111: public String getAppVersion() {
112: return appVersion;
113: }
114:
115: /**
116: * Adds an author to the authors list.
117: *
118: * @param author The author to add.
119: */
120: public void addAuthor(Author author) {
121: authors.add(author);
122: }
123:
124: /**
125: * Gets the authors list.
126: *
127: * @return The authors list.
128: */
129: public ArrayList<Author> getAuthors() {
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: this .appURL = appURL;
140: }
141:
142: /**
143: * Gets the application URL.
144: *
145: * @return The application URL.
146: */
147: public String getAppURL() {
148: return appURL;
149: }
150:
151: /**
152: * Sets the minimum Java version required.
153: *
154: * @param javaVersion The Java version.
155: */
156: public void setJavaVersion(String javaVersion) {
157: this .javaVersion = javaVersion;
158: }
159:
160: /**
161: * Gets the Java version required.
162: *
163: * @return The Java version.
164: */
165: public String getJavaVersion() {
166: return javaVersion;
167: }
168:
169: /**
170: * Sets the installer name.
171: *
172: * @param installerBase The new installer name.
173: */
174: public void setInstallerBase(String installerBase) {
175: this .installerBase = installerBase;
176: }
177:
178: /**
179: * Gets the installer name.
180: *
181: * @return The name of the installer file, without the jar suffix.
182: */
183: public String getInstallerBase() {
184: return installerBase;
185: }
186:
187: /**
188: * Sets the webDir URL.
189: *
190: * @param url The application URL.
191: */
192: public void setWebDirURL(String url) {
193: this .webDirURL = url;
194: }
195:
196: /**
197: * Gets the webDir URL if it has been specified
198: *
199: * @return The webDir URL from which the installer is retrieved, or <tt>null</tt> if non has
200: * been set.
201: */
202: public String getWebDirURL() {
203: return webDirURL;
204: }
205:
206: /**
207: * Sets the name of the uninstaller.
208: *
209: * @param name the name of the uninstaller.
210: */
211: public void setUninstallerName(String name) {
212: this .uninstallerName = name;
213: }
214:
215: /**
216: * Returns the name of the uninstaller.
217: *
218: * @return the name of the uninstaller.
219: */
220: public String getUninstallerName() {
221: return this .uninstallerName;
222: }
223:
224: public boolean isJdkRequired() {
225: return jdkRequired;
226: }
227:
228: public void setJdkRequired(boolean jdkRequired) {
229: this .jdkRequired = jdkRequired;
230: }
231:
232: /**
233: * This class represents an author.
234: *
235: * @author Julien Ponge
236: */
237: public static class Author implements Serializable {
238:
239: static final long serialVersionUID = -3090178155004960243L;
240:
241: /** The author name */
242: private String name;
243:
244: /** The author email */
245: private String email;
246:
247: /**
248: * Gets the author name.
249: *
250: * @return The author name.
251: */
252: public String getName() {
253: return name;
254: }
255:
256: /**
257: * Gets the author email.
258: *
259: * @return The author email.
260: */
261: public String getEmail() {
262: return email;
263: }
264:
265: /**
266: * The constructor.
267: *
268: * @param name The author name.
269: * @param email The author email.
270: */
271: public Author(String name, String email) {
272: this .name = name;
273: this .email = email;
274: }
275:
276: /**
277: * Gets a String representation of the author.
278: *
279: * @return The String representation of the author, in the form : name <email> .
280: */
281: public String toString() {
282: return name + " <" + email + ">";
283: }
284:
285: }
286:
287: /**
288: * Gets the installation subpath.
289: *
290: * @return the installation subpath
291: */
292: public String getInstallationSubPath() {
293: return installationSubPath;
294: }
295:
296: /**
297: * Sets the installation subpath.
298: *
299: * @param string subpath to be set
300: */
301: public void setInstallationSubPath(String string) {
302: installationSubPath = string;
303: }
304:
305: /**
306: * Returns the summary log file path.
307: *
308: * @return the summary log file path
309: */
310: public String getSummaryLogFilePath() {
311: return summaryLogFilePath;
312: }
313:
314: /**
315: * Sets the summary log file path.
316: *
317: * @param summaryLogFilePath the summary log file path to set
318: */
319: public void setSummaryLogFilePath(String summaryLogFilePath) {
320: this .summaryLogFilePath = summaryLogFilePath;
321: }
322:
323: /**
324: * Returns the full qualified class name of the class which
325: * should be used for decoding the packs.
326: * @return Returns the packDecoderClassName.
327: */
328: public String getPackDecoderClassName() {
329: return packDecoderClassName;
330: }
331:
332: /**
333: * Sets the full qualified class name of the class which
334: * should be used for decoding the packs.
335: * @param packDecoderClassName The packDecoderClassName to set.
336: */
337: public void setPackDecoderClassName(String packDecoderClassName) {
338: this .packDecoderClassName = packDecoderClassName;
339: }
340:
341: public String getUnpackerClassName() {
342: return unpackerClassName;
343: }
344:
345: public void setUnpackerClassName(String unpackerClassName) {
346: this .unpackerClassName = unpackerClassName;
347: }
348:
349: public boolean isWriteInstallationInformation() {
350: return writeInstallationInformation;
351: }
352:
353: public void setWriteInstallationInformation(
354: boolean writeInstallationInformation) {
355: this.writeInstallationInformation = writeInstallationInformation;
356: }
357: }
|