static NestedPolicy createNestedPolicy(final AssertionSet set) { return new NestedPolicy(set); }
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); }
/** * Returns the AssertionSet instance representing a single policy alterantive held wihtin this nested policy object. * If the nested policy represents a policy with no alternatives (i.e. nothing is allowed) the method returns {@code null}. * * @return nested policy alternative represented by AssertionSet object. May return {@code null} in case the nested policy * represents 'nothing allowed' policy. */ public AssertionSet getAssertionSet() { final Iterator<AssertionSet> iterator = iterator(); if (iterator.hasNext()) { return iterator.next(); } else { return null; } }
@Override protected ModelNode translate(final ModelNode parentAssertion, final NestedPolicy policy) { final ModelNode nestedPolicyRoot = parentAssertion.createChildPolicyNode(); final AssertionSet set = policy.getAssertionSet(); translate(nestedPolicyRoot, set); return nestedPolicyRoot; }
boolean requiresNonAnonymousResponses = false; if (nestedPolicy != null) { requiresAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION); requiresNonAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION);
/** * An {@code Object.toString()} method override. */ @Override public String toString() { return toString(0, new StringBuffer()).toString(); }
/** * An {@code Object.equals(Object obj)} method override. */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof PolicyAssertion)) { return false; } final PolicyAssertion that = (PolicyAssertion) obj; boolean result = true; result = result && this.data.equals(that.data); result = result && this.parameters.equals(that.parameters); result = result && ((this.getNestedPolicy() == null) ? ((that.getNestedPolicy() == null) ? true : false) : this.getNestedPolicy().equals(that.getNestedPolicy())); return result; }
@Override protected ModelNode translate(final ModelNode parentAssertion, final NestedPolicy policy) { final ModelNode nestedPolicyRoot = parentAssertion.createChildPolicyNode(); final ModelNode exactlyOneNode = nestedPolicyRoot.createChildExactlyOneNode(); final AssertionSet set = policy.getAssertionSet(); final ModelNode alternativeNode = exactlyOneNode.createChildAllNode(); translate(alternativeNode, set); return nestedPolicyRoot; }
boolean requiresNonAnonymousResponses = false; if (nestedPolicy != null) { requiresAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION); requiresNonAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION);
/** * A helper method that appends indented string representation of this instance to the input string buffer. * * @param indentLevel indentation level to be used. * @param buffer buffer to be used for appending string representation of this instance * @return modified buffer containing new string representation of the instance */ protected StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("Assertion[").append(this.getClass().getName()).append("] {").append(PolicyUtils.Text.NEW_LINE); data.toString(indentLevel + 1, buffer); buffer.append(PolicyUtils.Text.NEW_LINE); if (hasParameters()) { buffer.append(innerIndent).append("parameters {").append(PolicyUtils.Text.NEW_LINE); for (PolicyAssertion parameter : parameters) { parameter.toString(indentLevel + 2, buffer).append(PolicyUtils.Text.NEW_LINE); } buffer.append(innerIndent).append('}').append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("no parameters").append(PolicyUtils.Text.NEW_LINE); } if (hasNestedPolicy()) { getNestedPolicy().toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("no nested policy").append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
/** * Checks whether this policy alternative is compatible with the provided policy alternative. * * @param assertion policy alternative used for compatibility test * @param mode compatibility mode to be used * @return {@code true} if the two policy alternatives are compatible, {@code false} otherwise */ boolean isCompatibleWith(final PolicyAssertion assertion, PolicyIntersector.CompatibilityMode mode) { boolean result = this.data.getName().equals(assertion.data.getName()) && (this.hasNestedPolicy() == assertion.hasNestedPolicy()); if (result && this.hasNestedPolicy()) { result = this.getNestedPolicy().getAssertionSet().isCompatibleWith(assertion.getNestedPolicy().getAssertionSet(), mode); } return result; }
boolean requiresNonAnonymousResponses = false; if (nestedPolicy != null) { requiresAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION); requiresNonAnonymousResponses = nestedPolicy.contains(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION);
protected ComplexAssertion() { super(); this.nestedPolicy = NestedPolicy.createNestedPolicy(AssertionSet.emptyAssertionSet()); }
static NestedPolicy createNestedPolicy(final String name, final String policyId, final AssertionSet set) { return new NestedPolicy(name, policyId, set); }
public Fitness validateServerSide(PolicyAssertion assertion) { if (!supportedAssertions.contains(assertion.getName())) return Fitness.UNKNOWN; //Make sure wsam:Addressing contains only one of the allowed nested assertions. if (assertion.getName().equals(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION)) { NestedPolicy nestedPolicy = assertion.getNestedPolicy(); if (nestedPolicy != null) { boolean requiresAnonymousResponses = false; boolean requiresNonAnonymousResponses = false; for (PolicyAssertion nestedAsser : nestedPolicy.getAssertionSet()) { if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION)) { requiresAnonymousResponses = true; } else if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION)) { requiresNonAnonymousResponses = true; } else { LOGGER.warning("Found unsupported assertion:\n" + nestedAsser + "\nnested into assertion:\n" + assertion); return Fitness.UNSUPPORTED; } } if (requiresAnonymousResponses && requiresNonAnonymousResponses) { LOGGER.warning("Only one among AnonymousResponses and NonAnonymousResponses can be nested in an Addressing assertion"); return Fitness.INVALID; } } } return Fitness.SUPPORTED; }
/** * Creates generic assertionand stores the data specified in input parameters * * @param assertionData assertion creation data specifying the details of newly created assertion. May be {@code null}. * @param assertionParameters collection of assertions parameters of this policy assertion. May be {@code null}. * @param nestedAlternative assertion set specifying nested policy alternative. May be {@code null}. * * @deprecated Non-abstract assertion types should derive from {@link SimpleAssertion} * or {@link ComplexAssertion} instead. {@link Policy} class will not provide support for * nested policy alternatives in the future. This responsibility is delegated to * {@link ComplexAssertion} class instead. */ @Deprecated protected PolicyAssertion(final AssertionData assertionData, final Collection<? extends PolicyAssertion> assertionParameters, final AssertionSet nestedAlternative) { this.data = assertionData; if (nestedAlternative != null) { this.nestedPolicy = NestedPolicy.createNestedPolicy(nestedAlternative); } this.parameters = AssertionSet.createAssertionSet(assertionParameters); }
public Fitness validateServerSide(PolicyAssertion assertion) { if (!supportedAssertions.contains(assertion.getName())) return Fitness.UNKNOWN; //Make sure wsam:Addressing contains only one of the allowed nested assertions. if (assertion.getName().equals(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION)) { NestedPolicy nestedPolicy = assertion.getNestedPolicy(); if (nestedPolicy != null) { boolean requiresAnonymousResponses = false; boolean requiresNonAnonymousResponses = false; for (PolicyAssertion nestedAsser : nestedPolicy.getAssertionSet()) { if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION)) { requiresAnonymousResponses = true; } else if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION)) { requiresNonAnonymousResponses = true; } else { LOGGER.warning("Found unsupported assertion:\n" + nestedAsser + "\nnested into assertion:\n" + assertion); return Fitness.UNSUPPORTED; } } if (requiresAnonymousResponses && requiresNonAnonymousResponses) { LOGGER.warning("Only one among AnonymousResponses and NonAnonymousResponses can be nested in an Addressing assertion"); return Fitness.INVALID; } } } return Fitness.SUPPORTED; }
public Fitness validateServerSide(PolicyAssertion assertion) { if (!supportedAssertions.contains(assertion.getName())) return Fitness.UNKNOWN; //Make sure wsam:Addressing contains only one of the allowed nested assertions. if (assertion.getName().equals(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION)) { NestedPolicy nestedPolicy = assertion.getNestedPolicy(); if (nestedPolicy != null) { boolean requiresAnonymousResponses = false; boolean requiresNonAnonymousResponses = false; for (PolicyAssertion nestedAsser : nestedPolicy.getAssertionSet()) { if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION)) { requiresAnonymousResponses = true; } else if (nestedAsser.getName().equals(W3CAddressingMetadataConstants.WSAM_NONANONYMOUS_NESTED_ASSERTION)) { requiresNonAnonymousResponses = true; } else { LOGGER.warning("Found unsupported assertion:\n" + nestedAsser + "\nnested into assertion:\n" + assertion); return Fitness.UNSUPPORTED; } } if (requiresAnonymousResponses && requiresNonAnonymousResponses) { LOGGER.warning("Only one among AnonymousResponses and NonAnonymousResponses can be nested in an Addressing assertion"); return Fitness.INVALID; } } } return Fitness.SUPPORTED; }