protected ComplexAssertion(final AssertionData data, final Collection<? extends PolicyAssertion> assertionParameters, final AssertionSet nestedAlternative) { super(data, assertionParameters); AssertionSet nestedSet = (nestedAlternative != null) ? nestedAlternative : AssertionSet.emptyAssertionSet(); this.nestedPolicy = NestedPolicy.createNestedPolicy(nestedSet); }
/** * Replaces current effective policy on the endpoint scope (identified by a {@code key} parameter) with the new efective * policy provided as a second input parameter. * * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}. * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}. * * @throws IllegalArgumentException in case any of the input parameters is {@code null} */ public void setNewEffectivePolicyForEndpointScope( final PolicyMapKey key, final Policy newEffectivePolicy) { getMap().setNewEffectivePolicyForScope(PolicyMap.ScopeType.ENDPOINT, key, newEffectivePolicy); }
public void putFaultMessageSubject(final PolicyMapKey key, final PolicySubject subject) { getMap().putSubject(PolicyMap.ScopeType.FAULT_MESSAGE, key, subject); }
protected void doPopulate(final PolicyMapExtender policyMapExtender) throws PolicyException { final PolicyMapKey mapKey = PolicyMap.createWsdlEndpointScopeKey(service, port); for (PolicySubject subject : getPolicySubjects()) { policyMapExtender.putEndpointSubject(mapKey, subject); } }
protected void doPopulate(final PolicyMapExtender policyMapExtender) throws PolicyException{ final PolicyMapKey mapKey = PolicyMap.createWsdlServiceScopeKey(service); for (PolicySubject subject : getPolicySubjects()) { policyMapExtender.putServiceSubject(mapKey, subject); } }
/** * Returns all policies of the scope merged into one policy * * @return effective policy of the scope */ Policy getEffectivePolicy(final PolicyMerger merger) throws PolicyException { final LinkedList<Policy> policies = new LinkedList<Policy>(); for (PolicySubject subject : subjects) { policies.add(subject.getEffectivePolicy(merger)); } return merger.merge(policies); }
/** * Returns the boolean information whether this assertion contains nested policy. * * @return {@code true} if the assertion contains child (nested) policy. Returns {@code false} otherwise. */ public boolean hasNestedPolicy() { // TODO: make abstract return getNestedPolicy() != null; }
public boolean isOutputMessageSubject(final PolicySubject subject) { for (PolicyScope scope : outputMessageMap.getStoredScopes()) { if (scope.getPolicySubjects().contains(subject)) { return true; } } return false; }
/** * Does the selection for policy map bound to given modifier. * * If you are using JAX-WS, use the com.sun.xml.ws.api.policy.AlternativeSelector * instead of this class. * * @param modifier Holds the policy map * @throws PolicyException Most likely an internal error if a policy could not be read or set on the policy map * @see EffectivePolicyModifier which the map is bound to */ public static void doSelection(final EffectivePolicyModifier modifier) throws PolicyException { final AssertionValidationProcessor validationProcessor = AssertionValidationProcessor.getInstance(); selectAlternatives(modifier, validationProcessor); }
/** * Returns all endpoint scope keys stored in this policy map * * @return collection of endpoint scope policy map keys stored in the map. */ public Collection<PolicyMapKey> getAllEndpointScopeKeys() { return endpointMap.getAllKeys(); }
private boolean addAll(final Collection<? extends PolicyAssertion> assertions) { boolean result = true; if (assertions != null) { for (PolicyAssertion assertion : assertions) { result &= add(assertion); // this is here to ensure that vocabulary is built correctly as well } } return result; }
/** * Creates an operation policy scope <emph>locator</emph> object, that serves as a access key into * a {@code PolicyMap} where actual operation policy scope for given bound operation can be retrieved. * * @param service qualified name of the service. Must not be {@code null}. * @param port qualified name of the endpoint. Must not be {@code null}. * @param operation qualified name of the operation. Must not be {@code null}. * @throws IllegalArgumentException in case service, port or operation parameter is {@code null}. */ public static PolicyMapKey createWsdlOperationScopeKey(final QName service, final QName port, final QName operation) throws IllegalArgumentException { return createOperationOrInputOutputMessageKey(service, port, operation); }
protected void doPopulate(final PolicyMapExtender policyMapExtender) throws PolicyException { final PolicyMapKey mapKey = PolicyMap.createWsdlEndpointScopeKey(service, port); for (PolicySubject subject : getPolicySubjects()) { policyMapExtender.putEndpointSubject(mapKey, subject); } }
/** * Replaces current effective policy on the operation scope (identified by a {@code key} parameter) with the new efective * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply * stored with the key. * * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}. * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}. * * @throws IllegalArgumentException in case any of the input parameters is {@code null} */ public void setNewEffectivePolicyForOperationScope( final PolicyMapKey key, final Policy newEffectivePolicy) { getMap().setNewEffectivePolicyForScope(PolicyMap.ScopeType.OPERATION, key, newEffectivePolicy); }
protected ComplexAssertion() { super(); this.nestedPolicy = NestedPolicy.createNestedPolicy(AssertionSet.emptyAssertionSet()); }
public void putEndpointSubject(final PolicyMapKey key, final PolicySubject subject) { getMap().putSubject(PolicyMap.ScopeType.ENDPOINT, key, subject); }
/** * Add all subjects in the given map to the collection * * @param subjects A collection that should hold subjects. The new subjects are added to the collection. Must not be {@code null}. * @param scopeMap A scope map that holds policy scopes. The subjects are retrieved from the scope objects. */ private void addSubjects(final Collection<PolicySubject> subjects, final ScopeMap scopeMap) { for (PolicyScope scope : scopeMap.getStoredScopes()) { final Collection<PolicySubject> scopedSubjects = scope.getPolicySubjects(); subjects.addAll(scopedSubjects); } }
/** * Returns all input message scope keys stored in this policy map * * @return collection of input message scope policy map keys stored in the map. */ public Collection<PolicyMapKey> getAllInputMessageScopeKeys() { return inputMessageMap.getAllKeys(); }
/** * Replaces current effective policy on the input message scope (identified by a {@code key} parameter) with the new efective * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply * stored with the key. * * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}. * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}. * * @throws IllegalArgumentException in case any of the input parameters is {@code null} */ public void setNewEffectivePolicyForInputMessageScope( final PolicyMapKey key, final Policy newEffectivePolicy) { getMap().setNewEffectivePolicyForScope(PolicyMap.ScopeType.INPUT_MESSAGE, key, newEffectivePolicy); }
/** * Replaces current effective policy on the output message scope (identified by a {@code key} parameter) with the new efective * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply * stored with the key. * * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}. * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}. * * @throws IllegalArgumentException in case any of the input parameters is {@code null} */ public void setNewEffectivePolicyForOutputMessageScope( final PolicyMapKey key, final Policy newEffectivePolicy) { getMap().setNewEffectivePolicyForScope(PolicyMap.ScopeType.OUTPUT_MESSAGE, key, newEffectivePolicy); }