Class PolicyMap

java.lang.Object
com.sun.xml.ws.policy.PolicyMap
All Implemented Interfaces:
Iterable<Policy>

public final class PolicyMap extends Object implements Iterable<Policy>
A PolicyMap holds all policies for a scope. This map is modeled around WSDL 1.1 policy scopes according to WS-PolicyAttachment. The map holds an information about every scope for service, endpoint, operation, and input/output/fault message. It also provide accessibility methods for computing and obtaining effective policy on each scope. TODO: rename createWsdlMessageScopeKey to createWsdlInputOutputMessageScopeKey
Author:
Fabian Ritzmann
  • Method Details

    • createPolicyMap

      public static PolicyMap createPolicyMap(Collection<? extends PolicyMapMutator> mutators)
      Creates new policy map instance and connects provided collection of policy map mutators to the created policy map.
      Parameters:
      mutators - collection of mutators that should be connected to the newly created map.
      Returns:
      new policy map instance (mutable via provided collection of mutators).
    • getServiceEffectivePolicy

      public Policy getServiceEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getEndpointEffectivePolicy

      public Policy getEndpointEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getOperationEffectivePolicy

      public Policy getOperationEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getInputMessageEffectivePolicy

      public Policy getInputMessageEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getOutputMessageEffectivePolicy

      public Policy getOutputMessageEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getFaultMessageEffectivePolicy

      public Policy getFaultMessageEffectivePolicy(PolicyMapKey key) throws PolicyException
      Throws:
      PolicyException
    • getAllServiceScopeKeys

      public Collection<PolicyMapKey> getAllServiceScopeKeys()
      Returns all service scope keys stored in this policy map
      Returns:
      collection of service scope policy map keys stored in the map.
    • getAllEndpointScopeKeys

      public Collection<PolicyMapKey> getAllEndpointScopeKeys()
      Returns all endpoint scope keys stored in this policy map
      Returns:
      collection of endpoint scope policy map keys stored in the map.
    • getAllOperationScopeKeys

      public Collection<PolicyMapKey> getAllOperationScopeKeys()
      Returns all operation scope keys stored in this policy map
      Returns:
      collection of operation scope policy map keys stored in the map.
    • getAllInputMessageScopeKeys

      public Collection<PolicyMapKey> getAllInputMessageScopeKeys()
      Returns all input message scope keys stored in this policy map
      Returns:
      collection of input message scope policy map keys stored in the map.
    • getAllOutputMessageScopeKeys

      public Collection<PolicyMapKey> getAllOutputMessageScopeKeys()
      Returns all output message scope keys stored in this policy map
      Returns:
      collection of output message scope policy map keys stored in the map.
    • getAllFaultMessageScopeKeys

      public Collection<PolicyMapKey> getAllFaultMessageScopeKeys()
      Returns all fault message scope keys stored in this policy map
      Returns:
      collection of input message scope policy map keys stored in the map.
    • getPolicySubjects

      public Collection<PolicySubject> getPolicySubjects()
      Returns all policy subjects contained by this map.
      Returns:
      All policy subjects contained by this map
    • isInputMessageSubject

      public boolean isInputMessageSubject(PolicySubject subject)
    • isOutputMessageSubject

      public boolean isOutputMessageSubject(PolicySubject subject)
    • isFaultMessageSubject

      public boolean isFaultMessageSubject(PolicySubject subject)
    • isEmpty

      public boolean isEmpty()
      Returns true if this map contains no key - policy pairs A null object key or policy constitutes a non-empty map.
      Returns:
      true if this map contains no key - policy pairs
    • createWsdlServiceScopeKey

      public static PolicyMapKey createWsdlServiceScopeKey(QName service) throws IllegalArgumentException
      Creates a service policy scope locator object, that serves as a access key into a PolicyMap where actual service policy scope for given service can be retrieved.
      Parameters:
      service - qualified name of the service. Must not be null.
      Throws:
      IllegalArgumentException - in case service, port or operation parameter is null.
    • createWsdlEndpointScopeKey

      public static PolicyMapKey createWsdlEndpointScopeKey(QName service, QName port) throws IllegalArgumentException
      Creates an endpoint policy scope locator object, that serves as a access key into a PolicyMap where actual endpoint policy scope for given endpoint can be retrieved.
      Parameters:
      service - qualified name of the service. Must not be null.
      port - qualified name of the endpoint. Must not be null.
      Throws:
      IllegalArgumentException - in case service, port or operation parameter is null.
    • createWsdlOperationScopeKey

      public static PolicyMapKey createWsdlOperationScopeKey(QName service, QName port, QName operation) throws IllegalArgumentException
      Creates an operation policy scope locator object, that serves as a access key into a PolicyMap where actual operation policy scope for given bound operation can be retrieved.
      Parameters:
      service - qualified name of the service. Must not be null.
      port - qualified name of the endpoint. Must not be null.
      operation - qualified name of the operation. Must not be null.
      Throws:
      IllegalArgumentException - in case service, port or operation parameter is null.
    • createWsdlMessageScopeKey

      public static PolicyMapKey createWsdlMessageScopeKey(QName service, QName port, QName operation) throws IllegalArgumentException
      Creates an input/output message policy scope locator object identified by a bound operation, that serves as a access key into PolicyMap where actual input/output message policy scope for given input message of a bound operation can be retrieved.
      The method returns a key that is compliant with WSDL 1.1 Basic Profile Specification, according to which there should be no two operations with the same name in a single port type definition.
      Parameters:
      service - qualified name of the service. Must not be null.
      port - qualified name of the endpoint. Must not be null.
      operation - qualified name of the operation. Must not be null.
      Throws:
      IllegalArgumentException - in case service, port or operation parameter is null.
    • createWsdlFaultMessageScopeKey

      public static PolicyMapKey createWsdlFaultMessageScopeKey(QName service, QName port, QName operation, QName fault) throws IllegalArgumentException
      Creates a fault message policy scope locator object identified by a bound operation, that serves as a access key into PolicyMap where the actual fault message policy scope for one of the faults of a bound operation can be retrieved.
      The method returns a key that is compliant with the WSDL 1.1 Basic Profile Specification, according to which there should be no two operations with the same name in a single port type definition.
      Parameters:
      service - qualified name of the service. Must not be null.
      port - qualified name of the endpoint. Must not be null.
      operation - qualified name of the operation. Must not be null.
      fault - qualified name of the fault. Do not confuse this with the name of the actual message. This parameter takes the wsdl:binding/wsdl:operation/wsdl:fault name and not the wsdl:message name. Must not be null.
      Throws:
      IllegalArgumentException - in case service, port or operation parameter is null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<Policy> iterator()
      Specified by:
      iterator in interface Iterable<Policy>