FileDocCategorySizeDatePackage
TrustedMIDletSuiteInfo.javaAPI DocphoneME MR2 API (J2ME)9394Wed May 02 18:00:04 BST 2007com.sun.midp.jump.installer

TrustedMIDletSuiteInfo

public class TrustedMIDletSuiteInfo extends Object implements com.sun.midp.midlet.MIDletSuite
A proxy for InternalMIDletSuiteImpl to bypass the security check. Used by the JUMP exective to bypass NullPointerException thrown at various ams secuirty check code through MIDletStateHandler like listed below. See JumpInit.init() for the code that sets MIDletStateHandler.java's MIDletSuite field value. MIDletStateHandler midletStateHandler = MIDletStateHandler.getMidletStateHandler(); MIDletSuite midletSuite = midletStateHandler.getMIDletSuite(); midletSuite.checkIfPermissionAllowed(Permissions.AMS); This is a temporary fix until the security architecture in ams s replaced with more CDC centric AccessController syntax.

Fields Summary
com.sun.midp.midlet.MIDletSuite
suite
Constructors Summary
public TrustedMIDletSuiteInfo()

       suite = InternalMIDletSuiteImpl.create("executive", 0);
    
Methods Summary
public voidcheckForPermission(int permission, java.lang.String resource, java.lang.String extraValue)
Checks for permission and throw an exception if not allowed. May block to ask the user a question.

param
permission ID of the permission to check for, the ID must be from {@link com.sun.midp.security.Permissions}
param
resource string to insert into the question, can be null if no %2 in the question
param
extraValue string to insert into the question, can be null if no %3 in the question
exception
SecurityException if the permission is not allowed by this token
exception
InterruptedException if another thread interrupts the calling thread while this method is waiting to preempt the display.

        suite.checkForPermission(permission, resource, extraValue);
    
public voidcheckForPermission(int permission, java.lang.String resource)
Check for permission and throw an exception if not allowed. May block to ask the user a question.

param
permission ID of the permission to check for, the ID must be from {@link com.sun.midp.security.Permissions}
param
resource string to insert into the question, can be null if no %2 in the question
exception
SecurityException if the permission is not allowed by this token
exception
InterruptedException if another thread interrupts the calling thread while this method is waiting to preempt the display.

        suite.checkForPermission(permission, resource);
    
public voidcheckIfPermissionAllowed(int permission)

       return;  // trusted, don't throw SecurityException.
    
public intcheckPermission(java.lang.String permission)
Get the status of the specified permission. If no API on the device defines the specific permission requested then it must be reported as denied. If the status of the permission is not known because it might require a user interaction then it should be reported as unknown.

param
permission to check if denied, allowed, or unknown.
return
0 if the permission is denied; 1 if the permission is allowed; -1 if the status is unknown

        return suite.checkPermission(permission);
    
public voidclose()
Close the opened MIDletSuite

        suite.close();
    
public intgetID()
Gets the unique ID of the suite.

return
suite ID

        return suite.getID();
    
public java.lang.StringgetMIDletName(java.lang.String className)
Get the name of a MIDlet to display to the user.

param
className classname of a MIDlet in the suite
return
name to display to the user

        return suite.getMIDletName(className);
    
public byte[]getPermissions()
Gets list of permissions for this suite.

return
array of permissions from {@link Permissions}

        return suite.getPermissions();
    
public java.lang.StringgetProperty(java.lang.String key)
Get a property of the suite. A property is an attribute from either the application descriptor or JAR Manifest.

param
key the name of the property
return
A string with the value of the property. null is returned if no value is available for the key.

       return suite.getProperty(key);
    
public bytegetPushInterruptSetting()
Gets push setting for interrupting other MIDlets. Reuses the Permissions.

return
push setting for interrupting MIDlets the value will be permission level from {@link Permissions}

       return suite.getPushInterruptSetting();
    
public intgetPushOptions()
Gets push options for this suite.

return
push options are defined in {@link PushRegistryImpl}

        return suite.getPushOptions();
    
public booleanisEnabled()
Determine if the a MIDlet from this suite can be run. Note that disable suites can still have their settings changed and their install info displayed.

return
true if suite is enabled, false otherwise

        return suite.isEnabled();
    
public booleanisRegistered(java.lang.String midletClassName)
Indicates if the named MIDlet is registered in the suite with MIDlet-<n> record in the manifest or application descriptor.

param
midletClassName class name of the MIDlet to be checked
return
true if the MIDlet is registered

        return suite.isRegistered(midletClassName);
    
public booleanisTrusted()
Indicates if this suite is trusted. (not to be confused with a domain named "trusted", this is used for extra checks beyond permission checking)

return
true if the suite is trusted false if not

        return suite.isTrusted();
    
public booleanisVerified()
Check whether the suite classes are preverified and the suite content hasn't been changed since installation

return
true if no more verification needed, false otherwise

        return suite.isVerified();
    
public booleanpermissionToInterrupt(java.lang.String connection)
Ask the user want to interrupt the current MIDlet with a new MIDlet that has received network data.

param
connection connection to place in the permission question or null for alarm
return
true if the use wants interrupt the current MIDlet, else false

        return suite.permissionToInterrupt(connection);
    
public voidsetTempProperty(com.sun.midp.security.SecurityToken token, java.lang.String key, java.lang.String value)
Replace or add a property to the suite for this run only.

param
token token with the AMS permission set to allowed, can be null to use the suite's permission
param
key the name of the property
param
value the value of the property
exception
SecurityException if the caller's token does not have internal AMS permission

        suite.setTempProperty(token, key, value);