Source Code Cross Referenced for Uninstall.java in  » Installer » VAInstall » com » memoire » vainstall » 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 » VAInstall » com.memoire.vainstall 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $RCSfile: Uninstall.java,v $
003:         * @creation     26/01/00
004:         * @modification $Date: 2005/05/13 21:01:10 $
005:         */package com.memoire.vainstall;
006:
007:        import java.awt.Color;
008:        import java.io.File;
009:        import java.io.IOException;
010:        import java.io.InputStream;
011:        import java.lang.reflect.Method;
012:        import java.util.Properties;
013:        import java.util.Vector;
014:
015:        import javax.swing.LookAndFeel;
016:        import javax.swing.UIManager;
017:        import javax.swing.UnsupportedLookAndFeelException;
018:
019:        import com.ice.jni.registry.Registry;
020:        import com.ice.jni.registry.RegistryKey;
021:
022:        /**
023:         * @version      $Id: Uninstall.java,v 1.15 2005/05/13 21:01:10 deniger Exp $
024:         * @author       Axel von Arnim
025:         */
026:
027:        public class Uninstall
028:        //       extends Setup
029:                extends AbstractInstall {
030:            private File uninstlog_;
031:            private String customPrePostClassName_;
032:
033:            public Uninstall(String uiMode, String uiBluescreen,
034:                    String uiBluescreenColor, String appName,
035:                    String appVersion, String destPath) {
036:                super ();
037:
038:                VAGlobals.UI_MODE = System.getProperty("uimode", uiMode);
039:                if ("no".equals(uiBluescreen))
040:                    VAGlobals.UI_BLUESCREEN = false;
041:                else
042:                    VAGlobals.UI_BLUESCREEN = true;
043:                String bsVar = System.getProperty("bluescreen");
044:                if (bsVar != null) {
045:                    if ("no".equalsIgnoreCase(bsVar))
046:                        VAGlobals.UI_BLUESCREEN = false;
047:                    else
048:                        VAGlobals.UI_BLUESCREEN = true;
049:                }
050:                if ((uiBluescreenColor == null)
051:                        || ("".equals(uiBluescreenColor))
052:                        || ("null".equals(uiBluescreenColor)))
053:                    VAGlobals.UI_BLUESCREEN_COLOR = null;
054:                else
055:                    VAGlobals.UI_BLUESCREEN_COLOR = new Color(Integer.parseInt(
056:                            uiBluescreenColor, 16));
057:                // image is forced to this location now
058:                VAGlobals.IMAGE = "com/memoire/vainstall/resources/banner.gif";
059:                VAGlobals.APP_NAME = appName;
060:                VAGlobals.APP_VERSION = appVersion;
061:                VAGlobals.DEST_PATH = destPath;
062:                VAGlobals.OPERATION = VAGlobals.UNINSTALL;
063:
064:                // get vainstall.properties
065:                InputStream pin = getClass().getResourceAsStream(
066:                        "resources/vainstall.properties");
067:                Properties prop = new Properties();
068:                //    String language = null;
069:                try {
070:                    prop.load(pin);
071:                    pin.close();
072:                } catch (IOException exc) {
073:                    // ignore at the moment
074:                }
075:                VAStepFactory.setLnf(VAGlobals.UI_MODE, prop, getClass(), null);
076:                language = prop.getProperty("vainstall.destination.language");
077:                if (language != null) {
078:                    VAGlobals.setLanguage(language);
079:                } else {
080:                    VAGlobals.setLanguage("default");
081:                }
082:
083:                // class name for pre/post install
084:                customPrePostClassName_ = prop
085:                        .getProperty("vainstall.install.customprepost.className");
086:                ui_ = VAStepFactory.createUI(VAGlobals.UI_MODE, this );
087:                VAGlobals.printDebug("UI created");
088:                uninstlog_ = new File(destPath + File.separator
089:                        + "uninstall.vai");
090:                if ((!uninstlog_.exists()) || (!uninstlog_.canRead())) {
091:                    exitOnError(new IOException(uninstlog_.getName() + " "
092:                            + VAGlobals.i18n("Uninstall_NotBeRead")));
093:                }
094:                nextStep();
095:                ui_.activateUI();
096:            }
097:
098:            public void nextStep() {
099:                switch (state_) {
100:                case START: {
101:                    state_ = WELCOME;
102:                    setActionEnabled(NEXT | CANCEL);
103:                    step_ = ui_.createWelcomeStep();
104:                    break;
105:                }
106:                case WELCOME: {
107:                    state_ = INSTALL;
108:                    setActionEnabled(BACK | NEXT | CANCEL);
109:                    step_ = ui_.createInstallStep();
110:                    break;
111:                }
112:                case INSTALL: {
113:                    setActionEnabled(0);
114:                    startUninstall();
115:                    setActionEnabled(NEXT);
116:                    state_ = END;
117:                    setActionEnabled(FINISH);
118:                    step_ = ui_.createEndStep();
119:                    ((VAEndStep) step_).setStats(stats_);
120:                    break;
121:                }
122:                case END: {
123:                    ui_.quitUI();
124:                    quit();
125:                }
126:                }
127:            }
128:
129:            public void previousStep() {
130:                switch (state_) {
131:                case INSTALL: {
132:                    VAGlobals.printDebug("WELCOME");
133:                    state_ = WELCOME;
134:                    setActionEnabled(NEXT | CANCEL);
135:                    step_ = ui_.createWelcomeStep();
136:                    break;
137:                }
138:                default: {
139:                    VAGlobals.printDebug("can't go back...");
140:                    break;
141:                }
142:                }
143:            }
144:
145:            private void startUninstall() {
146:                VAInstallStep step = (VAInstallStep) step_;
147:                try {
148:                    step.setProgression(0);
149:                    if (customPrePostClassName_.length() > 0)
150:                        callCustom("preUninstall", step, VAGlobals
151:                                .i18n("Custom_Preparing..."));
152:                    step.status(VAGlobals.i18n("Uninstall_DeletingFiles"));
153:                    Vector directories = deleteFiles(uninstlog_);
154:                    step.setProgression(50);
155:                    step
156:                            .status(VAGlobals
157:                                    .i18n("Uninstall_DeletingDirectories"));
158:                    deleteDirectories(directories);
159:                    step.setProgression(60);
160:                    cleanShortcuts(uninstlog_.getParentFile());
161:                    step.setProgression(90);
162:                    step.status(VAGlobals
163:                            .i18n("Uninstall_DeletingUninstallDirectory"));
164:                    deleteDirRecursive(new File(VAGlobals.DEST_PATH));
165:                    step.setProgression(100);
166:                    if (IS_WIN) {
167:                        step.status(VAGlobals
168:                                .i18n("Uninstall_UpdatingWindowsRegistry"));
169:                        updateWindowsRegistry();
170:                        ui_.uiSleep(2000);
171:                        step.status(VAGlobals
172:                                .i18n("Uninstall_WindowsRegistryUpdated"));
173:                        ui_.uiSleep(1000);
174:                        new File("ICE_JNIRegistry.dll").delete();
175:                    }
176:                    if (customPrePostClassName_.length() > 0)
177:                        callCustom("postUninstall", step, VAGlobals
178:                                .i18n("Custom_Mopping..."));
179:                    step.status(VAGlobals
180:                            .i18n("Uninstall_UninstallationComplete"));
181:                } catch (Exception e) {
182:                    exitOnError(e);
183:                }
184:            }
185:
186:            public void redoStep() {
187:                switch (state_) {
188:
189:                case START: {
190:                    setActionEnabled(NEXT | CANCEL);
191:                    step_ = ui_.createSetupLanguageStep();
192:                    break;
193:                }
194:
195:                case WELCOME: {
196:                    {
197:                        setActionEnabled(BACK | NEXT | CANCEL);
198:                    }
199:                    step_ = ui_.createWelcomeStep();
200:                    break;
201:                }
202:                case INSTALL: {
203:                    setActionEnabled(BACK | NEXT | CANCEL);
204:                    step_ = ui_.createInstallStep();
205:                    break;
206:                }
207:                case END: {
208:                    setActionEnabled(FINISH);
209:                    step_ = ui_.createEndStep();
210:                    ((VAEndStep) step_).setStats(stats_);
211:                    break;
212:                }
213:                }
214:
215:            }
216:
217:            protected void updateWindowsRegistry() throws IOException {
218:                try {
219:                    RegistryKey uninstallKey = Registry.HKEY_LOCAL_MACHINE
220:                            .openSubKey(
221:                                    "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
222:                                    RegistryKey.ACCESS_WRITE);
223:                    uninstallKey.deleteSubKey(VAGlobals.APP_NAME + " "
224:                            + VAGlobals.APP_VERSION);
225:                    uninstallKey.closeKey();
226:                } catch (Exception e) {
227:                    throw new IOException("" + e);
228:                }
229:            }
230:
231:            private void callCustom(String method_name, VAInstallStep step,
232:                    String msg) throws Exception {
233:                step.status(msg);
234:                VAGlobals.printDebug("begin custom " + method_name);
235:                Class custom = Class.forName(customPrePostClassName_);
236:                Method method = custom.getMethod(method_name,
237:                        new Class[] { VAInstallStep.class });
238:                boolean rc = Setup.callReflect(method, new Object[] { step });
239:                if (!rc) {
240:                    VAGlobals
241:                            .printDebug("custom pre/post-uninstall returned false");
242:                    throw new IOException(VAGlobals
243:                            .i18n("Uninstall_CustomFailed"));
244:                }
245:                VAGlobals.printDebug("end custom " + method_name);
246:            }
247:            // do nothing
248:            //public void redoStep(){}
249:
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.