Class PolicySubject


  • public final class PolicySubject
    extends Object
    A PolicySubject is an entity (e.g., a port, operation, binding, service) with which a policy can be associated.
    Author:
    Fabian Ritzmann
    • Constructor Detail

      • PolicySubject

        public PolicySubject​(Object subject,
                             Policy policy)
                      throws IllegalArgumentException
        Constructs a policy subject instance.
        Parameters:
        subject - object to which the policies are attached. Must not be null.
        policy - first policy attached to the subject. Must not be null.
        Throws:
        IllegalArgumentException - in case any of the arguments is null.
      • PolicySubject

        public PolicySubject​(Object subject,
                             Collection<Policy> policies)
                      throws IllegalArgumentException
        Constructs a policy subject instance.
        Parameters:
        subject - object to which the policies are attached. Must not be null.
        policies - first policy attached to the subject. Must not be null.
        Throws:
        IllegalArgumentException - in case any of the arguments is null or in case policies argument represents empty collection.
    • Method Detail

      • attach

        public void attach​(Policy policy)
        Attaches another Policy instance to the policy subject.
        Parameters:
        policy - new policy instance to be attached to this subject
        Throws:
        IllegalArgumentException - in case policy argument is null.
      • getEffectivePolicy

        public Policy getEffectivePolicy​(PolicyMerger merger)
                                  throws PolicyException
        Returns the effective policy of the subject, i.e. all policies of the subject merged together.
        Returns:
        effective policy of the subject
        Throws:
        PolicyException
      • getSubject

        public Object getSubject()
        A unique identifier of the subject Subjects may not always be uniquely identifiable. Also, once the subject is assigned to a scope, its identity may not matter anymore. Therefore this may be null.
      • toString

        public String toString()
        An Object.toString() method override.
        Overrides:
        toString in class Object