Source Code Cross Referenced for PackInfo.java in  » Installer » IzPack » com » izforge » izpack » compiler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.compiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
003:         * 
004:         * http://izpack.org/
005:         * http://izpack.codehaus.org/
006:         * 
007:         * Copyright 2004 Chadwick McHenry
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:
022:        package com.izforge.izpack.compiler;
023:
024:        import java.io.File;
025:        import java.io.FileNotFoundException;
026:        import java.util.ArrayList;
027:        import java.util.HashMap;
028:        import java.util.List;
029:        import java.util.Map;
030:        import java.util.Set;
031:
032:        import com.izforge.izpack.ExecutableFile;
033:        import com.izforge.izpack.Pack;
034:        import com.izforge.izpack.PackFile;
035:        import com.izforge.izpack.ParsableFile;
036:        import com.izforge.izpack.UpdateCheck;
037:        import com.izforge.izpack.util.OsConstraint;
038:
039:        /**
040:         * Temporary holding place for Pack information as the Packager is built. The packager is used by
041:         * the compiler to collect info about an installer, and finally create the actual installer files.
042:         * 
043:         * @author Chadwick McHenry
044:         */
045:        public class PackInfo {
046:
047:            /** The pack object serialized in the installer. */
048:            private Pack pack;
049:
050:            /** The color of the node. This is used for the dependency graph algorithms */
051:            public int colour;
052:
053:            /** white colour */
054:            public final static int WHITE = 0;
055:
056:            /** grey colour */
057:            public final static int GREY = 1;
058:
059:            /** black colour */
060:            public final static int BLACK = 2;
061:
062:            /** Files of the Pack. */
063:            private Map files = new HashMap();
064:
065:            /** Parsables files in this Pack. */
066:            private List parsables = new ArrayList();
067:
068:            /** Executable files in this Pack. */
069:            private List executables = new ArrayList();
070:
071:            /** Update check specifications in this Pack. */
072:            private List updateChecks = new ArrayList();
073:
074:            /** Constructor with required info. 
075:             * @param name name of the pack
076:             * @param id id of the pack e.g. to resolve I18N
077:             * @param description descripton in English
078:             * @param required pack is required or not
079:             * @param loose files of pack should be stored separatly or not
080:             * @param excludegroup name of the exclude group 
081:             * @param uninstall pack must be uninstalled 
082:             */
083:            public PackInfo(String name, String id, String description,
084:                    boolean required, boolean loose, String excludegroup,
085:                    boolean uninstall) {
086:                boolean ispreselected = (excludegroup == null);
087:                pack = new Pack(name, id, description, null, null, required,
088:                        ispreselected, loose, excludegroup, uninstall);
089:                colour = PackInfo.WHITE;
090:            }
091:
092:            /***********************************************************************************************
093:             * Attributes of the Pack
094:             **********************************************************************************************/
095:
096:            public void setDependencies(List<String> dependencies) {
097:                pack.dependencies = dependencies;
098:            }
099:
100:            /**
101:             * Set the name of the group which contains the packs which exludes mutual.
102:             * @param group name of the mutal exclude group
103:             */
104:            public void setExcludeGroup(String group) {
105:                pack.excludeGroup = group;
106:            }
107:
108:            public void setOsConstraints(List<OsConstraint> osConstraints) {
109:                pack.osConstraints = osConstraints;
110:            }
111:
112:            public List<OsConstraint> getOsConstraints(List osConstraints) {
113:                return pack.osConstraints;
114:            }
115:
116:            public void setPreselected(boolean preselected) {
117:                pack.preselected = preselected;
118:            }
119:
120:            public boolean isPreselected() {
121:                return pack.preselected;
122:            }
123:
124:            /**
125:             * Get the pack group.
126:             * @return Get the pack group, null if there is no group.
127:             */
128:            public String getGroup() {
129:                return pack.group;
130:            }
131:
132:            /**
133:             * Set the pack group.
134:             * @param group the group to associate the pack with.
135:             */
136:            public void setGroup(String group) {
137:                pack.group = group;
138:            }
139:
140:            /**
141:             * Add an install group to the pack.
142:             * @param group the install group to associate the pack with.
143:             */
144:            public void addInstallGroup(String group) {
145:                pack.installGroups.add(group);
146:            }
147:
148:            /**
149:             * See if the pack is associated with the given install group.
150:             * @param group the install group name to check
151:             * @return true if the given group is associated with the pack.
152:             */
153:            public boolean hasInstallGroup(String group) {
154:                return pack.installGroups.contains(group);
155:            }
156:
157:            /**
158:             * Get the install group names.
159:             * @return Set<String> for the install groups
160:             */
161:            public Set<String> getInstallGroups() {
162:                return pack.installGroups;
163:            }
164:
165:            public Pack getPack() {
166:                return pack;
167:            }
168:
169:            /***********************************************************************************************
170:             * Public methods to add data to the Installer being packed
171:             **********************************************************************************************/
172:
173:            /**
174:             * Add a file or directory to be installed.
175:             * 
176:             * @param file the file or basedir to be installed.
177:             * @param targetfile path file will be installed to.
178:             * @param osList the target operation system(s) of this pack.
179:             * @param override what to do if the file already exists when installing
180:             * @param condition 
181:             * 
182:             * @throws FileNotFoundException if the file specified does not exist. The file is not read
183:             * until the {@link Packager#createInstaller} is invoked, thus a FileNotFoundEception will occur
184:             * then, if the file is deleted in between.
185:             */
186:            /*
187:             * public void addFile(File file, String targetfile, List osList, int override) throws
188:             * FileNotFoundException { addFile( file,targetfile, osList, override, null); }
189:             * 
190:             * 
191:             * /** Add a file or directory to be installed.
192:             * 
193:             * @param file the file or basedir to be installed. @param targetfile path file will be
194:             * installed to. @param osList the target operation system(s) of this pack. @param override what
195:             * to do if the file already exists when installing @param additionals Map which contains
196:             * additional data
197:             * 
198:             * @throws FileNotFoundException if the file specified does not exist. The file is not read
199:             * until the {@link Packager#createInstaller} is invoked, thus a FileNotFoundEception will occur
200:             * then, if the file is deleted in between.
201:             */
202:            public void addFile(File baseDir, File file, String targetfile,
203:                    List<OsConstraint> osList, int override, Map additionals,
204:                    String condition) throws FileNotFoundException {
205:                if (!file.exists())
206:                    throw new FileNotFoundException(file.toString());
207:
208:                PackFile packFile = new PackFile(baseDir, file, targetfile,
209:                        osList, override, additionals);
210:                packFile.setCondition(condition);
211:                files.put(packFile, file);
212:            }
213:
214:            /** Set of PackFile objects for this Pack. */
215:            public Set getPackFiles() {
216:                return files.keySet();
217:            }
218:
219:            /**
220:             * The file described by the specified PackFile. Returns <tt>null</tt> if the PackFile did not
221:             * come from the set returned by {@link #getPackFiles()}.
222:             */
223:            public File getFile(PackFile packFile) {
224:                return (File) files.get(packFile);
225:            }
226:
227:            /**
228:             * Parsable files have variables substituted after installation.
229:             */
230:            public void addParsable(ParsableFile parsable) {
231:                parsables.add(parsable);
232:            }
233:
234:            /** List of parsables for this Pack. */
235:            public List getParsables() {
236:                return parsables;
237:            }
238:
239:            /**
240:             * Executables files have their executable flag set, may be executed, and optionally, deleted
241:             * when finished executing.
242:             */
243:            public void addExecutable(ExecutableFile executable) {
244:                executables.add(executable);
245:            }
246:
247:            /** List of parsables for this Pack. */
248:            public List getExecutables() {
249:                return executables;
250:            }
251:
252:            /**
253:             * Executables files have their executable flag set, may be executed, and optionally, deleted
254:             * when finished executing.
255:             */
256:            public void addUpdateCheck(UpdateCheck updateCheck) {
257:                updateChecks.add(updateCheck);
258:            }
259:
260:            /** List of update checks for this Pack. */
261:            public List getUpdateChecks() {
262:                return updateChecks;
263:            }
264:
265:            /**
266:             * The packs that this file depends on
267:             */
268:            public void addDependency(String dependency) {
269:                if (pack.dependencies == null) {
270:                    pack.dependencies = new ArrayList<String>();
271:                }
272:                pack.dependencies.add(dependency);
273:            }
274:
275:            public List<String> getDependencies() {
276:                return pack.dependencies;
277:            }
278:
279:            public String getParent() {
280:                return pack.parent;
281:            }
282:
283:            public void setParent(String p) {
284:                pack.parent = p;
285:            }
286:
287:            public String toString() {
288:                return pack.name;
289:            }
290:
291:            public void setPackImgId(String packImgId) {
292:                pack.packImgId = packImgId;
293:            }
294:
295:            /**
296:             * @return the condition
297:             */
298:            public String getCondition() {
299:                return this .pack.getCondition();
300:            }
301:
302:            /**
303:             * @param condition the condition to set
304:             */
305:            public void setCondition(String condition) {
306:                this.pack.setCondition(condition);
307:            }
308:
309:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.