jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/PolicyMapUtil.java
changeset 23782 953bfc3fbe31
parent 22678 ac1ea46be942
equal deleted inserted replaced
23403:85dbdc227c5e 23782:953bfc3fbe31
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    32 import com.sun.xml.internal.ws.policy.subject.WsdlBindingSubject;
    32 import com.sun.xml.internal.ws.policy.subject.WsdlBindingSubject;
    33 
    33 
    34 import java.util.Collection;
    34 import java.util.Collection;
    35 import java.util.HashMap;
    35 import java.util.HashMap;
    36 import java.util.LinkedList;
    36 import java.util.LinkedList;
       
    37 import java.util.Map.Entry;
    37 import javax.xml.namespace.QName;
    38 import javax.xml.namespace.QName;
    38 
    39 
    39 /**
    40 /**
    40  * Utility methods that operate on a PolicyMap.
    41  * Utility methods that operate on a PolicyMap.
    41  *
    42  *
   100                 }
   101                 }
   101             }
   102             }
   102         }
   103         }
   103 
   104 
   104         final PolicyMapKeyConverter converter = new PolicyMapKeyConverter(serviceName, portName);
   105         final PolicyMapKeyConverter converter = new PolicyMapKeyConverter(serviceName, portName);
   105         for (WsdlBindingSubject wsdlSubject : subjectToPolicies.keySet()) {
   106         for (Entry<WsdlBindingSubject, Collection<Policy>> entry : subjectToPolicies.entrySet()) {
   106             final PolicySubject newSubject = new PolicySubject(wsdlSubject, subjectToPolicies.get(wsdlSubject));
   107             WsdlBindingSubject wsdlSubject = entry.getKey();
       
   108             Collection<Policy> policySet = entry.getValue();
       
   109             final PolicySubject newSubject = new PolicySubject(wsdlSubject, policySet);
   107             PolicyMapKey mapKey = converter.getPolicyMapKey(wsdlSubject);
   110             PolicyMapKey mapKey = converter.getPolicyMapKey(wsdlSubject);
   108 
   111 
   109             if (wsdlSubject.isBindingSubject()) {
   112             if (wsdlSubject.isBindingSubject()) {
   110                 policyMap.putSubject(ScopeType.ENDPOINT, mapKey, newSubject);
   113                 policyMap.putSubject(ScopeType.ENDPOINT, mapKey, newSubject);
   111             }
   114             } else if (wsdlSubject.isBindingOperationSubject()) {
   112             else if (wsdlSubject.isBindingOperationSubject()) {
       
   113                 policyMap.putSubject(ScopeType.OPERATION, mapKey, newSubject);
   115                 policyMap.putSubject(ScopeType.OPERATION, mapKey, newSubject);
   114             }
   116             } else if (wsdlSubject.isBindingMessageSubject()) {
   115             else if (wsdlSubject.isBindingMessageSubject()) {
       
   116                 switch (wsdlSubject.getMessageType()) {
   117                 switch (wsdlSubject.getMessageType()) {
   117                     case INPUT:
   118                     case INPUT:
   118                         policyMap.putSubject(ScopeType.INPUT_MESSAGE, mapKey, newSubject);
   119                         policyMap.putSubject(ScopeType.INPUT_MESSAGE, mapKey, newSubject);
   119                         break;
   120                         break;
   120                     case OUTPUT:
   121                     case OUTPUT:
   121                         policyMap.putSubject(ScopeType.OUTPUT_MESSAGE, mapKey, newSubject);
   122                         policyMap.putSubject(ScopeType.OUTPUT_MESSAGE, mapKey, newSubject);
   122                         break;
   123                         break;
   123                     case FAULT:
   124                     case FAULT:
   124                         policyMap.putSubject(ScopeType.FAULT_MESSAGE, mapKey, newSubject);
   125                         policyMap.putSubject(ScopeType.FAULT_MESSAGE, mapKey, newSubject);
   125                         break;
   126                         break;
       
   127                     default:
       
   128                         break;
   126                 }
   129                 }
   127             }
   130             }
   128         }
   131         }
   129 
   132 
   130         LOGGER.exiting();
   133         LOGGER.exiting();