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>
Wed, 23 Jun 2010 18:07:10 +0300
changeset 47 f40128debb5d
parent 21 2a9601315dfc
child 83 26b2b12093af
permissions -rw-r--r--
Revision: v2.2.2 Kit: 2010125

/*
* 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"));

        // Check from arguments if preinstall state should be reset.
        String arg = ball.iArgs.get("resetpreinstall");
        if (arg != null)
        {
            ball.iSuite.setResetPreinstall(true);
            ball.log("ResetPreinstall set");
        }


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

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