javaruntimes/midp/runtime/javasrc.cdc/com/nokia/mj/impl/rt/main/ApplicationInfoImpl.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:07:20 +0300
branchRCL_3
changeset 24 0fd27995241b
parent 19 04becd199f91
permissions -rw-r--r--
Revision: v2.1.24 Kit: 201019

/*
* Copyright (c) 2010 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.rt.main;

import java.util.Hashtable;

import com.nokia.mj.impl.utils.Uid;
import com.nokia.mj.impl.rt.support.ApplicationInfo;

/**
 * A Main runtime specific implementation of ApplicationInfo class of the
 * runtime support API.
 */

public class ApplicationInfoImpl extends ApplicationInfo
{
    /**
     * For storing the MIDlet specific info.
     */
    private static Uid       sAppUid;
    private static String    sAppName;
    private static Hashtable sManifestArgs;
    private static String    sRootPath;

    /*** ----------------------------- PACKAGE ---------------------------- */

    static void setUid(Uid appUid)
    {
        sAppUid = appUid;
    }

    static void setName(String appName)
    {
        sAppName = appName;
    }

    static void setManifestArgs(Hashtable manifestArgs)
    {
        sManifestArgs = manifestArgs;
    }
    static void setRootPath(String rootPath)
    {
        sRootPath = rootPath;
    }

    /*** ----------------------------- PUBLIC ------------------------------ */

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getRuntimeType().
     */
    public String getRuntimeType()
    {
        return ApplicationInfo.RUNTIME_NON_MANAGED;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getProtectionDomain().
     */
    public String getProtectionDomain()
    {
        return ApplicationInfo.MANUFACTURER_DOMAIN;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getUid().
     */
    public Uid getUid()
    {
        return sAppUid;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getSuiteUid().
     */
    public Uid getSuiteUid()
    {
        return sAppUid;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getSuiteName().
     */
    public String getSuiteName()
    {
        return sAppName;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getName().
     */
    public String getName()
    {
        return sAppName;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getVendor().
     */
    public String getVendor()
    {
        throw new RuntimeException("getVendor() is not supported!");
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getVersion().
     */
    public String getVersion()
    {
        throw new RuntimeException("getVendor() is not supported!");
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getRootPath().
     */
    public String getRootPath()
    {
        return sRootPath;
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getMainClass().
     */
    public String getMainClass()
    {
        throw new RuntimeException("getMainClass() is not supported!");
    }

    /**
     * @see com.nokia.mj.impl.rt.support.ApplicationInfo#
     *      getAttribute(java.lang.String).
     */
    public String getAttribute(String key)
    {
        if (sManifestArgs != null)
        {
            return (String)sManifestArgs.get(key);
        }
        return null;
    }
}