FileDocCategorySizeDatePackage
WSDLPolicyMapWrapper.javaAPI DocExample9977Tue May 29 16:56:36 BST 2007com.sun.xml.ws.policy.jaxws

WSDLPolicyMapWrapper

public class WSDLPolicyMapWrapper extends Object implements com.sun.xml.ws.api.model.wsdl.WSDLExtension
TODO: write doc
author
Jakub Podlesak (jakub.podlesak at sun.com)

Fields Summary
private static final com.sun.xml.ws.policy.privateutil.PolicyLogger
LOGGER
private static final QName
NAME
private static com.sun.xml.ws.policy.jaxws.spi.ModelConfiguratorProvider[]
configurators
private com.sun.xml.ws.policy.PolicyMap
policyMap
private com.sun.xml.ws.policy.EffectivePolicyModifier
mapModifier
private com.sun.xml.ws.policy.PolicyMapExtender
mapExtender
Constructors Summary
protected WSDLPolicyMapWrapper(com.sun.xml.ws.policy.PolicyMap policyMap)

    
    
       
        if (policyMap == null) {
            throw new IllegalArgumentException(LocalizationMessages.WSP_1016_POLICY_MAP_CAN_NOT_BE_NULL());
        }
        
        this.policyMap = policyMap;
    
public WSDLPolicyMapWrapper(com.sun.xml.ws.policy.PolicyMap policyMap, com.sun.xml.ws.policy.EffectivePolicyModifier modifier, com.sun.xml.ws.policy.PolicyMapExtender extender)

        this(policyMap);
        this.mapModifier = modifier;
        this.mapExtender = extender;
    
Methods Summary
voidaddClientConfigToMap(java.lang.Object clientWsitConfigId, com.sun.xml.ws.policy.PolicyMap clientPolicyMap)

        LOGGER.entering();
        
        try {
            for (PolicyMapKey key : clientPolicyMap.getAllServiceScopeKeys()) {
                final Policy policy = clientPolicyMap.getServiceEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putServiceSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            
            for (PolicyMapKey key : clientPolicyMap.getAllEndpointScopeKeys()) {
                final Policy policy = clientPolicyMap.getEndpointEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putEndpointSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            
            for (PolicyMapKey key : clientPolicyMap.getAllOperationScopeKeys()) {
                final Policy policy = clientPolicyMap.getOperationEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putOperationSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            
            for (PolicyMapKey key : clientPolicyMap.getAllInputMessageScopeKeys()) {
                final Policy policy = clientPolicyMap.getInputMessageEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putInputMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            
            for (PolicyMapKey key : clientPolicyMap.getAllOutputMessageScopeKeys()) {
                final Policy policy = clientPolicyMap.getOutputMessageEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putOutputMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            
            for (PolicyMapKey key : clientPolicyMap.getAllFaultMessageScopeKeys()) {
                final Policy policy = clientPolicyMap.getFaultMessageEffectivePolicy(key);
                // setting subject to provided URL of client WSIT config
                mapExtender.putFaultMessageSubject(key, new PolicySubject(clientWsitConfigId, policy));
            }
            LOGGER.fine(LocalizationMessages.WSP_1041_CLIENT_CFG_POLICIES_TRANSFERED_INTO_FINAL_POLICY_MAP(policyMap));
        } catch (FactoryConfigurationError ex) {
            throw LOGGER.logSevereException(new PolicyException(ex));
        }
        
        LOGGER.exiting();
    
voidconfigureModel(com.sun.xml.ws.api.model.wsdl.WSDLModel model)

        try {
            for (ModelConfiguratorProvider configurator : configurators) {
                configurator.configure(model, policyMap);
            }
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(LocalizationMessages.WSP_1032_FAILED_CONFIGURE_WSDL_MODEL(), e));
        }
    
public voiddoAlternativeSelection()

        EffectiveAlternativeSelector.doSelection(mapModifier);
    
public javax.xml.namespace.QNamegetName()

        return NAME;
    
public com.sun.xml.ws.policy.PolicyMapgetPolicyMap()

        return policyMap;
    
voidputEndpointSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putEndpointSubject(key, subject);
        }
    
voidputFaultMessageSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putFaultMessageSubject(key, subject);
        }
    
voidputInputMessageSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putInputMessageSubject(key, subject);
        }
    
voidputOperationSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putOperationSubject(key, subject);
        }
    
voidputOutputMessageSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putOutputMessageSubject(key, subject);
        }
    
voidputServiceSubject(com.sun.xml.ws.policy.PolicyMapKey key, com.sun.xml.ws.policy.PolicySubject subject)

        if (null != this.mapExtender) {
            this.mapExtender.putServiceSubject(key, subject);
        }
    
voidvalidateServerSidePolicies()

        final AssertionValidationProcessor validationProcessor = AssertionValidationProcessor.getInstance();
        for (Policy policy : policyMap) {
            
            // TODO:  here is a good place to check if the actual policy has only one alternative...
            
            for (AssertionSet assertionSet : policy) {
                for (PolicyAssertion assertion : assertionSet) {
                    PolicyAssertionValidator.Fitness validationResult = validationProcessor.validateServerSide(assertion);
                    if (validationResult != PolicyAssertionValidator.Fitness.SUPPORTED) {
                        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_1046_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                assertion.getName(),
                                validationResult)));
                    }
                }
            }
        }