javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/TestPlugin2.java
changeset 79 2f468c1958d0
parent 23 98ccebc37403
child 87 1627c337e51e
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 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".
    45                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null))
    45                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null))
    46         {
    46         {
    47             return false;
    47             return false;
    48         }
    48         }
    49 
    49 
       
    50         // If the MIDlet to be installed has JAD/JAR attribute
       
    51         // "JSR-Plugin-Test-Exception" with any value, throw Exception
       
    52         if ((aInstallerExtensionInfo.iAttributes != null) &&
       
    53                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Exception") != null))
       
    54         {
       
    55             throw new RuntimeException("TestPlugin2.install Exception");
       
    56         }
       
    57 
    50         return true;
    58         return true;
    51     }
    59     }
    52 
    60 
    53     /**
    61     /**
    54      * This method is called when uninstallation is starting
    62      * This method is called when uninstallation is starting
    62         aInstallerExtensionInfo.log("TestPlugin2.uninstall called");
    70         aInstallerExtensionInfo.log("TestPlugin2.uninstall called");
    63 
    71 
    64         // tell that this plugin has been called
    72         // tell that this plugin has been called
    65         System.setProperty("TestPlugin2", "uninstall");
    73         System.setProperty("TestPlugin2", "uninstall");
    66 
    74 
    67         // If the MIDlet to be installed has JAD/JAR attribute
    75         // If the MIDlet to be uninstalled has JAD/JAR attribute
    68         // "JSR-Plugin-Test-Cancel" with any value, cancel install
    76         // "JSR-Plugin-Test-Cancel" with any value, cancel install
    69         if ((aInstallerExtensionInfo.iAttributes != null) &&
    77         if ((aInstallerExtensionInfo.iAttributes != null) &&
    70                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null))
    78                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Cancel") != null))
    71         {
    79         {
    72             return false;
    80             return false;
       
    81         }
       
    82 
       
    83         // If the MIDlet to be uninstalled has JAD/JAR attribute
       
    84         // "JSR-Plugin-Test-Exception" with any value, throw Exception
       
    85         if ((aInstallerExtensionInfo.iAttributes != null) &&
       
    86                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Exception") != null))
       
    87         {
       
    88             throw new RuntimeException("TestPlugin2.uninstall Exception");
    73         }
    89         }
    74 
    90 
    75         return true;
    91         return true;
    76     }
    92     }
    77 
    93 
    86     {
   102     {
    87         aInstallerExtensionInfo.log("TestPlugin2.rollbackInstall called");
   103         aInstallerExtensionInfo.log("TestPlugin2.rollbackInstall called");
    88 
   104 
    89         // tell that this plugin has been called
   105         // tell that this plugin has been called
    90         System.setProperty("TestPlugin2", "rollbackInstall");
   106         System.setProperty("TestPlugin2", "rollbackInstall");
       
   107 
       
   108         // If the MIDlet to be installed has JAD/JAR attribute
       
   109         // "JSR-Plugin-Test-Exception" with any value, throw Exception
       
   110         if ((aInstallerExtensionInfo.iAttributes != null) &&
       
   111                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Exception") != null))
       
   112         {
       
   113             throw new RuntimeException("TestPlugin2.rollbackInstall Exception");
       
   114         }
    91     }
   115     }
    92 
   116 
    93     /**
   117     /**
    94      * Called when uninstallation has failed and will be rolled back.
   118      * Called when uninstallation has failed and will be rolled back.
    95      * Can be called after uninstall() has been called.
   119      * Can be called after uninstall() has been called.
   100     {
   124     {
   101         aInstallerExtensionInfo.log("TestPlugin2.rollbackUninstall called");
   125         aInstallerExtensionInfo.log("TestPlugin2.rollbackUninstall called");
   102 
   126 
   103         // tell that this plugin has been called
   127         // tell that this plugin has been called
   104         System.setProperty("TestPlugin2", "rollbackUninstall");
   128         System.setProperty("TestPlugin2", "rollbackUninstall");
       
   129 
       
   130         // If the MIDlet to be uninstalled has JAD/JAR attribute
       
   131         // "JSR-Plugin-Test-Exception" with any value, throw Exception
       
   132         if ((aInstallerExtensionInfo.iAttributes != null) &&
       
   133                 (aInstallerExtensionInfo.iAttributes.get("JSR-Plugin-Test-Exception") != null))
       
   134         {
       
   135             throw new RuntimeException("TestPlugin2.rollbackUninstall Exception");
       
   136         }
   105     }
   137     }
   106 }
   138 }