javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java
branchRCL_3
changeset 83 26b2b12093af
parent 60 6c158198356e
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 import com.nokia.mj.impl.utils.ResourceLoader;
    20 import com.nokia.mj.impl.utils.ResourceLoader;
    21 import java.util.Hashtable;
    21 import java.util.Hashtable;
    22 
    22 
    23 /**
    23 /**
    24  * Class defining Installer short error messages.
    24  * Class defining Installer short error messages.
       
    25  *
       
    26  * @author Nokia Corporation
       
    27  * @version 1.0
    25  */
    28  */
    26 public final class InstallerErrorMessage extends ErrorMessageBase
    29 public final class InstallerErrorMessage extends ErrorMessageBase
    27 {
    30 {
    28     // Installation error codes.
    31     // Installation error codes.
    29     public static final int INST_NO_MEM = 1 + ErrorMessageBase.INSTALLER_RANGE_START;
    32     public static final int INST_NO_MEM = 1;
    30     public static final int INST_NO_NET = 2 + ErrorMessageBase.INSTALLER_RANGE_START;
    33     public static final int INST_NO_NET = 2;
    31     public static final int INST_CORRUPT_PKG = 3 + ErrorMessageBase.INSTALLER_RANGE_START;
    34     public static final int INST_CORRUPT_PKG = 3;
    32     public static final int INST_COMPAT_ERR = 4 + ErrorMessageBase.INSTALLER_RANGE_START;
    35     public static final int INST_COMPAT_ERR = 4;
    33     public static final int INST_AUTHORIZATION_ERR = 5 + ErrorMessageBase.INSTALLER_RANGE_START;
    36     public static final int INST_AUTHORIZATION_ERR = 5;
    34     public static final int INST_AUTHENTICATION_ERR = 6 + ErrorMessageBase.INSTALLER_RANGE_START;
    37     public static final int INST_AUTHENTICATION_ERR = 6;
    35     public static final int INST_PUSH_REG_ERR = 7 + ErrorMessageBase.INSTALLER_RANGE_START;
    38     public static final int INST_PUSH_REG_ERR = 7;
    36     public static final int INST_UNEXPECTED_ERR = 8 + ErrorMessageBase.INSTALLER_RANGE_START;
    39     public static final int INST_UNEXPECTED_ERR = 8;
    37     public static final int INST_CANCEL = 9 + ErrorMessageBase.INSTALLER_RANGE_START;
    40     public static final int INST_CANCEL = 9;
    38 
    41 
    39     // Uninstallation error codes.
    42     // Uninstallation error codes.
    40     public static final int UNINST_NOT_ALLOWED = 10 + ErrorMessageBase.INSTALLER_RANGE_START;
    43     public static final int UNINST_NOT_ALLOWED = 101;
    41     public static final int UNINST_UNEXPECTED_ERR = 11 + ErrorMessageBase.INSTALLER_RANGE_START;
    44     public static final int UNINST_UNEXPECTED_ERR = 102;
    42     public static final int UNINST_CANCEL = 12 + ErrorMessageBase.INSTALLER_RANGE_START;
    45     public static final int UNINST_CANCEL = 103;
    43 
    46 
    44     /**
    47     /**
    45      * Error codes for other than install and uninstall operations.
    48      * Error codes for other than install and uninstall operations.
    46      * Do not use these error codes in installation or uninstallation.
    49      * Do not use these error codes in installation or uninstallation.
    47      * These are only used in installer "list" and "test" commands.
    50      * These are only used in installer "list" and "test" commands.
    48      */
    51      */
    49     public static final int OTHER_UNEXPECTED_ERR = 13 + ErrorMessageBase.INSTALLER_RANGE_START;
    52     public static final int OTHER_UNEXPECTED_ERR = 201;
    50 
    53 
    51     /*** ----------------------------- PUBLIC ------------------------------ */
    54     /*** ----------------------------- PUBLIC ------------------------------ */
    52     /*** ---------------------------- PROTECTED --------------------------- */
    55     /*** ---------------------------- PROTECTED --------------------------- */
    53 
    56 
    54     /**
    57     /**
    61         if (iMessageTable != null)
    64         if (iMessageTable != null)
    62         {
    65         {
    63             return iMessageTable;
    66             return iMessageTable;
    64         }
    67         }
    65         Hashtable messageTable = new Hashtable();
    68         Hashtable messageTable = new Hashtable();
    66         if (getLocaleIdQt() == null)
    69         messageTable.put(new Integer(INST_NO_MEM), "no_mem");
    67         {
    70         messageTable.put(new Integer(INST_NO_NET), "no_net");
    68             messageTable.put(new Integer(INST_NO_MEM), "no_mem");
    71         messageTable.put(new Integer(INST_CORRUPT_PKG), "corrupt_pkg");
    69             messageTable.put(new Integer(INST_NO_NET), "no_net");
    72         messageTable.put(new Integer(INST_COMPAT_ERR), "compat_err");
    70             messageTable.put(new Integer(INST_CORRUPT_PKG), "corrupt_pkg");
    73         messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "authorization_err");
    71             messageTable.put(new Integer(INST_COMPAT_ERR), "compat_err");
    74         messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "authentication_err");
    72             messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "authorization_err");
    75         messageTable.put(new Integer(INST_PUSH_REG_ERR), "push_reg_err");
    73             messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "authentication_err");
    76         messageTable.put(new Integer(INST_UNEXPECTED_ERR), "unexpected");
    74             messageTable.put(new Integer(INST_PUSH_REG_ERR), "push_reg_err");
    77         messageTable.put(new Integer(INST_CANCEL), "cancel");
    75             messageTable.put(new Integer(INST_UNEXPECTED_ERR), "unexpected");
    78         messageTable.put(new Integer(UNINST_NOT_ALLOWED), "uninst_not_allowed");
    76             messageTable.put(new Integer(INST_CANCEL), "cancel");
    79         messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "uninst_unexpected");
    77             messageTable.put(new Integer(UNINST_NOT_ALLOWED), "uninst_not_allowed");
    80         messageTable.put(new Integer(UNINST_CANCEL), "uninst_cancel");
    78             messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "uninst_unexpected");
    81         messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "other_unexpected");
    79             messageTable.put(new Integer(UNINST_CANCEL), "uninst_cancel");
       
    80             messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "other_unexpected");
       
    81         }
       
    82         else
       
    83         {
       
    84             messageTable.put(new Integer(INST_NO_MEM), "info_there_is_not_enough_space_currently");
       
    85             messageTable.put(new Integer(INST_NO_NET), "info_network_is_unavailable_currently");
       
    86             messageTable.put(new Integer(INST_CORRUPT_PKG), "info_installation_package_is_invalid");
       
    87             messageTable.put(new Integer(INST_COMPAT_ERR), "info_application_is_not_compatible_with");
       
    88             messageTable.put(new Integer(INST_AUTHORIZATION_ERR), "info_there_is_a_security_issue_with_this");
       
    89             messageTable.put(new Integer(INST_AUTHENTICATION_ERR), "info_there_is_a_security_issue_with_this");
       
    90             messageTable.put(new Integer(INST_PUSH_REG_ERR), "info_an_unexpected_error_occurred");
       
    91             messageTable.put(new Integer(INST_UNEXPECTED_ERR), "info_an_unexpected_error_occurred");
       
    92             messageTable.put(new Integer(INST_CANCEL), "info_application_not_installed");
       
    93             messageTable.put(new Integer(UNINST_NOT_ALLOWED), "info_application_cannot_be_deleted");
       
    94             messageTable.put(new Integer(UNINST_UNEXPECTED_ERR), "installer_info_uninstallation_failed");
       
    95             messageTable.put(new Integer(UNINST_CANCEL), "info_application_not_deleted");
       
    96             messageTable.put(new Integer(OTHER_UNEXPECTED_ERR), "info_an_unexpected_error_occurred");
       
    97         }
       
    98         iMessageTable = messageTable;
    82         iMessageTable = messageTable;
    99         return iMessageTable;
    83         return iMessageTable;
   100     }
    84     }
   101 
    85 
   102     /**
    86     /**
   106     private static ResourceLoader iRes = null;
    90     private static ResourceLoader iRes = null;
   107     protected ResourceLoader getResourceLoader()
    91     protected ResourceLoader getResourceLoader()
   108     {
    92     {
   109         if (iRes == null)
    93         if (iRes == null)
   110         {
    94         {
   111             if (getLocaleIdQt() == null)
    95             iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
   112             {
       
   113                 iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
       
   114             }
       
   115             else
       
   116             {
       
   117                 iRes = ResourceLoader.getInstance("common_errors", "txt_error_");
       
   118             }
       
   119         }
    96         }
   120         return iRes;
    97         return iRes;
   121     }
    98     }
   122 
    99 
   123     /*** ----------------------------- PACKAGE ---------------------------- */
   100     /*** ----------------------------- PACKAGE ---------------------------- */