Class PolicySourceModel

java.lang.Object
com.sun.xml.ws.policy.sourcemodel.PolicySourceModel
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
SourceModel

public class PolicySourceModel extends Object implements Cloneable
This class is a root of unmarshaled policy source structure. Each instance of the class contains factory method to create new ModelNode instances associated with the actual model instance.
Author:
Marek Potociar, Fabian Ritzmann
  • Constructor Details

    • PolicySourceModel

      protected PolicySourceModel(NamespaceVersion nsVersion, String policyId, String policyName, Collection<PrefixMapper> prefixMappers)
      Constructor that creates a new policy source model instance with given id or name identifier and a set of PrefixMappers. This constructor is intended to be used by the JAX-WS com.sun.xml.ws.policy.api.SourceModel.
      Parameters:
      nsVersion - The WS-Policy version.
      policyId - Relative policy reference within an XML document. May be null.
      policyName - Absolute IRI of policy expression. May be null.
      prefixMappers - A collection of PrefixMappers to be used with this instance. May be null.
  • Method Details

    • createPolicySourceModel

      public static PolicySourceModel createPolicySourceModel(NamespaceVersion nsVersion)
      Factory method that creates new policy source model instance. This method is only intended to be used by code that has no dependencies on JAX-WS. Otherwise use com.sun.xml.ws.policy.api.SourceModel.
      Parameters:
      nsVersion - The policy version
      Returns:
      Newly created policy source model instance.
    • createPolicySourceModel

      public static PolicySourceModel createPolicySourceModel(NamespaceVersion nsVersion, String policyId, String policyName)
      Factory method that creates new policy source model instance and initializes it according to parameters provided. This method is only intended to be used by code that has no dependencies on JAX-WS. Otherwise use com.sun.xml.ws.policy.api.SourceModel.
      Parameters:
      nsVersion - The policy version
      policyId - local policy identifier - relative URI. May be null.
      policyName - global policy identifier - absolute policy expression URI. May be null.
      Returns:
      Newly created policy source model instance with its name and id properly set.
    • getRootNode

      public ModelNode getRootNode()
      Returns a root node of this policy source model. It is allways of POLICY type.
      Returns:
      root policy source model node - allways of POLICY type.
    • getPolicyName

      public String getPolicyName()
      Returns a policy name of this policy source model.
      Returns:
      policy name.
    • getPolicyId

      public String getPolicyId()
      Returns a policy ID of this policy source model.
      Returns:
      policy ID.
    • getNamespaceVersion

      public NamespaceVersion getNamespaceVersion()
      Returns an original namespace version of this policy source model.
      Returns:
      namespace version.
    • equals

      public boolean equals(Object obj)
      An Object.equals(Object obj) method override.
      When child nodes are tested for equality, the parent policy source model is not considered. Thus two different policy source models instances may be equal based on their node content.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      An Object.hashCode() method override.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • containsPolicyReferences

      public boolean containsPolicyReferences()
      Returns a boolean value indicating whether this policy source model contains references to another policy source models.
      Every source model that references other policies must be expanded before it can be translated into a Policy objects. See expand(PolicySourceModelContext) and isExpanded() for more details.
      Returns:
      true or false depending on whether this policy source model contains references to another policy source models.
    • expand

      public void expand(PolicySourceModelContext context) throws PolicyException
      Expands current policy model. This means, that if this model contains any (unexpanded) policy references, then the method expands those references by placing the content of the referenced policy source models under the policy reference nodes. This operation merely creates a link between this and referenced policy source models. Thus any change in the referenced models will be visible wihtin this model as well.
      Please, notice that the method does not check if the referenced models are already expanded nor does the method try to expand unexpanded referenced models. This must be preformed manually within client's code. Consecutive calls of this method will have no effect.
      Every source model that references other policies must be expanded before it can be translated into a Policy object. See isExpanded() and containsPolicyReferences() for more details.
      Parameters:
      context - a policy source model context holding the set of unmarshalled policy source models within the same context.
      Throws:
      PolicyException - Thrown if a referenced policy could not be resolved