FileDocCategorySizeDatePackage
MtomModelConfiguratorProvider.javaAPI DocExample4690Tue May 29 16:56:32 BST 2007com.sun.xml.ws.encoding.policy

MtomModelConfiguratorProvider

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

Fields Summary
Constructors Summary
public MtomModelConfiguratorProvider()
Creates a new instance of MtomModelConfiguratorProvider

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

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

        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);
                if (null!=policy && policy.contains(OPTIMIZED_MIME_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(OPTIMIZED_MIME_SERIALIZATION_ASSERTION.equals(assertion.getName()) && !assertion.isOptional()){
                                port.getBinding().addFeature(new MTOMFeature(true));
                            } // end-if non optional mtom assertion found
                        } // next assertion
                    } // next alternative
                } // end-if policy contains mtom assertion
            } // end foreach port
        } // end foreach service