Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR 217 (Maintenance Release)

javax.microedition.xlet.ixc
Class IxcPermission

java.lang.Object
  extended byjava.security.Permission
      extended byjavax.microedition.xlet.ixc.IxcPermission
All Implemented Interfaces:
Guard, Serializable

public final class IxcPermission
extends Permission

This class represents access to the inter-xlet communication registry. An IxcPermission consists of a name specification and a set of actions specifying what can be done with those names.

The name specification is the name passed into the IxcRegistry methods such as bind() and lookup(). The names are simple strings; this specification does not impose any special meaning on these strings, such as name canonicalization. Limited wildcarding is allowed at the end of a name string. The name string of length one "*" will match any name. At the end of a string, the special sequence "/*" will match forward-slash followed by any other characters. Otherwise, all characters are simply matched. For example:

The actions to be granted are passed to the constructor in a string containing a list of one or more comma-seperated keywords. The possible keywords are "bind" and "lookup". See the methods on IxcRegistry for a detailed explanation of the meaning of these.

The actions string is converted to lowercase before processing.

See Also:
IxcRegsitry

Constructor Summary
IxcPermission(String name, String actions)
          Creates a new IxcPermission object with the specified name and actions.
 
Method Summary
 boolean equals(Object other)
          Checks two IxcPermission objects for equality.
 String getActions()
          Returns the "canonical string representation" of the actions.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(Permission p)
          Checks if this IxcPermission "implies" the specified permission.
 PermissionCollection newPermissionCollection()
          Returns a new PermissionCollection object for storing IxcPermission objects.
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IxcPermission

public IxcPermission(String name,
                     String actions)
Creates a new IxcPermission object with the specified name and actions. The name specification is the name passed into the IxcRegistry methods such as bind() and lookup(). See the class description for the specification of the name string.

The actions to be granted are passed to the constructor in a string containing a list of one or more comma-seperated keywords. The possible keywords are "bind" and "lookup". See the methods on IxcRegistry for a detailed explanation of the meaning of these.

The actions string is converted to lowercase before processing.

Parameters:
name - The name specification for exported/imported objects
actions - The action string
Method Detail

implies

public boolean implies(Permission p)
Checks if this IxcPermission "implies" the specified permission.

More specifically, this method returns true if:

Specified by:
implies in class Permission
Parameters:
p - the permission to check against
Returns:
true if the specified permission is implied by this object, false if not.

equals

public boolean equals(Object other)
Checks two IxcPermission objects for equality. Check that other is an IxcPermission, and has the same name and actions as this object.

Specified by:
equals in class Permission
Parameters:
other - the object we are testing for equality with this object
Returns:
true if obj is an IxcPermission, and has the same name and actions as this IxcPermission object.

hashCode

public int hashCode()
Returns the hash code value for this object.

Specified by:
hashCode in class Permission
Returns:
a hash code value for this object.

getActions

public String getActions()
Returns the "canonical string representation" of the actions. That is, this method always returns present actions in the following order: bind, lookup. For example, if this IxcPermission object allows both bind and lookup actions, a call to getActions will return the string "bind,lookup".

Specified by:
getActions in class Permission
Returns:
the canonical string representation of the actions

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a new PermissionCollection object for storing IxcPermission objects.

IxcPermission objects must be stored in a manner that allows them to be inserted into the collection in any order, but that also enables the PermissionCollection implies method to be implemented in an efficient (and consistent) manner.

For example, if you have two IxcPermission objects:
    "/1234/*", "lookup"
    "/1234/5678/*", "bind"
and you are calling the implies method with the IxcPermission:
    "/1234/5678/foo", "bind,lookup",
then the implies method must take into account both the "/1234/*" and "/1234/5678/*" permissions, so the effective permission is "bind,lookup" and implies returns true. The "implies" semantics for IxcPermissions are handled properly by the permission collection object returned by this newPermissionCollection method.

Overrides:
newPermissionCollection in class Permission
Returns:
a new PermissionCollection object suitable for storing IxcPermissions.

JSR 217 (Maintenance Release)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 217 specification.