Class WirePermission

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

    public final class WirePermission
    extends java.security.BasicPermission
    Permission for the scope of a Wire object. When a Envelope object is used for communication with the poll or update method, and the scope is set, then the Wire object must verify that the Consumer service has WirePermission[name,CONSUME] and the Producer service has WirePermission[name,PRODUCE] for all names in the scope.

    The names are compared with the normal rules for permission names. This means that they may end with a "*" to indicate wildcards. E.g. Door.* indicates all scope names starting with the string "Door". The last period is required due to the implementations of the BasicPermission class.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONSUME
      The action string for the consume action.
      static java.lang.String PRODUCE
      The action string for the produce action.
    • Constructor Summary

      Constructors 
      Constructor Description
      WirePermission​(java.lang.String name, java.lang.String actions)
      Create a new WirePermission with the given name (may be wildcard) and actions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Determines the equality of two WirePermission 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)
      Checks if this WirePermission object implies the specified permission.
      java.security.PermissionCollection newPermissionCollection()
      Returns a new PermissionCollection object for storing WirePermission objects.
      java.lang.String toString()
      Returns a string describing this WirePermission.
      • Methods inherited from class java.security.Permission

        checkGuard, getName
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PRODUCE

        public static final java.lang.String PRODUCE
        The action string for the produce action.
        See Also:
        Constant Field Values
      • CONSUME

        public static final java.lang.String CONSUME
        The action string for the consume action.
        See Also:
        Constant Field Values
    • Constructor Detail

      • WirePermission

        public WirePermission​(java.lang.String name,
                              java.lang.String actions)
        Create a new WirePermission with the given name (may be wildcard) and actions.
        Parameters:
        name - Wire name.
        actions - produce, consume (canonical order).
    • Method Detail

      • implies

        public boolean implies​(java.security.Permission p)
        Checks if this WirePermission object implies the specified permission.

        More specifically, this method returns true if:

        • p is an instanceof the WirePermission class,
        • p's actions are a proper subset of this object's actions, and
        • p's name is implied by this object's name. For example, java.* implies java.home.
        Overrides:
        implies in class java.security.BasicPermission
        Parameters:
        p - The permission to check against.
        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: produce, consume.
        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 WirePermission objects.
        Overrides:
        newPermissionCollection in class java.security.BasicPermission
        Returns:
        A new PermissionCollection object suitable for storing WirePermission objects.
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines the equality of two WirePermission objects. Checks that specified object has the same name and actions as this WirePermission object.
        Overrides:
        equals in class java.security.BasicPermission
        Parameters:
        obj - The object to test for equality.
        Returns:
        true if obj is a WirePermission, and has the same name and actions as this WirePermission 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.
      • toString

        public java.lang.String toString()
        Returns a string describing this WirePermission. The convention is to specify the class name, the permission name, and the actions in the following format: '(org.osgi.service.wireadmin.WirePermission "name" "actions")'.
        Overrides:
        toString in class java.security.Permission
        Returns:
        information about this Permission object.