001: /*
002: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
003: *
004: * http://izpack.org/
005: * http://izpack.codehaus.org/
006: *
007: * Licensed under the Apache License, Version 2.0 (the "License");
008: * you may not use this file except in compliance with the License.
009: * You may obtain a copy of the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS,
015: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016: * See the License for the specific language governing permissions and
017: * limitations under the License.
018: */
019: package com.izforge.izpack.compiler;
020:
021: import java.io.File;
022: import java.net.URL;
023: import java.util.List;
024: import java.util.Map;
025: import java.util.Properties;
026:
027: import net.n3.nanoxml.XMLElement;
028:
029: import com.izforge.izpack.CustomData;
030: import com.izforge.izpack.GUIPrefs;
031: import com.izforge.izpack.Info;
032: import com.izforge.izpack.Panel;
033: import com.izforge.izpack.rules.Condition;
034: import com.izforge.izpack.compressor.PackCompressor;
035:
036: /**
037: * Interface for all packager implementations
038: *
039: * @author Dennis Reil, <Dennis.Reil@reddot.de>
040: */
041: public interface IPackager {
042:
043: /**
044: * Create the installer, beginning with the specified jar. If the name specified does not end in
045: * ".jar", it is appended. If secondary jars are created for packs (if the Info object added has
046: * a webDirURL set), they are created in the same directory, named sequentially by inserting
047: * ".pack#" (where '#' is the pack number) ".jar" suffix: e.g. "foo.pack1.jar". If any file
048: * exists, it is overwritten.
049: */
050: public abstract void createInstaller(File primaryFile)
051: throws Exception;
052:
053: /**
054: * Get the PackagerListener.
055: * @return the current PackagerListener
056: */
057: public abstract PackagerListener getPackagerListener();
058:
059: /**
060: * Adds a listener.
061: *
062: * @param listener The listener.
063: */
064: public abstract void setPackagerListener(PackagerListener listener);
065:
066: /**
067: * Sets the informations related to this installation.
068: *
069: * @param info The info section.
070: * @exception Exception Description of the Exception
071: */
072: public abstract void setInfo(Info info) throws Exception;
073:
074: /**
075: * Sets the GUI preferences.
076: *
077: * @param prefs The new gUIPrefs value
078: */
079: public abstract void setGUIPrefs(GUIPrefs prefs);
080:
081: /**
082: * Allows access to add, remove and update the variables for the project, which are maintained
083: * in the packager.
084: *
085: * @return map of variable names to values
086: */
087: public abstract Properties getVariables();
088:
089: /**
090: * Add a panel, where order is important. Only one copy of the class files neeed are inserted in
091: * the installer.
092: */
093: public abstract void addPanelJar(Panel panel, URL jarURL);
094:
095: /**
096: * Add a custom data like custom actions, where order is important. Only one copy of the class
097: * files neeed are inserted in the installer.
098: *
099: * @param ca custom action object
100: * @param url the URL to include once
101: */
102: public abstract void addCustomJar(CustomData ca, URL url);
103:
104: /**
105: * Adds a pack, order is mostly irrelevant.
106: *
107: * @param pack contains all the files and items that go with a pack
108: */
109: public abstract void addPack(PackInfo pack);
110:
111: /**
112: * Gets the packages list
113: */
114: public abstract List<PackInfo> getPacksList();
115:
116: /**
117: * Adds a language pack.
118: *
119: * @param iso3 The ISO3 code.
120: * @param xmlURL The location of the xml local info
121: * @param flagURL The location of the flag image resource
122: */
123: public abstract void addLangPack(String iso3, URL xmlURL,
124: URL flagURL);
125:
126: /**
127: * Adds a resource.
128: *
129: * @param resId The resource Id.
130: * @param url The location of the data
131: */
132: public abstract void addResource(String resId, URL url);
133:
134: /**
135: * Adds a native library.
136: *
137: * @param name The native library name.
138: * @param url The url to get the data from.
139: * @exception Exception Description of the Exception
140: */
141: public abstract void addNativeLibrary(String name, URL url)
142: throws Exception;
143:
144: /**
145: * Adds a jar file content to the installer. Package structure is maintained. Need mechanism to
146: * copy over signed entry information.
147: *
148: * @param jarURL The url of the jar to add to the installer. We use a URL so the jar may be
149: * nested within another.
150: */
151: public abstract void addJarContent(URL jarURL);
152:
153: /**
154: * Adds a jar file content to the installer. Package structure is maintained. Need mechanism to
155: * copy over signed entry information. If the given file list is null the hole contents of the
156: * jar file will be copied else only the listed.
157: *
158: * @param jarURL The url of the jar to add to the installer. We use a URL so the jar may be
159: * nested within another.
160: * @param files to be copied
161: */
162: public abstract void addJarContent(URL jarURL, List<String> files);
163:
164: /**
165: * Marks a native library to be added to the uninstaller.
166: *
167: * @param data the describing custom action data object
168: */
169: public abstract void addNativeUninstallerLibrary(CustomData data);
170:
171: /**
172: * Returns the current pack compressor
173: * @return Returns the current pack compressor.
174: */
175: public abstract PackCompressor getCompressor();
176:
177: /**
178: * Initializes a pack compressor if supported by the packager
179: * @param compr_format
180: * @param compr_level
181: */
182: public abstract void initPackCompressor(String compr_format,
183: int compr_level) throws CompilerException;
184:
185: /**
186: * Adds configuration information to the packager.
187: * @param data - the xml-element packaging from the install.xml
188: */
189: public abstract void addConfigurationInformation(XMLElement data);
190:
191: /**
192: * @return the rules
193: */
194: public abstract Map<String, Condition> getRules();
195:
196: /**
197: * @param rules the rules to set
198: */
199: public abstract void setRules(Map<String, Condition> rules);
200:
201: /**
202: * Returns a map of dynamically refreshed variables
203: * @return the map
204: */
205: public abstract Map<String, DynamicVariable> getDynamicVariables();
206:
207: /**
208: *
209: * @param dynamicvariables
210: */
211: public abstract void setDynamicVariables(
212: Map<String, DynamicVariable> dynamicvariables);
213: }
|