|
1 /* |
|
2 * Copyright (c) 2008-2009 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 package com.nokia.mj.impl.utils; |
|
19 |
|
20 import com.nokia.mj.impl.utils.ResourceLoader; |
|
21 import java.util.Hashtable; |
|
22 |
|
23 /** |
|
24 * Class defining Installer short error messages. |
|
25 * |
|
26 * @author Nokia Corporation |
|
27 * @version 1.0 |
|
28 */ |
|
29 public final class InstallerErrorMessage extends ErrorMessageBase |
|
30 { |
|
31 // Installation error codes. |
|
32 public static final int INST_NO_MEM = 1; |
|
33 public static final int INST_NO_NET = 2; |
|
34 public static final int INST_CORRUPT_PKG = 3; |
|
35 public static final int INST_COMPAT_ERR = 4; |
|
36 public static final int INST_AUTHORIZATION_ERR = 5; |
|
37 public static final int INST_AUTHENTICATION_ERR = 6; |
|
38 public static final int INST_PUSH_REG_ERR = 7; |
|
39 public static final int INST_UNEXPECTED_ERR = 8; |
|
40 public static final int INST_CANCEL = 9; |
|
41 |
|
42 // Uninstallation error codes. |
|
43 public static final int UNINST_NOT_ALLOWED = 101; |
|
44 public static final int UNINST_UNEXPECTED_ERR = 102; |
|
45 public static final int UNINST_CANCEL = 103; |
|
46 |
|
47 /** |
|
48 * Error codes for other than install and uninstall operations. |
|
49 * Do not use these error codes in installation or uninstallation. |
|
50 * These are only used in installer "list" and "test" commands. |
|
51 */ |
|
52 public static final int OTHER_UNEXPECTED_ERR = 201; |
|
53 |
|
54 /*** ----------------------------- PUBLIC ------------------------------ */ |
|
55 /*** ---------------------------- PROTECTED --------------------------- */ |
|
56 |
|
57 /** |
|
58 * Method for getting message table where key is an Integer value for |
|
59 * the error code, and value is an error message String id. |
|
60 */ |
|
61 private static Hashtable iMessageTable = null; |
|
62 protected Hashtable getMessageTable() |
|
63 { |
|
64 if (iMessageTable != null) |
|
65 { |
|
66 return iMessageTable; |
|
67 } |
|
68 Hashtable messageTable = new Hashtable(); |
|
69 messageTable.put(new Integer(INST_NO_MEM), "no_mem"); |
|
70 messageTable.put(new Integer(INST_NO_NET), "no_net"); |
|
71 messageTable.put(new Integer(INST_CORRUPT_PKG), "corrupt_pkg"); |
|
72 messageTable.put(new Integer(INST_COMPAT_ERR), "compat_err"); |
|
73 messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "authorization_err"); |
|
74 messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "authentication_err"); |
|
75 messageTable.put(new Integer(INST_PUSH_REG_ERR), "push_reg_err"); |
|
76 messageTable.put(new Integer(INST_UNEXPECTED_ERR), "unexpected"); |
|
77 messageTable.put(new Integer(INST_CANCEL), "cancel"); |
|
78 messageTable.put(new Integer(UNINST_NOT_ALLOWED), "uninst_not_allowed"); |
|
79 messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "uninst_unexpected"); |
|
80 messageTable.put(new Integer(UNINST_CANCEL), "uninst_cancel"); |
|
81 messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "other_unexpected"); |
|
82 iMessageTable = messageTable; |
|
83 return iMessageTable; |
|
84 } |
|
85 |
|
86 /** |
|
87 * Method for retrieving the ResourceLoader instance that is used |
|
88 * to localise error messages. |
|
89 */ |
|
90 private static ResourceLoader iRes = null; |
|
91 protected ResourceLoader getResourceLoader() |
|
92 { |
|
93 if (iRes == null) |
|
94 { |
|
95 iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_"); |
|
96 } |
|
97 return iRes; |
|
98 } |
|
99 |
|
100 /*** ----------------------------- PACKAGE ---------------------------- */ |
|
101 /*** ----------------------------- PRIVATE ---------------------------- */ |
|
102 /*** ----------------------------- NATIVE ----------------------------- */ |
|
103 } |