javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/GetFromStorage.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:27:20 +0300
changeset 21 2a9601315dfc
child 47 f40128debb5d
permissions -rw-r--r--
Revision: v2.1.22 Kit: 201018

/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/


package com.nokia.mj.impl.installer.midp2.uninstall.steps;

import com.nokia.mj.impl.installer.exetable.ExeBall;
import com.nokia.mj.impl.installer.exetable.ExeStep;
import com.nokia.mj.impl.installer.storagehandler.SuiteInfo;
import com.nokia.mj.impl.installer.utils.InstallerException;
import com.nokia.mj.impl.installer.utils.Log;
import com.nokia.mj.impl.utils.Uid;

public class GetFromStorage extends ExeStep
{
    public void execute(ExeBall aBall)
    {
        UninstallBall ball = (UninstallBall)aBall;
        ball.log("Reading storage...");

        // Check if application suite can be found from storage.
        Uid uid = ball.iStorageHandler.getSuiteUid(ball.iUid);
        if (uid == null)
        {
            // Suite not found.
            InstallerException.internalError
            ("Application with uid " +
             ball.iUid + " not found from JavaStorage");
        }

        ball.iSuite = new SuiteInfo(uid);
        if (!ball.iStorageHandler.readSuiteInfo(ball.iSuite))
        {
            // Suite could not be read.
            InstallerException.internalError
            ("Reading suite with uid " +
             uid + " from JavaStorage failed");
        }

        // Check if debug attribute has been defined for this suite.
        ball.setDebug(ball.iSuite.getAttributeValue("Nokia-MIDlet-Install-Debug"));

        // Log all suite info.
        //ball.log(ball.iSuite.toString());
    }

    public void cancel(ExeBall aBall)
    {
        // nop
    }
}