javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/utils/CmdLineArgsPermission.java
branchRCL_3
changeset 19 71c436fe3ce0
child 25 ae942d28ec0e
equal deleted inserted replaced
18:9ac0a0a7da70 19:71c436fe3ce0
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Permission object for managing access to command line API feature
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 package com.nokia.mj.impl.rt.utils;
       
    21 
       
    22 import java.security.Permission;
       
    23 import java.security.PermissionCollection;
       
    24 import com.nokia.mj.impl.security.common.PermissionBase;
       
    25 import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
       
    26 
       
    27 /**
       
    28  * Permission class representing the token access to command line API feature.
       
    29  *
       
    30  */
       
    31 public class CmdLineArgsPermission extends PermissionBase
       
    32 {
       
    33     /**
       
    34      * Constructor
       
    35      *
       
    36      */
       
    37     public CmdLineArgsPermission()
       
    38     {
       
    39         super(null);
       
    40     }
       
    41 
       
    42     /**
       
    43      * Returns the question (as localized text) associated with the security
       
    44      * prompt
       
    45      *
       
    46      * @return the localized text associated with the security prompt
       
    47      */
       
    48     public String getSecurityPromptQuestion(int aInteractionMode)
       
    49     {
       
    50         return (SecurityPromptMessage.getInstance()).getText(
       
    51             SecurityPromptMessage.QUESTION_ID_APP_AUTO_LAUNCH,
       
    52             null);
       
    53     }
       
    54 
       
    55     /**
       
    56      * Only implies permission objects of same instance
       
    57      */
       
    58     public boolean implies(Permission p)
       
    59     {
       
    60         if (p instanceof CmdLineArgsPermission)
       
    61         {
       
    62             return true;
       
    63         }
       
    64         return false;
       
    65     }
       
    66 
       
    67     /**
       
    68      * String representation of the permission
       
    69      */
       
    70     public String toString()
       
    71     {
       
    72         return "com.nokia.webstart";
       
    73     }
       
    74     
       
    75     /**
       
    76      * Don't allow cloning
       
    77      */
       
    78     public boolean equals(Object obj)
       
    79     {
       
    80         return (obj.hashCode() == hashCode());
       
    81     }
       
    82 
       
    83     /**
       
    84      * Not supported
       
    85      */
       
    86     public int hashCode()
       
    87     {
       
    88         return 0;
       
    89     }
       
    90 
       
    91     /**
       
    92      * Actions are not supported
       
    93      */
       
    94     public String getActions()
       
    95     {
       
    96         return null;
       
    97     }
       
    98 
       
    99     /**
       
   100      * Permission collections not supported
       
   101      */
       
   102     public PermissionCollection newPermissionCollection()
       
   103     {
       
   104         return null;
       
   105     }
       
   106 }