Package com.sun.xml.ws.policy
Class Policy
java.lang.Object
com.sun.xml.ws.policy.Policy
- All Implemented Interfaces:
Iterable<AssertionSet>
- Direct Known Subclasses:
NestedPolicy
A policy represents normalized policy as a wrapper of available policy alternatives represented by
child
AssertionSets
.- Author:
- Fabian Ritzmann, Marek Potociar
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the policy contains the assertion names with specified namespace in its vocabularyboolean
Determines if the policy instance contains the assertion with the name specified in its vocabulary.static Policy
The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static Policy
createEmptyPolicy
(NamespaceVersion nsVersion, String name, String policyId) The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static Policy
createEmptyPolicy
(String name, String policyId) The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static Policy
The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static Policy
createNullPolicy
(NamespaceVersion nsVersion, String name, String policyId) The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static Policy
createNullPolicy
(String name, String policyId) The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static Policy
createPolicy
(NamespaceVersion nsVersion, String name, String policyId, Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter.static Policy
createPolicy
(String name, String policyId, Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter.static Policy
createPolicy
(Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter.boolean
AnObject.equals(Object obj)
method override.getId()
Returns the policy identifier that serves as a local relative policy URI.Returns the policy ID or if that is null the policy name.getName()
Returns the policy name that serves as a global policy URI.int
Method returns how many policy alternatives this policy instance contains.Retrieves the vocabulary of this policy expression.int
hashCode()
AnObject.hashCode()
method override.boolean
isEmpty()
Returnstrue
if the policy instance represents "anything allowed" policy expressionboolean
isNull()
Returnstrue
if the policy instance represents "nothing allowed" policy expressioniterator()
A policy usually contains one or more assertion sets.toString()
AnObject.toString()
method override.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
createNullPolicy
The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression. The policy is created using the latest namespace version supported.- Returns:
- policy instance which represents a 'nothing allowed' (no policy alternatives).
-
createEmptyPolicy
The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression. The policy is created using the latest namespace version supported.- Returns:
- policy instance which represents a 'anything allowed' (empty policy alternative with no plicy assertions prescribed).
-
createNullPolicy
The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression. The policy is created using the latest namespace version supported.- Parameters:
name
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.- Returns:
- policy instance which represents a 'nothing allowed' (no policy alternatives).
-
createNullPolicy
The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression. The policy is created using the latest namespace version supported.- Parameters:
nsVersion
- Policy namespace version to be used when marshalling the policy expressionname
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.- Returns:
- policy instance which represents a 'nothing allowed' (no policy alternatives).
-
createEmptyPolicy
The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression. The policy is created using the latest namespace version supported.- Parameters:
name
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.- Returns:
- policy instance which represents a 'anything allowed' (empty policy alternative with no plicy assertions prescribed).
-
createEmptyPolicy
The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression. The policy is created using the latest namespace version supported.- Parameters:
nsVersion
- Policy namespace version to be used when marshalling the policy expressionname
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.- Returns:
- policy instance which represents a 'anything allowed' (empty policy alternative with no plicy assertions prescribed).
-
createPolicy
The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter. If the collection of policy alternatives is null or empty an object representing a 'NULL' policy expression is returned. However, in such case it is better to usecreateNullPolicy()
factory method directly. The policy is created using the latest namespace version supported.- Parameters:
sets
- represents the collection of policy alternatives of the policy object created. During the creation of the new policy object, the content of the alternatives collection is copied into an internal policy object structure, thus any subsequent operations on the collection will have no impact on the newly constructed policy object.- Returns:
- policy instance which represents the policy with given alternatives.
-
createPolicy
The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter. If the collection of policy alternatives is null or empty an object representing a 'NULL' policy expression is returned. However, in such case it is better to usecreateNullPolicy(String, String)
factory method directly. The policy is created using the latest namespace version supported.- Parameters:
name
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.sets
- represents the collection of policy alternatives of the policy object created. During the creation of the new policy object, the content of the alternatives collection is copied into an internal policy object structure, thus any subsequent operations on the collection will have no impact on the newly constructed policy object.- Returns:
- policy instance which represents the policy with given alternatives.
-
createPolicy
public static Policy createPolicy(NamespaceVersion nsVersion, String name, String policyId, Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysets
input parameter. If the collection of policy alternatives is null or empty an object representing a 'NULL' policy expression is returned. However, in such case it is better to usecreateNullPolicy(String, String)
factory method directly. The policy is created using the latest namespace version supported.- Parameters:
nsVersion
- Policy namespace version to be used when marshalling the policy expressionname
- global URI of the policy. May benull
.policyId
- local URI of the policy. May benull
.sets
- represents the collection of policy alternatives of the policy object created. During the creation of the new policy object, the content of the alternatives collection is copied into an internal policy object structure, thus any subsequent operations on the collection will have no impact on the newly constructed policy object.- Returns:
- policy instance which represents the policy with given alternatives.
-
getId
Returns the policy identifier that serves as a local relative policy URI.- Returns:
- policy identifier - a local relative policy URI. If no policy identifier is set, returns
null
.
-
getName
Returns the policy name that serves as a global policy URI.- Returns:
- policy name - a global policy URI. If no policy name is set, returns
null
.
-
getNamespaceVersion
-
getIdOrName
Returns the policy ID or if that is null the policy name. May return null if both attributes are null. -
getNumberOfAssertionSets
public int getNumberOfAssertionSets()Method returns how many policy alternatives this policy instance contains.- Returns:
- number of policy alternatives contained in this policy instance
-
iterator
A policy usually contains one or more assertion sets. Each assertion set corresponds to a policy alternative as defined by WS-Policy.- Specified by:
iterator
in interfaceIterable<AssertionSet>
- Returns:
- An iterator to iterate through all contained assertion sets
-
isNull
public boolean isNull()Returnstrue
if the policy instance represents "nothing allowed" policy expression- Returns:
true
if the policy instance represents "nothing allowed" policy expression,false
otherwise.
-
isEmpty
public boolean isEmpty()Returnstrue
if the policy instance represents "anything allowed" policy expression- Returns:
true
if the policy instance represents "anything allowed" policy expression,false
otherwise.
-
contains
Returns true if the policy contains the assertion names with specified namespace in its vocabulary- Parameters:
namespaceUri
- the assertion namespace URI (identifying assertion domain)- Returns:
true
, if an assertion with the given name could be found in the policy vocabularyfalse
otherwise.
-
getVocabulary
Retrieves the vocabulary of this policy expression. The vocabulary is represented by an immutable collection of unique QName objects. Each of those objects represents single assertion type contained in the policy.- Returns:
- immutable collection of assertion types contained in the policy (a policy vocabulary).
-
contains
Determines if the policy instance contains the assertion with the name specified in its vocabulary.- Parameters:
assertionName
- the name of the assertion to be tested.- Returns:
true
if the assertion with the specified name is part of the policy instance's vocabulary,false
otherwise.
-
equals
AnObject.equals(Object obj)
method override. -
hashCode
public int hashCode()AnObject.hashCode()
method override. -
toString
AnObject.toString()
method override.
-