KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > compiler > IPackager


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  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19 package com.izforge.izpack.compiler;
20
21 import java.io.File JavaDoc;
22 import java.net.URL JavaDoc;
23 import java.util.List JavaDoc;
24 import java.util.Properties JavaDoc;
25
26 import net.n3.nanoxml.XMLElement;
27
28 import com.izforge.izpack.CustomData;
29 import com.izforge.izpack.GUIPrefs;
30 import com.izforge.izpack.Info;
31 import com.izforge.izpack.Panel;
32 import com.izforge.izpack.compressor.PackCompressor;
33
34 /**
35  * Interface for all packager implementations
36  *
37  * @author Dennis Reil, <Dennis.Reil@reddot.de>
38  */

39 public interface IPackager
40 {
41
42     /**
43      * Create the installer, beginning with the specified jar. If the name specified does not end in
44      * ".jar", it is appended. If secondary jars are created for packs (if the Info object added has
45      * a webDirURL set), they are created in the same directory, named sequentially by inserting
46      * ".pack#" (where '#' is the pack number) ".jar" suffix: e.g. "foo.pack1.jar". If any file
47      * exists, it is overwritten.
48      */

49     public abstract void createInstaller(File JavaDoc primaryFile) throws Exception JavaDoc;
50
51     /**
52      * Get the PackagerListener.
53      * @return the current PackagerListener
54      */

55     public abstract PackagerListener getPackagerListener();
56
57     /**
58      * Adds a listener.
59      *
60      * @param listener The listener.
61      */

62     public abstract void setPackagerListener(PackagerListener listener);
63
64     /**
65      * Sets the informations related to this installation.
66      *
67      * @param info The info section.
68      * @exception Exception Description of the Exception
69      */

70     public abstract void setInfo(Info info) throws Exception JavaDoc;
71
72     /**
73      * Sets the GUI preferences.
74      *
75      * @param prefs The new gUIPrefs value
76      */

77     public abstract void setGUIPrefs(GUIPrefs prefs);
78
79     /**
80      * Allows access to add, remove and update the variables for the project, which are maintained
81      * in the packager.
82      *
83      * @return map of variable names to values
84      */

85     public abstract Properties JavaDoc getVariables();
86
87     /**
88      * Add a panel, where order is important. Only one copy of the class files neeed are inserted in
89      * the installer.
90      */

91     public abstract void addPanelJar(Panel panel, URL JavaDoc jarURL);
92
93     /**
94      * Add a custom data like custom actions, where order is important. Only one copy of the class
95      * files neeed are inserted in the installer.
96      *
97      * @param ca custom action object
98      * @param url the URL to include once
99      */

100     public abstract void addCustomJar(CustomData ca, URL JavaDoc url);
101
102     /**
103      * Adds a pack, order is mostly irrelevant.
104      *
105      * @param pack contains all the files and items that go with a pack
106      */

107     public abstract void addPack(PackInfo pack);
108
109     /**
110      * Gets the packages list
111      */

112     public abstract List JavaDoc getPacksList();
113
114     /**
115      * Adds a language pack.
116      *
117      * @param iso3 The ISO3 code.
118      * @param xmlURL The location of the xml local info
119      * @param flagURL The location of the flag image resource
120      */

121     public abstract void addLangPack(String JavaDoc iso3, URL JavaDoc xmlURL, URL JavaDoc flagURL);
122
123     /**
124      * Adds a resource.
125      *
126      * @param resId The resource Id.
127      * @param url The location of the data
128      */

129     public abstract void addResource(String JavaDoc resId, URL JavaDoc url);
130
131     /**
132      * Adds a native library.
133      *
134      * @param name The native library name.
135      * @param url The url to get the data from.
136      * @exception Exception Description of the Exception
137      */

138     public abstract void addNativeLibrary(String JavaDoc name, URL JavaDoc url) throws Exception JavaDoc;
139
140     /**
141      * Adds a jar file content to the installer. Package structure is maintained. Need mechanism to
142      * copy over signed entry information.
143      *
144      * @param jarURL The url of the jar to add to the installer. We use a URL so the jar may be
145      * nested within another.
146      */

147     public abstract void addJarContent(URL JavaDoc jarURL);
148
149     /**
150      * Adds a jar file content to the installer. Package structure is maintained. Need mechanism to
151      * copy over signed entry information. If the given file list is null the hole contents of the
152      * jar file will be copied else only the listed.
153      *
154      * @param jarURL The url of the jar to add to the installer. We use a URL so the jar may be
155      * nested within another.
156      * @param files to be copied
157      */

158     public abstract void addJarContent(URL JavaDoc jarURL, List JavaDoc files);
159
160     /**
161      * Marks a native library to be added to the uninstaller.
162      *
163      * @param data the describing custom action data object
164      */

165     public abstract void addNativeUninstallerLibrary(CustomData data);
166
167     /**
168      * Returns the current pack compressor
169      * @return Returns the current pack compressor.
170      */

171     public abstract PackCompressor getCompressor();
172     
173     /**
174      * Initializes a pack compressor if supported by the packager
175      * @param compr_format
176      * @param compr_level
177      */

178     public abstract void initPackCompressor(String JavaDoc compr_format, int compr_level) throws CompilerException;
179     
180     /**
181      * Adds configuration information to the packager.
182      * @param data - the xml-element packaging from the install.xml
183      */

184     public abstract void addConfigurationInformation(XMLElement data);
185 }
Popular Tags