Source Code Cross Referenced for AutomatedInstallData.java in  » Installer » IzPack » com » izforge » izpack » installer » 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.installer 
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:         * 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:
020:        package com.izforge.izpack.installer;
021:
022:        import java.util.ArrayList;
023:        import java.util.HashMap;
024:        import java.util.List;
025:        import java.util.Locale;
026:        import java.util.Map;
027:        import java.util.Properties;
028:        import java.util.zip.ZipOutputStream;
029:
030:        import net.n3.nanoxml.XMLElement;
031:
032:        import com.izforge.izpack.Info;
033:        import com.izforge.izpack.LocaleDatabase;
034:        import com.izforge.izpack.Pack;
035:
036:        /**
037:         * Encloses information about the install process. This implementation is not thread safe.
038:         * 
039:         * @author Julien Ponge <julien@izforge.com>
040:         * @author Johannes Lehtinen <johannes.lehtinen@iki.fi>
041:         */
042:        public class AutomatedInstallData {
043:
044:            // --- Static members -------------------------------------------------
045:            public static final String MODIFY_INSTALLATION = "modify.izpack.install";
046:            public static final String INSTALLATION_INFORMATION = ".installationinformation";
047:
048:            /**
049:             * Names of the custom actions types with which they are stored in the installer jar file. These
050:             * names are also used to identify the type of custom action in the customData map. Slashes as
051:             * first char are needed to use the names as "file" name in the installer jar.
052:             */
053:            // Attention !! Do not change the existent names and the order.
054:            // Add a / as first char at new types. Add new type handling in
055:            // Unpacker.
056:            static final String[] CUSTOM_ACTION_TYPES = new String[] {
057:                    "/installerListeners", "/uninstallerListeners",
058:                    "/uninstallerLibs", "/uninstallerJars" };
059:
060:            public static final int INSTALLER_LISTENER_INDEX = 0;
061:
062:            public static final int UNINSTALLER_LISTENER_INDEX = 1;
063:
064:            public static final int UNINSTALLER_LIBS_INDEX = 2;
065:
066:            public static final int UNINSTALLER_JARS_INDEX = 3;
067:
068:            // --- Instance members -----------------------------------------------
069:
070:            /** The language code. */
071:            public String localeISO3;
072:
073:            /** The used locale. */
074:            public Locale locale;
075:
076:            /** The language pack. */
077:            public LocaleDatabase langpack;
078:
079:            /** The uninstaller jar stream. */
080:            public ZipOutputStream uninstallOutJar;
081:
082:            /** The inforamtions. */
083:            public Info info;
084:
085:            /** The complete list of packs. */
086:            public List<Pack> allPacks;
087:
088:            /** The available packs. */
089:            public List availablePacks;
090:
091:            /** The selected packs. */
092:            public List selectedPacks;
093:
094:            /** The panels list. */
095:            public List<IzPanel> panels;
096:
097:            /** The panels order. */
098:            public List panelsOrder;
099:
100:            /** The current panel. */
101:            public int curPanelNumber;
102:
103:            /** Can we close the installer ? */
104:            public boolean canClose = false;
105:
106:            /** Did the installation succeed ? */
107:            public boolean installSuccess = true;
108:
109:            /** The xmlData for automated installers. */
110:            public XMLElement xmlData;
111:
112:            /** Custom data. */
113:            public Map<String, List> customData;
114:
115:            /**
116:             * Maps the variable names to their values
117:             */
118:            protected Properties variables;
119:
120:            /** The attributes used by the panels */
121:            protected Map<String, Object> attributes;
122:
123:            /** This class should be a singleton. Therefore
124:             * the one possible object will be stored in this 
125:             * static member.
126:             */
127:            private static AutomatedInstallData self = null;
128:
129:            /**
130:             * Returns the one possible object of this class.
131:             * @return the one possible object of this class
132:             */
133:            public static AutomatedInstallData getInstance() {
134:                return (self);
135:            }
136:
137:            /** Constructs a new instance of this class. 
138:             * Only one should be possible, at a scound call a RuntimeException
139:             * will be raised. */
140:            public AutomatedInstallData() {
141:                availablePacks = new ArrayList();
142:                selectedPacks = new ArrayList();
143:                panels = new ArrayList<IzPanel>();
144:                panelsOrder = new ArrayList();
145:                xmlData = new XMLElement("AutomatedInstallation");
146:                variables = new Properties();
147:                attributes = new HashMap<String, Object>();
148:                customData = new HashMap<String, List>();
149:                if (self != null)
150:                    throw new RuntimeException(
151:                            "Panic!! second call of the InstallData Ctor!!");
152:                self = this ;
153:            }
154:
155:            /**
156:             * Returns the map of variable values. Modifying this will directly affect the current value of
157:             * variables.
158:             * 
159:             * @return the map of variable values
160:             */
161:            public Properties getVariables() {
162:                return variables;
163:            }
164:
165:            /**
166:             * Sets a variable to the specified value. This is short hand for
167:             * <code>getVariables().setProperty(var, val)</code>.
168:             * 
169:             * @param var the name of the variable
170:             * @param val the new value of the variable
171:             * @see #getVariable
172:             */
173:            public void setVariable(String var, String val) {
174:                variables.setProperty(var, val);
175:            }
176:
177:            /**
178:             * Returns the current value of the specified variable. This is short hand for
179:             * <code>getVariables().getProperty(var)</code>.
180:             * 
181:             * @param var the name of the variable
182:             * @return the value of the variable or null if not set
183:             * @see #setVariable
184:             */
185:            public String getVariable(String var) {
186:                return variables.getProperty(var);
187:            }
188:
189:            /**
190:             * Sets the install path.
191:             * 
192:             * @param path the new install path
193:             * @see #getInstallPath
194:             */
195:            public void setInstallPath(String path) {
196:                setVariable(ScriptParser.INSTALL_PATH, path);
197:            }
198:
199:            /**
200:             * Returns the install path.
201:             * 
202:             * @return the current install path or null if none set yet
203:             * @see #setInstallPath
204:             */
205:            public String getInstallPath() {
206:                return getVariable(ScriptParser.INSTALL_PATH);
207:            }
208:
209:            /**
210:             * Returns the value of the named attribute.
211:             * 
212:             * @param attr the name of the attribute
213:             * @return the value of the attribute or null if not set
214:             * @see #setAttribute
215:             */
216:            public Object getAttribute(String attr) {
217:                return attributes.get(attr);
218:            }
219:
220:            /**
221:             * Sets a named attribute. The panels and other IzPack components can attach custom attributes
222:             * to InstallData to communicate with each other. For example, a set of co-operating custom
223:             * panels do not need to implement a common data storage but can use InstallData singleton. The
224:             * name of the attribute should include the package and class name to prevent name space
225:             * collisions.
226:             * 
227:             * @param attr the name of the attribute to set
228:             * @param val the value of the attribute or null to unset the attribute
229:             * @see #getAttribute
230:             */
231:            public void setAttribute(String attr, Object val) {
232:                if (val == null)
233:                    attributes.remove(attr);
234:                else
235:                    attributes.put(attr, val);
236:
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.