|
1 /* |
|
2 * Copyright (c) 2010 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.midp2.install.steps; |
|
20 |
|
21 import com.nokia.mj.impl.installer.applicationregistrator.SifNotifier; |
|
22 import com.nokia.mj.impl.installer.exetable.ExeBall; |
|
23 import com.nokia.mj.impl.installer.exetable.ExeStep; |
|
24 import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo; |
|
25 import com.nokia.mj.impl.installer.utils.InstallerException; |
|
26 import com.nokia.mj.impl.installer.utils.Log; |
|
27 |
|
28 import java.util.Vector; |
|
29 |
|
30 public class StartProgressNotifications extends ExeStep |
|
31 { |
|
32 public void execute(ExeBall aBall) |
|
33 { |
|
34 InstallBall ball = (InstallBall)aBall; |
|
35 Log.log("Starting progress notifications..."); |
|
36 |
|
37 if (!SifNotifier.enabled()) |
|
38 { |
|
39 Log.log("SifNotifier disabled."); |
|
40 return; |
|
41 } |
|
42 |
|
43 try |
|
44 { |
|
45 ball.iSifNotifier = new SifNotifier(); |
|
46 } |
|
47 catch (Throwable t) |
|
48 { |
|
49 Log.logError("StartProgressNotifications: creating SifNotifier failed", t); |
|
50 // Could not create SifNotifer, let's proceed without it. |
|
51 return; |
|
52 } |
|
53 |
|
54 // Init application names array. |
|
55 Vector appNamesVector = ball.iSuite.getApplications(); |
|
56 String[] appNames = new String[appNamesVector.size()]; |
|
57 for (int i = 0; i < appNamesVector.size(); i++) |
|
58 { |
|
59 appNames[i] = |
|
60 ((ApplicationInfo)appNamesVector.elementAt(i)).getName(); |
|
61 } |
|
62 |
|
63 // Use default icon for now. |
|
64 String componentIconPath = |
|
65 ball.iApplicationRegistrator.getDefaultIconPath(); |
|
66 |
|
67 try |
|
68 { |
|
69 ball.iSifNotifier.notifyStart( |
|
70 (ball.iOldSuite != null? |
|
71 ball.iSifNotifier.OP_UPDATE: ball.iSifNotifier.OP_INSTALL), |
|
72 ball.iSuite.getGlobalId(), ball.iSuite.getName(), |
|
73 appNames, ball.iSuite.calculateInitialSize(), |
|
74 componentIconPath); |
|
75 } |
|
76 catch (Throwable t) |
|
77 { |
|
78 Log.logError("StartProgressNotifications: SifNotifier.notifyStart failed", t); |
|
79 } |
|
80 |
|
81 // Set SifNotifier for the listeners that should use it. |
|
82 ball.iInstallationNotifier.setSifNotifier(ball.iSifNotifier); |
|
83 } |
|
84 |
|
85 public void cancel(ExeBall aBall) |
|
86 { |
|
87 // nop |
|
88 } |
|
89 } |