类 ServicePermission

  • 所有已实现的接口:
    java.io.Serializable, java.security.Guard

    public final class ServicePermission
    extends java.security.BasicPermission
    A bundle's authority to register or get a service.
    • The register action allows a bundle to register a service on the specified names.
    • The 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.
    作者:
    $Id: ff7fc46dd623c0a09b49965048dd6faa2b111b39 $
    另请参阅:
    序列化表格
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      static java.lang.String GET
      The action string get.
      static java.lang.String REGISTER
      The action string register.
    • 构造器概要

      构造器 
      构造器 说明
      ServicePermission​(java.lang.String name, java.lang.String actions)
      Create a new ServicePermission.
      ServicePermission​(ServiceReference<?> reference, java.lang.String actions)
      Creates a new requested ServicePermission object to be used by code that must perform checkPermission for the get action.
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      boolean equals​(java.lang.Object obj)
      Determines the equality 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.
      • 从类继承的方法 java.security.Permission

        checkGuard, getName, toString
      • 从类继承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 字段详细资料

      • GET

        public static final java.lang.String GET
        The action string get.
        另请参阅:
        常量字段值
      • REGISTER

        public static final java.lang.String REGISTER
        The action string register.
        另请参阅:
        常量字段值
    • 构造器详细资料

      • 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. Wildcards may be used.

         name ::= <class name> | <class name ending in ".*"> | *
         
        Examples:
         org.osgi.service.http.HttpService
         org.osgi.service.http.*
         *
         
        For the get action, the name can also be a filter expression. The filter gives access to the service properties as well as the following attributes:
        • signer - A Distinguished Name chain used to sign the bundle publishing the service. Wildcards in a DN are not matched according to the filter string rules, but according to the rules defined for a DN chain.
        • location - The location of the bundle publishing the service.
        • id - The bundle ID of the bundle publishing the service.
        • name - The symbolic name of the bundle publishing the service.
        Since the above attribute names may conflict with service property names used by a service, you can prefix an attribute name with '@' in the filter expression to match against the service property and not one of the above attributes. Filter attribute names are processed in a case sensitive manner unless the attribute references a service property. Service properties names are case insensitive.

        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.

        参数:
        name - The service class name
        actions - get,register (canonical order)
        抛出:
        java.lang.IllegalArgumentException - If the specified name is a filter expression and either the specified action is not get or the filter has an invalid syntax.
      • ServicePermission

        public ServicePermission​(ServiceReference<?> reference,
                                 java.lang.String actions)
        Creates a new requested ServicePermission object to be used by code that must perform checkPermission for the get action. ServicePermission objects created with this constructor cannot be added to a ServicePermission permission collection.
        参数:
        reference - The requested service.
        actions - The action get.
        抛出:
        java.lang.IllegalArgumentException - If the specified action is not get or reference is null.
        从以下版本开始:
        1.5
    • 方法详细资料

      • implies

        public boolean implies​(java.security.Permission p)
        Determines if a ServicePermission object "implies" the specified permission.
        覆盖:
        implies 在类中 java.security.BasicPermission
        参数:
        p - The target permission to check.
        返回:
        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.
        覆盖:
        getActions 在类中 java.security.BasicPermission
        返回:
        The canonical string representation of the actions.
      • newPermissionCollection

        public java.security.PermissionCollection newPermissionCollection()
        Returns a new PermissionCollection object for storing ServicePermission objects.
        覆盖:
        newPermissionCollection 在类中 java.security.BasicPermission
        返回:
        A new PermissionCollection object suitable for storing ServicePermission objects.
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines the equality of two ServicePermission objects. Checks that specified object has the same class name and action as this ServicePermission.
        覆盖:
        equals 在类中 java.security.BasicPermission
        参数:
        obj - The object to test for equality.
        返回:
        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.
        覆盖:
        hashCode 在类中 java.security.BasicPermission
        返回:
        Hash code value for this object.