javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
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 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".
    32 {
    32 {
    33     public void execute(ExeBall aBall)
    33     public void execute(ExeBall aBall)
    34     {
    34     {
    35         InstallBall ball = (InstallBall)aBall;
    35         InstallBall ball = (InstallBall)aBall;
    36 
    36 
    37         // If any Jsr plugins, notify plugins.
    37         // If any Jsr plugins, notify plugins
    38         if (ball.iJsrPluginNotifier.anyJsrPlugins())
    38         if (ball.iJsrPluginNotifier.anyJsrPlugins())
    39         {
    39         {
    40             ball.iJsrPluginNotifier.notifyInstallation(
    40             // Create info object to be passed to plugins
    41                 createInstallerExtensionInfo(ball));
    41             InstallerExtensionInfo info = new InstallerExtensionInfo();
       
    42             info.iUid = ball.iSuite.getUid();
       
    43             info.iUpgrade = (ball.iOldSuite != null);
       
    44             info.iSilent = ball.isSilent();
       
    45             info.iAttributes = ball.iCombinedAttributes;
       
    46 
       
    47             ball.iJsrPluginNotifier.notifyInstallation(info);
    42         }
    48         }
    43     }
    49     }
    44 
    50 
    45     public void cancel(ExeBall aBall)
    51     public void cancel(ExeBall aBall)
    46     {
    52     {
    47         InstallBall ball = (InstallBall)aBall;
    53         InstallBall ball = (InstallBall)aBall;
    48 
    54 
    49         // Notify possible plugins that installation has been cancelled.
    55         // Notify possible plugins that installation can been cancelled
    50         if (ball.iJsrPluginNotifier.anyJsrPlugins())
    56         if (ball.iJsrPluginNotifier.anyJsrPlugins())
    51         {
    57         {
    52             ball.iJsrPluginNotifier.notifyRollbackInstall(
    58             // Create info object to be passed to plugins
    53                 createInstallerExtensionInfo(ball));
    59             InstallerExtensionInfo info = new InstallerExtensionInfo();
       
    60             // Beware, it is possible that aBall has not been fully
       
    61             // initialized
       
    62             if (null == ball.iSuite)
       
    63             {
       
    64                 info.iUid = null;
       
    65             }
       
    66             else
       
    67             {
       
    68                 info.iUid = ball.iSuite.getUid();
       
    69             }
       
    70             info.iUpgrade = (ball.iOldSuite != null);
       
    71             info.iSilent = ball.isSilent();
       
    72             info.iAttributes = ball.iCombinedAttributes;
       
    73 
       
    74             ball.iJsrPluginNotifier.notifyRollbackInstall(info);
    54         }
    75         }
    55     }
    76     }
    56 
       
    57     private InstallerExtensionInfo createInstallerExtensionInfo(InstallBall aBall)
       
    58     {
       
    59         InstallerExtensionInfo info = new InstallerExtensionInfo();
       
    60         // Beware, it is possible that aBall has not been fully initialized.
       
    61         if (aBall.iSuite != null)
       
    62         {
       
    63             info.iUid = aBall.iSuite.getUid();
       
    64             info.iAppUids = aBall.iSuite.getApplicationUids();
       
    65             info.iRootPath = aBall.iSuite.getRootDir();
       
    66         }
       
    67         info.iUpgrade = (aBall.iOldSuite != null);
       
    68         info.iSilent = aBall.isSilent();
       
    69         info.iAttributes = aBall.iCombinedAttributes;
       
    70         if (aBall.iStorageHandler != null)
       
    71         {
       
    72             info.iStorageSession = aBall.iStorageHandler.getSession();
       
    73         }
       
    74         return info;
       
    75     }
       
    76 }
    77 }