Class EndpointPermission

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

    public final class EndpointPermission
    extends java.security.Permission
    A bundle's authority to export, import or read an Endpoint.
    • The export action allows a bundle to export a service as an Endpoint.
    • The import action allows a bundle to import a service from an Endpoint.
    • The read action allows a bundle to read references to an Endpoint.
    Permission to read an Endpoint is required in order to detect events regarding an Endpoint. Untrusted bundles should not be able to detect the presence of certain Endpoints unless they have the appropriate EndpointPermission to read the specific service.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EXPORT
      The action string export.
      static java.lang.String IMPORT
      The action string import.
      static java.lang.String READ
      The action string read.
    • Constructor Summary

      Constructors 
      Constructor Description
      EndpointPermission​(java.lang.String filterString, java.lang.String actions)
      Create a new EndpointPermission with the specified filter.
      EndpointPermission​(EndpointDescription endpoint, java.lang.String localFrameworkUUID, java.lang.String actions)
      Creates a new requested EndpointPermission object to be used by code that must perform checkPermission.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Determines the equality of two EndpointPermission 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 EndpointPermission object "implies" the specified permission.
      java.security.PermissionCollection newPermissionCollection()
      Returns a new PermissionCollection object for storing EndpointPermission 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

      • READ

        public static final java.lang.String READ
        The action string read.
        See Also:
        Constant Field Values
      • IMPORT

        public static final java.lang.String IMPORT
        The action string import. The import action implies the read action.
        See Also:
        Constant Field Values
      • EXPORT

        public static final java.lang.String EXPORT
        The action string export. The export action implies the read action.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EndpointPermission

        public EndpointPermission​(java.lang.String filterString,
                                  java.lang.String actions)
        Create a new EndpointPermission with the specified filter.

        The filter will be evaluated against the endpoint properties of a requested EndpointPermission.

        There are three possible actions: read, import and export. The read action allows the owner of this permission to see the presence of distributed services. The import action allows the owner of this permission to import an endpoint. The export action allows the owner of this permission to export a service.

        Parameters:
        filterString - The filter string or "*" to match all endpoints.
        actions - The actions read, import, or export.
        Throws:
        java.lang.IllegalArgumentException - If the filter has an invalid syntax or the actions are not valid.
      • EndpointPermission

        public EndpointPermission​(EndpointDescription endpoint,
                                  java.lang.String localFrameworkUUID,
                                  java.lang.String actions)
        Creates a new requested EndpointPermission object to be used by code that must perform checkPermission. EndpointPermission objects created with this constructor cannot be added to an EndpointPermission permission collection.
        Parameters:
        endpoint - The requested endpoint.
        localFrameworkUUID - The UUID of the local framework. This is used to support matching the endpoint.framework.uuid endpoint property to the <<LOCAL>> value in the filter expression.
        actions - The actions read, import, or export.
        Throws:
        java.lang.IllegalArgumentException - If the endpoint is null or the actions are not valid.
    • Method Detail

      • implies

        public boolean implies​(java.security.Permission p)
        Determines if a EndpointPermission object "implies" the specified permission.
        Specified by:
        implies in class java.security.Permission
        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 canonical order: read, import, export.
        Specified by:
        getActions in class java.security.Permission
        Returns:
        The canonical string representation of the actions.
      • newPermissionCollection

        public java.security.PermissionCollection newPermissionCollection()
        Returns a new PermissionCollection object for storing EndpointPermission objects.
        Overrides:
        newPermissionCollection in class java.security.Permission
        Returns:
        A new PermissionCollection object suitable for storing EndpointPermission objects.
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines the equality of two EndpointPermission objects. Checks that specified object has the same name, actions and endpoint as this EndpointPermission.
        Specified by:
        equals in class java.security.Permission
        Parameters:
        obj - The object to test for equality.
        Returns:
        true If obj is a EndpointPermission, and has the same name, actions and endpoint as this EndpointPermission object; false otherwise.
      • hashCode

        public int hashCode()
        Returns the hash code value for this object.
        Specified by:
        hashCode in class java.security.Permission
        Returns:
        Hash code value for this object.