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 TypeMethodDescriptionbooleanReturns true if the policy contains the assertion names with specified namespace in its vocabularybooleanDetermines if the policy instance contains the assertion with the name specified in its vocabulary.static PolicyThe factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static PolicycreateEmptyPolicy(NamespaceVersion nsVersion, String name, String policyId) The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static PolicycreateEmptyPolicy(String name, String policyId) The factory method creates an immutable policy instance which represents a 'anything allowed' policy expression.static PolicyThe factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static PolicycreateNullPolicy(NamespaceVersion nsVersion, String name, String policyId) The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static PolicycreateNullPolicy(String name, String policyId) The factory method creates an immutable policy instance which represents a 'nothing allowed' policy expression.static PolicycreatePolicy(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 bysetsinput parameter.static PolicycreatePolicy(String name, String policyId, Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysetsinput parameter.static PolicycreatePolicy(Collection<AssertionSet> sets) The factory method creates an immutable policy instance which represents a policy expression with alternatives specified bysetsinput parameter.booleanAnObject.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.intMethod returns how many policy alternatives this policy instance contains.Retrieves the vocabulary of this policy expression.inthashCode()AnObject.hashCode()method override.booleanisEmpty()Returnstrueif the policy instance represents "anything allowed" policy expressionbooleanisNull()Returnstrueif 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, waitMethods 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 bysetsinput 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 bysetsinput 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 bysetsinput 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:
iteratorin interfaceIterable<AssertionSet>- Returns:
- An iterator to iterate through all contained assertion sets
-
isNull
public boolean isNull()Returnstrueif the policy instance represents "nothing allowed" policy expression- Returns:
trueif the policy instance represents "nothing allowed" policy expression,falseotherwise.
-
isEmpty
public boolean isEmpty()Returnstrueif the policy instance represents "anything allowed" policy expression- Returns:
trueif the policy instance represents "anything allowed" policy expression,falseotherwise.
-
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 vocabularyfalseotherwise.
-
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:
trueif the assertion with the specified name is part of the policy instance's vocabulary,falseotherwise.
-
equals
AnObject.equals(Object obj)method override. -
hashCode
public int hashCode()AnObject.hashCode()method override. -
toString
AnObject.toString()method override.
-