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 newModelNodeinstances associated with the actual model instance.- Author:
- Marek Potociar, Fabian Ritzmann
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPolicySourceModel(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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PolicySourceModelclone()booleancontainsPolicyReferences()Returns a boolean value indicating whether this policy source model contains references to another policy source models.static PolicySourceModelcreatePolicySourceModel(NamespaceVersion nsVersion)Factory method that creates new policy source model instance.static PolicySourceModelcreatePolicySourceModel(NamespaceVersion nsVersion, String policyId, String policyName)Factory method that creates new policy source model instance and initializes it according to parameters provided.booleanequals(Object obj)AnObject.equals(Object obj)method override.voidexpand(PolicySourceModelContext context)Expands current policy model.NamespaceVersiongetNamespaceVersion()Returns an original namespace version of this policy source model.StringgetPolicyId()Returns a policy ID of this policy source model.StringgetPolicyName()Returns a policy name of this policy source model.ModelNodegetRootNode()Returns a root node of this policy source model.inthashCode()AnObject.hashCode()method override.StringtoString()Returns a string representation of the object.
-
-
-
Constructor Detail
-
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 benull.policyName- Absolute IRI of policy expression. May benull.prefixMappers- A collection of PrefixMappers to be used with this instance. May benull.
-
-
Method Detail
-
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 versionpolicyId- local policy identifier - relative URI. May benull.policyName- global policy identifier - absolute policy expression URI. May benull.- 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)
AnObject.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.
-
hashCode
public int hashCode()
AnObject.hashCode()method override.
-
toString
public String toString()
Returns a string representation of the object. In general, thetoStringmethod returns a string that "textually represents" this object.
-
clone
protected PolicySourceModel clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- 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. Seeexpand(PolicySourceModelContext)andisExpanded()for more details.- Returns:
trueorfalsedepending 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. SeeisExpanded()andcontainsPolicyReferences()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
-
-