Search in sources :

Example 1 with FastInfosetFeature

use of com.sun.xml.ws.api.fastinfoset.FastInfosetFeature in project metro-jax-ws by eclipse-ee4j.

the class FastInfosetFeatureConfigurator method getFeatures.

/**
 * Process FastInfoset policy assertions.
 *
 * @param key Key to identify the endpoint scope.
 * @param policyMap the policy map.
 * @throws PolicyException If retrieving the policy triggered an exception.
 */
public Collection<WebServiceFeature> getFeatures(final PolicyMapKey key, final PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null != policy && policy.contains(EncodingConstants.OPTIMIZED_FI_SERIALIZATION_ASSERTION)) {
            Iterator<AssertionSet> assertions = policy.iterator();
            while (assertions.hasNext()) {
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while (policyAssertion.hasNext()) {
                    PolicyAssertion assertion = policyAssertion.next();
                    if (EncodingConstants.OPTIMIZED_FI_SERIALIZATION_ASSERTION.equals(assertion.getName())) {
                        String value = assertion.getAttributeValue(enabled);
                        boolean isFastInfosetEnabled = Boolean.valueOf(value.trim());
                        features.add(new FastInfosetFeature(isFastInfosetEnabled));
                    }
                // end-if non optional fast infoset assertion found
                }
            // next assertion
            }
        // next alternative
        }
    // end-if policy contains fast infoset assertion
    }
    return features;
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicyAssertion(com.sun.xml.ws.policy.PolicyAssertion) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) AssertionSet(com.sun.xml.ws.policy.AssertionSet) LinkedList(java.util.LinkedList) FastInfosetFeature(com.sun.xml.ws.api.fastinfoset.FastInfosetFeature)

Aggregations

FastInfosetFeature (com.sun.xml.ws.api.fastinfoset.FastInfosetFeature)1 AssertionSet (com.sun.xml.ws.policy.AssertionSet)1 Policy (com.sun.xml.ws.policy.Policy)1 PolicyAssertion (com.sun.xml.ws.policy.PolicyAssertion)1 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)1 LinkedList (java.util.LinkedList)1