IxcPermission

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.microedition.xlet.ixc
Class IxcPermission

    java.lang.Object
      java.security.Permission
          javax.microedition.xlet.ixc.IxcPermission

All Implemented Interfaces:
  Serializable, Guard

    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:

- "*" as the entire name string will match any other string
- "xlet:/1a/2b/*" ends in a wildcard, and will match any string that begins with "xlet:/1a/2b/", e.g. "xlet:/1a/2b/foo", "xlet:/1a/2b/3c/foo" or "xlet:/1a/2b/". It will not match "xlet://1a/2b/" or "xlet:/1a/2b".
- "*foo" does not contain a wildcard, and will only match the string "*foo".
- "foo*" does not contain a wildcard, and will only match the string "foo*".
- "a*b" does not contain a wildcard, and will only match the string "a*b"
- "/a/*/b" does not contain a wildcard, and will only match the string "/a/*/b"

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
`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:

  - p is an instanceof IxcPermission
  - p's actions are a proper subset of this object's actions, and
  - p's pathname is implied by this object's pathname. For example, "/1234/*" implies "/1234/5678", since "/*" is a wildcard for strings containing "/" followed by any other characters.

  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.
  See Also:
    `Object.hashCode()`, `Hashtable`

### 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.
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD