javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/RegisterApplicationToSif.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 14:23:59 +0300
branchRCL_3
changeset 83 26b2b12093af
parent 60 6c158198356e
permissions -rw-r--r--
Revision: v2.2.17 Kit: 201041

/*
* Copyright (c) 2008-2009 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.install.steps;

import com.nokia.mj.impl.installer.exetable.ExeBall;
import com.nokia.mj.impl.installer.exetable.ExeStep;
import com.nokia.mj.impl.installer.utils.Log;

import java.util.Vector;

/**
 * MIDP installation step RegisterApplicationToSif.
 */
public class RegisterApplicationToSif extends ExeStep
{
    public void execute(ExeBall aBall)
    {
        InstallBall ball = (InstallBall)aBall;

        if (ball.iOldSuite != null)
        {
            // Old suite exists, unregister it first.
            ball.iSifRegistrator.unregisterSuite(ball.iOldSuite);
            Log.log("Old suite unregistered from SIF");
        }

        if (ball.iSourceUrl != null)
        {
            // Save source URL to suite as jad URL which is
            // registered to SIF as download URL.
            ball.iSuite.setJadUrl(ball.iSourceUrl);
        }

        // Initialize application installation group to SuiteInfo.
        // Note that ball.iInstallationGroup is initialized
        // in RegisterApplication step, so it must be executed
        // before this step.
        ball.iSuite.setInstallationGroup(ball.iInstallationGroup);

        // Register the applications in the suite.
        ball.iSifRegistrator.registerSuite(
            ball.iSuite, ball.iOldSuite != null);
        Log.log("Suite registered to SIF");

        // Log the registered suite and applications.
        ball.iSifRegistrator.logComponent(ball.iSuite.getGlobalId());
        Vector apps = ball.iSuite.getApplications();
        for (int i = 0; i < apps.size(); i++)
        {
            ball.iSifRegistrator.logComponent(ball.iSuite.getGlobalId(i));
        }
    }

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