Search in sources :

Example 6 with PolicySubject

use of com.sun.xml.ws.policy.PolicySubject in project metro-jax-ws by eclipse-ee4j.

the class BuilderHandler method getPolicySubjects.

final Collection<PolicySubject> getPolicySubjects() throws PolicyException {
    final Collection<Policy> policies = getPolicies();
    final Collection<PolicySubject> result = new ArrayList<>(policies.size());
    for (Policy policy : policies) {
        result.add(new PolicySubject(policySubject, policy));
    }
    return result;
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) ArrayList(java.util.ArrayList)

Example 7 with PolicySubject

use of com.sun.xml.ws.policy.PolicySubject in project metro-jax-ws by eclipse-ee4j.

the class AlternativeSelectorTest method testDoSelectionAlternativesFault.

public void testDoSelectionAlternativesFault() throws PolicyException {
    final PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    final PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    final PolicySubject subject = new PolicySubject("dummy", this.multipleAlternativesPolicy);
    final PolicyMapKey key = PolicyMap.createWsdlFaultMessageScopeKey(new QName("service"), new QName("port"), new QName("operation"), new QName("fault"));
    extender.putFaultMessageSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getFaultMessageEffectivePolicy(key);
    if (result.contains(this.assertion1Name)) {
        assertFalse(result.contains(this.assertion2Name));
    } else if (result.contains(this.assertion2Name)) {
        assertFalse(result.contains(this.assertion1Name));
    } else {
        fail("Expected exactly one assertion in the resulting policy.");
    }
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) QName(javax.xml.namespace.QName) PolicyMapMutator(com.sun.xml.ws.policy.PolicyMapMutator) PolicyMapExtender(com.sun.xml.ws.policy.PolicyMapExtender)

Example 8 with PolicySubject

use of com.sun.xml.ws.policy.PolicySubject in project metro-jax-ws by eclipse-ee4j.

the class AlternativeSelectorTest method testDoSelectionAlternativesOperation.

/**
 * Test of doSelection method, of class AlternativeSelector.
 */
public void testDoSelectionAlternativesOperation() throws PolicyException {
    final PolicyMapExtender extender = PolicyMapExtender.createPolicyMapExtender();
    final PolicyMap map = PolicyMap.createPolicyMap(Arrays.asList(new PolicyMapMutator[] { extender }));
    final PolicySubject subject = new PolicySubject("dummy", this.multipleAlternativesPolicy);
    final PolicyMapKey key = PolicyMap.createWsdlOperationScopeKey(new QName("service"), new QName("port"), new QName("operation"));
    extender.putOperationSubject(key, subject);
    final EffectivePolicyModifier modifier = EffectivePolicyModifier.createEffectivePolicyModifier();
    modifier.connect(map);
    AlternativeSelector.doSelection(modifier);
    final Policy result = map.getOperationEffectivePolicy(key);
    if (result.contains(this.assertion1Name)) {
        assertFalse(result.contains(this.assertion2Name));
    } else if (result.contains(this.assertion2Name)) {
        assertFalse(result.contains(this.assertion1Name));
    } else {
        fail("Expected exactly one assertion in the resulting policy.");
    }
}
Also used : Policy(com.sun.xml.ws.policy.Policy) PolicySubject(com.sun.xml.ws.policy.PolicySubject) EffectivePolicyModifier(com.sun.xml.ws.policy.EffectivePolicyModifier) PolicyMap(com.sun.xml.ws.policy.PolicyMap) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) QName(javax.xml.namespace.QName) PolicyMapMutator(com.sun.xml.ws.policy.PolicyMapMutator) PolicyMapExtender(com.sun.xml.ws.policy.PolicyMapExtender)

Example 9 with PolicySubject

use of com.sun.xml.ws.policy.PolicySubject in project metro-jax-ws by eclipse-ee4j.

the class AddressingPolicyMapConfigurator method update.

/**
 * Puts an addressing policy into the PolicyMap if the addressing feature was set.
 */
public Collection<PolicySubject> update(final PolicyMap policyMap, final SEIModel model, final WSBinding wsBinding) throws PolicyException {
    LOGGER.entering(policyMap, model, wsBinding);
    Collection<PolicySubject> subjects = new ArrayList<>();
    if (policyMap != null) {
        final AddressingFeature addressingFeature = wsBinding.getFeature(AddressingFeature.class);
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("addressingFeature = " + addressingFeature);
        }
        if ((addressingFeature != null) && addressingFeature.isEnabled()) {
            // add wsam:Addrressing assertion if not exists.
            addWsamAddressing(subjects, policyMap, model, addressingFeature);
        }
    }
    // endif policy map not null
    LOGGER.exiting(subjects);
    return subjects;
}
Also used : PolicySubject(com.sun.xml.ws.policy.PolicySubject) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) ArrayList(java.util.ArrayList)

Example 10 with PolicySubject

use of com.sun.xml.ws.policy.PolicySubject in project metro-jax-ws by eclipse-ee4j.

the class PolicyWSDLGeneratorExtension method selectAndProcessBindingSubject.

private void selectAndProcessBindingSubject(final TypedXmlWriter xmlWriter, final Class clazz, final ScopeType scopeType, final QName bindingName) {
    LOGGER.entering(xmlWriter, clazz, scopeType, bindingName);
    if ((subjects != null) && (bindingName != null)) {
        for (PolicySubject subject : subjects) {
            if (subject.getSubject() instanceof WsdlBindingSubject) {
                final WsdlBindingSubject wsdlSubject = (WsdlBindingSubject) subject.getSubject();
                if (bindingName.equals(wsdlSubject.getName())) {
                    writePolicyOrReferenceIt(subject, xmlWriter);
                }
            }
        }
    }
    selectAndProcessSubject(xmlWriter, clazz, scopeType, bindingName);
    LOGGER.exiting();
}
Also used : PolicySubject(com.sun.xml.ws.policy.PolicySubject) WsdlBindingSubject(com.sun.xml.ws.policy.subject.WsdlBindingSubject)

Aggregations

PolicySubject (com.sun.xml.ws.policy.PolicySubject)16 Policy (com.sun.xml.ws.policy.Policy)10 QName (javax.xml.namespace.QName)8 PolicyMapExtender (com.sun.xml.ws.policy.PolicyMapExtender)7 EffectivePolicyModifier (com.sun.xml.ws.policy.EffectivePolicyModifier)6 PolicyMap (com.sun.xml.ws.policy.PolicyMap)6 PolicyMapKey (com.sun.xml.ws.policy.PolicyMapKey)6 PolicyMapMutator (com.sun.xml.ws.policy.PolicyMapMutator)6 WsdlBindingSubject (com.sun.xml.ws.policy.subject.WsdlBindingSubject)4 WebServiceException (jakarta.xml.ws.WebServiceException)3 ArrayList (java.util.ArrayList)3 PolicyException (com.sun.xml.ws.policy.PolicyException)2 TypedXmlWriter (com.sun.xml.txw2.TypedXmlWriter)1 AddressingPolicyMapConfigurator (com.sun.xml.ws.addressing.policy.AddressingPolicyMapConfigurator)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 JavaMethod (com.sun.xml.ws.api.model.JavaMethod)1 WSDLBoundFault (com.sun.xml.ws.api.model.wsdl.WSDLBoundFault)1 WSDLBoundOperation (com.sun.xml.ws.api.model.wsdl.WSDLBoundOperation)1 MtomPolicyMapConfigurator (com.sun.xml.ws.encoding.policy.MtomPolicyMapConfigurator)1 PolicyMapConfigurator (com.sun.xml.ws.policy.jaxws.spi.PolicyMapConfigurator)1