Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| OSGi Service Platform Release 3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.osgi.framework
Class ServicePermission

    java.lang.Object
      |
      +--java.security.Permission
            |
            +--java.security.BasicPermission
                  |
                  +--org.osgi.framework.ServicePermission

All Implemented Interfaces:
  java.security.Guard, java.io.Serializable

public final class ServicePermission
extends java.security.BasicPermission

Indicates a bundle's authority to register or get a service.

- The `ServicePermission.REGISTER` action allows a bundle to register a service on the specified names.
- The `ServicePermission.GET` action allows a bundle to detect a service and get it.

Permission to get a service is required in order to detect events regarding the service. Untrusted bundles should not be able to detect the presence of certain services unless they have the appropriate `ServicePermission` to get the specific service.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `GET` The action string `get` (Value is "get").
`static java.lang.String` | `REGISTER` The action string `register` (Value is "register").

Constructor Summary
`ServicePermission(java.lang.String name, java.lang.String actions)` Create a new ServicePermission.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Determines the equalty of two ServicePermission objects.
`java.lang.String` | `getActions()` Returns the canonical string representation of the actions.
`int` | `hashCode()` Returns the hash code value for this object.
`boolean` | `implies(java.security.Permission p)` Determines if a `ServicePermission` object "implies" the specified permission.
`java.security.PermissionCollection` | `newPermissionCollection()` Returns a new `PermissionCollection` object for storing `ServicePermission`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`

Field Detail

### GET

    public static final java.lang.String GET

  The action string `get` (Value is "get").

### REGISTER

    public static final java.lang.String REGISTER

  The action string `register` (Value is "register").

Constructor Detail

### ServicePermission

    public ServicePermission(java.lang.String name,
                             java.lang.String actions)

  Create a new ServicePermission.

  The name of the service is specified as a fully qualified class name.

       ClassName ::= <class name> | <class name ending in ".*">

  Examples:

          org.osgi.service.http.HttpService
          org.osgi.service.http.*
          org.osgi.service.snmp.*

  There are two possible actions: `get` and `register`. The `get` permission allows the owner of this permission to obtain a service with this name. The `register` permission allows the bundle to register a service under that name.

  Parameters:
    `name` - class name
    `actions` - `get`, `register` (canonical order)

Method Detail

### implies

    public boolean implies(java.security.Permission p)

  Determines if a `ServicePermission` object "implies" the specified permission.
  Overrides:
    `implies` in class `java.security.BasicPermission`
  Parameters:
    `p` - The target permission to check.
  Returns:
    `true` if the specified permission is implied by this object; `false` otherwise.

### getActions

    public java.lang.String getActions()

  Returns the canonical string representation of the actions. Always returns present actions in the following order: `get`, `register`.
  Overrides:
    `getActions` in class `java.security.BasicPermission`
  Returns:
    The canonical string representation of the actions.

### newPermissionCollection

    public java.security.PermissionCollection newPermissionCollection()

  Returns a new `PermissionCollection` object for storing `ServicePermission`objects.``
  Overrides:
    `newPermissionCollection` in class `java.security.BasicPermission`
  Returns:
    A new `PermissionCollection` object suitable for storing `ServicePermission` objects.

### equals

    public boolean equals(java.lang.Object obj)

  Determines the equalty of two ServicePermission objects. Checks that specified object has the same class name and action as this `ServicePermission`.
  Overrides:
    `equals` in class `java.security.BasicPermission`
  Parameters:
    `obj` - The object to test for equality.
  Returns:
    true if obj is a `ServicePermission`, and has the same class name and actions as this `ServicePermission` object; `false` otherwise.

### hashCode

    public int hashCode()

  Returns the hash code value for this object.
  Overrides:
    `hashCode` in class `java.security.BasicPermission`
  Returns:
    Hash code value for this object.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| OSGi Service Platform Release 3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) OSGi Alliance (2000, 2003). All Rights Reserved.