public class PolicySourceModel
extends java.lang.Object
implements java.lang.Cloneable
ModelNode instances associated with the actual model instance.| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.String,java.lang.String> |
DEFAULT_NAMESPACE_TO_PREFIX |
private boolean |
expanded |
private static PolicyLogger |
LOGGER |
private java.util.Map<java.lang.String,java.lang.String> |
namespaceToPrefix |
private NamespaceVersion |
nsVersion |
private java.lang.String |
policyId |
private java.lang.String |
policyName |
private java.util.List<ModelNode> |
references |
private ModelNode |
rootNode |
| Modifier | Constructor and Description |
|---|---|
private |
PolicySourceModel(NamespaceVersion nsVersion)
Constructor that creates a new policy source model instance without any
id or name identifier.
|
private |
PolicySourceModel(NamespaceVersion nsVersion,
java.lang.String policyId,
java.lang.String policyName)
Constructor that creates a new policy source model instance with given
id or name identifier.
|
protected |
PolicySourceModel(NamespaceVersion nsVersion,
java.lang.String policyId,
java.lang.String policyName,
java.util.Collection<PrefixMapper> prefixMappers)
Constructor that creates a new policy source model instance with given
id or name identifier and a set of PrefixMappers.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addNewPolicyReference(ModelNode node)
Adds new policy reference to the policy source model.
|
protected PolicySourceModel |
clone() |
boolean |
containsPolicyReferences()
Returns a boolean value indicating whether this policy source model contains references to another policy source models.
|
static PolicySourceModel |
createPolicySourceModel(NamespaceVersion nsVersion)
Factory method that creates new policy source model instance.
|
static PolicySourceModel |
createPolicySourceModel(NamespaceVersion nsVersion,
java.lang.String policyId,
java.lang.String policyName)
Factory method that creates new policy source model instance and initializes it according to parameters provided.
|
boolean |
equals(java.lang.Object obj)
An
Object.equals(Object obj) method override. |
void |
expand(PolicySourceModelContext context)
Expands current policy model.
|
private java.lang.String |
getDefaultPrefix(java.lang.String namespace)
Method retrieves default prefix for given namespace.
|
(package private) java.util.Map<java.lang.String,java.lang.String> |
getNamespaceToPrefixMapping()
Provides information about how namespaces used in this
PolicySourceModel
instance should be mapped to their default prefixes when marshalled. |
NamespaceVersion |
getNamespaceVersion()
Returns an original namespace version of this policy source model.
|
java.lang.String |
getPolicyId()
Returns a policy ID of this policy source model.
|
java.lang.String |
getPolicyName()
Returns a policy name of this policy source model.
|
ModelNode |
getRootNode()
Returns a root node of this policy source model.
|
private java.util.Collection<java.lang.String> |
getUsedNamespaces()
Iterates through policy vocabulary and extracts set of namespaces used in
the policy expression.
|
int |
hashCode()
An
Object.hashCode() method override. |
private boolean |
isExpanded()
Returns a boolean value indicating whether this policy source model contains is already expanded (i.e.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
private static final PolicyLogger LOGGER
private static final java.util.Map<java.lang.String,java.lang.String> DEFAULT_NAMESPACE_TO_PREFIX
private final java.util.Map<java.lang.String,java.lang.String> namespaceToPrefix
private ModelNode rootNode
private final java.lang.String policyId
private final java.lang.String policyName
private final NamespaceVersion nsVersion
private final java.util.List<ModelNode> references
private boolean expanded
private PolicySourceModel(NamespaceVersion nsVersion)
POLICY_NAMESPACE_PREFIX constant.nsVersion - The WS-Policy version.private PolicySourceModel(NamespaceVersion nsVersion, java.lang.String policyId, java.lang.String policyName)
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.protected PolicySourceModel(NamespaceVersion nsVersion, java.lang.String policyId, java.lang.String policyName, java.util.Collection<PrefixMapper> prefixMappers)
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.public static PolicySourceModel createPolicySourceModel(NamespaceVersion nsVersion)
nsVersion - The policy versionpublic static PolicySourceModel createPolicySourceModel(NamespaceVersion nsVersion, java.lang.String policyId, java.lang.String policyName)
nsVersion - The policy versionpolicyId - local policy identifier - relative URI. May be null.policyName - global policy identifier - absolute policy expression URI. May be null.public ModelNode getRootNode()
public java.lang.String getPolicyName()
public java.lang.String getPolicyId()
public NamespaceVersion getNamespaceVersion()
java.util.Map<java.lang.String,java.lang.String> getNamespaceToPrefixMapping()
throws PolicyException
PolicySourceModel
instance should be mapped to their default prefixes when marshalled.PolicyException - Thrown if one of the prefix mappers threw an exception.public boolean equals(java.lang.Object obj)
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.equals in class java.lang.Objectpublic int hashCode()
Object.hashCode() method override.hashCode in class java.lang.Objectpublic java.lang.String toString()
toString method
returns a string that "textually represents" this object.toString in class java.lang.Objectprotected PolicySourceModel clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic boolean containsPolicyReferences()
expand(PolicySourceModelContext) and isExpanded() for more details.true or {code false} depending on whether this policy source model contains references to another policy source models.private boolean isExpanded()
true in such case. Also this method does not check whether the references policy source models are expanded
as well, so after expanding this model a value of true is returned even if referenced models are not expanded yet. Thus each model
can be considered to be fully expanded only if all policy source models stored in PolicySourceModelContext instance are expanded, provided the
PolicySourceModelContext instance contains full set of policy source models.
Every source model that references other policies must be expanded before it can be translated into a Policy object. See
expand(PolicySourceModelContext) and containsPolicyReferences() for more details.true or false depending on whether this policy source model contains is expanded or not.public void expand(PolicySourceModelContext context) throws PolicyException
isExpanded() and containsPolicyReferences() for more details.context - a policy source model context holding the set of unmarshalled policy source models within the same context.PolicyException - Thrown if a referenced policy could not be resolvedvoid addNewPolicyReference(ModelNode node)
node - policy reference model node to be registered as a policy reference
in this model.private java.util.Collection<java.lang.String> getUsedNamespaces()
throws PolicyException
PolicyException - Thrown if internal processing failed.private java.lang.String getDefaultPrefix(java.lang.String namespace)
namespace - to get default prefix for.null if the
default prefix for given namespace is not defined.