FileDocCategorySizeDatePackage
AddressingModelConfiguratorProvider.javaAPI DocExample5611Tue May 29 16:56:30 BST 2007com.sun.xml.ws.addressing.policy

AddressingModelConfiguratorProvider

public class AddressingModelConfiguratorProvider extends Object implements com.sun.xml.ws.policy.jaxws.spi.ModelConfiguratorProvider
author
japod

Fields Summary
private static final com.sun.xml.ws.policy.privateutil.PolicyLogger
logger
private static final QName[]
AddressingAssertions
Constructors Summary
public AddressingModelConfiguratorProvider()
Creates a new instance of AddressingModelConfiguratorProvider


               
      
    
Methods Summary
public voidconfigure(com.sun.xml.ws.api.model.wsdl.WSDLModel model, com.sun.xml.ws.policy.PolicyMap policyMap)
process addressing policy assertions and if found and are not optional then addressing is enabled on the {@link com.sun.xml.ws.api.model.wsdl.WSDLBoundPortType}

param
model must be non-null
param
policyMap must be non-null

        logger.entering();
        if ((null==model) || (null==policyMap)) {
            return;
        }
        for (WSDLService service:model.getServices().values()) {
            for (WSDLPort port : service.getPorts()) {
                PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(service.getName(),port.getName());
                Policy policy = policyMap.getEndpointEffectivePolicy(key);
                for (QName addressingAssertionQName : AddressingAssertions) {
                    if (null!=policy && policy.contains(addressingAssertionQName)) {
                        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(assertion.getName().equals(addressingAssertionQName) && !assertion.isOptional()){
                                    WebServiceFeature feature = AddressingVersion.getFeature(addressingAssertionQName.getNamespaceURI(), true, true);
                                    // TODO: clean up logging
                                    //logger.fine("configure", "calling port.addFeature " + feature);
                                    port.addFeature(feature);
                                } // end-if non optional wsa assertion found
                            } // next assertion
                        } // next alternative
                    } // end-if policy contains wsa assertion
                } // end foreach port
            } //end foreach addr assertion
        } // end foreach service
        logger.exiting();