FileDocCategorySizeDatePackage
ACLPermissions.javaAPI DocphoneME MR2 API (J2ME)5546Wed May 02 18:00:38 BST 2007com.sun.satsa.acl

ACLPermissions

public class ACLPermissions extends Object
This class represents a set of ACL permissions.

Fields Summary
public static final int
CMD_VERIFY
PIN operation constant.
public static final int
CMD_CHANGE
PIN operation constant.
public static final int
CMD_DISABLE
PIN operation constant.
public static final int
CMD_ENABLE
PIN operation constant.
public static final int
CMD_UNBLOCK
PIN operation constant.
public static final int
CMD_COUNT
The number of supported PIN commands.
static final int
CHECK
Flag that indicates that the object contains permissions.
static final int
ALLOW
Flag that indicates that MIDlet suite have full access.
static final int
DISALLOW
Flag that indicates that MIDlet suite have not access.
int
type
Verifier type.
Vector
permissions
The list of permissions.
private PINData[]
pins
Array of PIN data for this permission.
protected ACSlot
parent
Parent ACSlot object, contains PIN attributes.
protected PINAttributes
attr1
Attributes of the first PIN to be entered.
protected PINAttributes
attr2
Attributes of the second PIN or null.
Constructors Summary
public ACLPermissions(ACSlot parent)
Constructs new object.

param
parent parent ACSlot object.


                 
       
        this.parent = parent;
    
Methods Summary
protected voidcheckPINOperation(int pinID, int unblockPinID, int action)
Verifies that PIN operation is supported, finds PIN attributes.

param
pinID PIN identifier.
param
unblockPinID unblocking PIN identifier.
param
action PIN operation identifier.
exception
SecurityException if operation is not supported.


        if (pins == null) {
            throw new SecurityException();
        }

        boolean found = false;
        for (int i = 0; i < pins.length; i++) {
            found |= (pins[i].id == pinID);
        }
        attr1 = parent.getPINAttributes(pinID);

        if (! found || attr1 == null || ! attr1.check(action)) {
            throw new SecurityException();
        }

        if (action == CMD_UNBLOCK) {
            attr2 = parent.getPINAttributes(unblockPinID);
            if (attr2 == null || ! attr2.isUnblockingPIN()) {
                throw new SecurityException();
            }
        } else {
            attr2 = null;
        }
    
public java.lang.Object[]enterPIN(com.sun.midp.security.SecurityToken securityToken, int action)
Requests the user to enter the PIN value(s).

param
securityToken class security token.
param
action PIN operation identifier.
return
null if operation was cancelled or the array that contains byte array(s) with PIN value(s).


        PINEntryDialog dialog;
        try {
            dialog = new PINEntryDialog(securityToken, action, attr1,
                                        attr2);
        } catch (InterruptedException e) {
            throw new SecurityException("Interrupted");
        }

        dialog.waitForAnswer();

        return dialog.getPINs();
    
java.lang.ObjectgetPINCommand(int pinID, int action)
Get PIN command for specified ID and operation.

param
pinID PIN identifier.
param
action PIN operation identifier.
return
PIN data or null if not found.


        for (int i = 0; i < pins.length; i++) {
            if (pins[i].id == pinID && pins[i].commands[action] != null) {
                return pins[i].commands[action];
            }
        }
        return null;
    
public voidsetPINData(PINData[] data)
Set PIN data for this permission.

param
data PIN data for this permission.

        pins = data;
    
public voidsetPermissions(java.util.Vector permissions)
Set the list of permissions.

param
permissions the list of permissions.

        this.permissions = permissions;
    
public voidsetType(int type)
Set type of the permission.

param
type permission type.

        this.type = type;