ServiceContextPermission

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.tv.service.selection
Class ServiceContextPermission

    java.lang.Object
      java.security.Permission
          java.security.BasicPermission
              javax.tv.service.selection.ServiceContextPermission

All Implemented Interfaces:
  Serializable, Guard

    public final class ServiceContextPermission

extends BasicPermission

`ServiceContextPermission` represents permission to control a `ServiceContext`. A `ServiceContextPermission` contains a name (also referred to as a "target name") and an actions string.

The target name is the name of the service context permission (see the table below). Each permission identifies a method. A wildcard match is signified by an asterisk, i.e., "*".

The actions string is either "own" or "*". From a security standpoint, a caller is said to "own" a `ServiceContext` instance if it was acquired through `ServiceContextFactory.createServiceContext()` or `ServiceContextFactory.getServiceContext(javax.tv.xlet.XletContext)`. The string "own" means the permission applies to your own service contexts; the string "*" implies permission to these, plus permission for service contexts obtained from all other sources.

The following table lists all the possible `ServiceContextPermission` target names, and describes what the permission allows for each.

Permission Target Name | What the Permission Allows
--- | ---
access | Access to a `ServiceContext`, via `ServiceContextFactory.getServiceContexts()`
create | Creation of a `ServiceContext`.
destroy | Destruction of a `ServiceContext`.
getServiceContentHandlers | Obtaining the service content handlers from a `ServiceContext`.
stop | Stopping a `ServiceContext`.

The permission ServiceContextPermission("access", "*") is intended to be granted only to special monitoring applications and not to general broadcast applications.

Note that undefined target and actions strings may be provided to the constructors of this class, but subsequent calls to `SecurityManager.checkPermission()` with the resulting `SelectPermission` object will fail.

Version:
  1.23, 10/09/00
Author:
  Bill Foote
See Also:
  `BasicPermission`, `Permission`, `ServiceContext`, `ServiceContextFactory`, Serialized Form

Constructor Summary
`ServiceContextPermission(String name, String actions)` Creates a new ServiceContextPermission object with the specified name.

Method Summary
`boolean` | `equals(Object obj)` Tests two `ServiceContextPermission` objects for equality.
`String` | `getActions()` Returns the canonical representation of the actions string.
`int` | `hashCode()` Provides the hash code value of this object.
`boolean` | `implies(Permission p)` Checks if the specified permission is "implied" by this object.

Methods inherited from class java.security.BasicPermission
`newPermissionCollection`

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

### ServiceContextPermission

    public ServiceContextPermission(String name,
                                    String actions)

  Creates a new ServiceContextPermission object with the specified name. The name is the symbolic name of the permission, such as "create". An asterisk may be used to signify a wildcard match.

  Parameters:
    `name` - The name of the `ServiceContextPermission`
    `actions` - The actions string, as detailed in the class description.

Method Detail

### implies

    public boolean implies(Permission p)

  Checks if the specified permission is "implied" by this object.

  More specifically, this method returns true if:

  - p is an instance of ServiceContextPermission, and
  - p's action string matches this object's, or this object has "*" as an action string, and
  - p's locator's external form matches this object's locator string, or this object's locator string is "*".

  Overrides:
    `implies` in class `BasicPermission`
  Parameters:
    `p` - The permission against which to test.
  Returns:
    `true` if the specified permission is equal to or implied by this permission; `false` otherwise.

### equals

    public boolean equals(Object obj)

  Tests two `ServiceContextPermission` objects for equality. Returns `true` if and only if `obj`'s class is the same as the class of this object, and `obj` has the same name and actions string as this object.

  Overrides:
    `equals` in class `BasicPermission`
  Parameters:
    `obj` - The object to test for equality.
  Returns:
    `true` if the two permissions are equal; `false` otherwise.
  See Also:
    `Object.hashCode()`, `Hashtable`

### hashCode

    public int hashCode()

  Provides the hash code value of this object. Two `ServiceContextPermission` objects that are equal will return the same hash code.

  Overrides:
    `hashCode` in class `BasicPermission`
  Returns:
    The hash code value of this object.
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

### getActions

    public String getActions()

  Returns the canonical representation of the actions string.

  Overrides:
    `getActions` in class `BasicPermission`
  Returns:
    The actions string of this permission.

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

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