|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.mj.impl.installer.jsrpluginnotifier; |
|
20 |
|
21 /** |
|
22 * Installer Jsr plugin just for test purposes. |
|
23 * |
|
24 * @author Nokia Corporation |
|
25 * @version $Rev: 9336 $ $Date: 2010-01-14 14:18:29 +0200 (Thu, 14 Jan 2010) $ |
|
26 * @see InstallerExtension |
|
27 */ |
|
28 public class TestPlugin2 implements InstallerExtension |
|
29 { |
|
30 /** |
|
31 * This method is called when installation has been done |
|
32 * nearly completely (only committing changes is left). |
|
33 * @param aInstallerExtensionInfo installation info |
|
34 * @return true if installation can be finished |
|
35 * false if installation must be cancelled |
|
36 */ |
|
37 public boolean install(InstallerExtensionInfo aInstallerExtensionInfo) |
|
38 { |
|
39 aInstallerExtensionInfo.log("TestPlugin2.install called"); |
|
40 |
|
41 // tell that this plugin has been called |
|
42 System.setProperty("TestPlugin2", "install"); |
|
43 |
|
44 // If the MIDlet to be installed has JAD/JAR attribute |
|
45 // "JSR-Plugin-Test-Cancel" with any value, cancel install |
|
46 if ((aInstallerExtensionInfo.iAttributes != null) && |
|
47 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null)) |
|
48 { |
|
49 return false; |
|
50 } |
|
51 |
|
52 return true; |
|
53 } |
|
54 |
|
55 /** |
|
56 * This method is called when uninstallation is starting |
|
57 * (all information is still available in databases). |
|
58 * @param aInstallerExtensionInfo uninstallation info |
|
59 * @return true if uninstallation can be finished |
|
60 * false if uninstallation must be cancelled |
|
61 */ |
|
62 public boolean uninstall(InstallerExtensionInfo aInstallerExtensionInfo) |
|
63 { |
|
64 aInstallerExtensionInfo.log("TestPlugin2.uninstall called"); |
|
65 |
|
66 // tell that this plugin has been called |
|
67 System.setProperty("TestPlugin2", "uninstall"); |
|
68 |
|
69 // If the MIDlet to be installed has JAD/JAR attribute |
|
70 // "JSR-Plugin-Test-Cancel" with any value, cancel install |
|
71 if ((aInstallerExtensionInfo.iAttributes != null) && |
|
72 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null)) |
|
73 { |
|
74 return false; |
|
75 } |
|
76 |
|
77 return true; |
|
78 } |
|
79 |
|
80 |
|
81 /** |
|
82 * Called when installation has failed and will be rolled back. |
|
83 * Can be called even after install() has been called. |
|
84 * |
|
85 * @param aInstallerExtensionInfo installation info |
|
86 */ |
|
87 public void rollbackInstall(InstallerExtensionInfo aInstallerExtensionInfo) |
|
88 { |
|
89 aInstallerExtensionInfo.log("TestPlugin2.rollbackInstall called"); |
|
90 |
|
91 // tell that this plugin has been called |
|
92 System.setProperty("TestPlugin2", "rollbackInstall"); |
|
93 } |
|
94 |
|
95 /** |
|
96 * Called when uninstallation has failed and will be rolled back. |
|
97 * Can be called after uninstall() has been called. |
|
98 * |
|
99 * @param aInstallerExtensionInfo installation info |
|
100 */ |
|
101 public void rollbackUninstall(InstallerExtensionInfo aInstallerExtensionInfo) |
|
102 { |
|
103 aInstallerExtensionInfo.log("TestPlugin2.rollbackUninstall called"); |
|
104 |
|
105 // tell that this plugin has been called |
|
106 System.setProperty("TestPlugin2", "rollbackUninstall"); |
|
107 } |
|
108 } |