cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r523385 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/test/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ r...
Date Wed, 28 Mar 2007 16:08:25 GMT
Author: andreasmyth
Date: Wed Mar 28 09:08:23 2007
New Revision: 523385

URL: http://svn.apache.org/viewvc?view=rev&rev=523385
Log:
[JIRA CXF-473] Adding more policy APIs so clients can access effective policies associated with a message/endpoint.
Used EndpointInfo instead of Endpoint to key effective policies.
Removed cxf-rt-ws-rm dependency on cxf-rt-ws-policy.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java   (with props)
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
      - copied, changed from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
      - copied, changed from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyInfo.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
      - copied, changed from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
      - copied, changed from r523191, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/OutPolicyInfoTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
      - copied, changed from r523191, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyInfoTest.java
Removed:
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyInfo.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyInfoTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/OutPolicyInfoTest.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptorTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptorTest.java
    incubator/cxf/trunk/rt/ws/rm/pom.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties?view=auto&rev=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties Wed Mar 28 09:08:23 2007
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+NO_ALTERNATIVE_EXC = None of the policy alternatives can be satisfied.
\ No newline at end of file

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/APIMessages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java Wed Mar 28 09:08:23 2007
@@ -22,15 +22,25 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ResourceBundle;
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
 
 /**
  * 
  */
 public class AssertionInfoMap extends HashMap<QName, Collection<AssertionInfo>> {
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionInfoMap.class, "APIMessages");
+    
     public AssertionInfoMap(Collection<Assertion> assertions) {
         super(assertions.size());
         for (Assertion a : assertions) {
@@ -42,5 +52,38 @@
             }
             ais.add(ai);
         }
+    }
+    
+    public boolean supportsAlternative(Collection<Assertion> alternative) {
+        
+        for (Assertion a : alternative) {
+            boolean asserted = false;
+            Collection<AssertionInfo> ais = get(a.getName());
+            if (null != ais) {
+                for (AssertionInfo ai : ais) {
+                    // if (ai.getAssertion() == a && ai.isAsserted()) {
+                    if (ai.getAssertion().equal(a) && ai.isAsserted()) {
+                        asserted = true;
+                        break;
+                    }
+                }
+            }
+            if (!asserted) {
+                return false;
+            }
+        }
+        
+        return true;
+    }
+    
+    public void checkEffectivePolicy(Policy policy) {
+        Iterator alternatives = policy.getAlternatives();
+        while (alternatives.hasNext()) {      
+            List<Assertion> alternative = CastUtils.cast((List)alternatives.next(), Assertion.class);
+            if (supportsAlternative(alternative)) {
+                return;
+            }
+        }
+        throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE));
     }
 }

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java?view=auto&rev=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java Wed Mar 28 09:08:23 2007
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+
+/**
+ * Describes the effective policy of an outbound message. 
+ */
+public interface EffectivePolicy {
+    
+    Policy getPolicy();
+    
+    Collection<Assertion> getChosenAlternative();
+    
+    List<Interceptor> getInterceptors();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java?view=auto&rev=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java Wed Mar 28 09:08:23 2007
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+
+/**
+ * Describes the policy of an inbound message. As the underlying message
+ * type is not known, only the effective endpoint policy is calculated. 
+ * The total of all assertions that may apply to an inbound message for an endpoint
+ * (and hence the required interceptors) are available as vocabulary.
+ */
+public interface EndpointPolicy {
+    
+    Policy getPolicy();
+    
+    Collection<Assertion> getChosenAlternative();
+    
+    Collection<Assertion> getVocabulary();
+    
+    Collection<Assertion> getFaultVocabulary();
+    
+    List<Interceptor> getInterceptors();
+    
+    List<Interceptor> getFaultInterceptors();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?view=auto&rev=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Wed Mar 28 09:08:23 2007
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.Destination;
+import org.apache.neethi.PolicyRegistry;
+
+/**
+ * 
+ */
+public interface PolicyEngine {
+
+    // available throughout the outbound path
+    
+    EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, Conduit c);
+    
+    void setEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
+    
+    EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                     Destination d);
+    
+    void setEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
+    
+    EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, Destination d);
+    
+    void setEffectiveServerFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep); 
+    
+    // available throughout the inbound path
+        
+    EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit);
+    
+    EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination);
+    
+    void setEndpointPolicy(EndpointInfo ei, EndpointPolicy ep);  
+    
+    // only available after message type has been determined
+    
+    EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi);
+    
+    void setEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
+    
+    EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi);
+    
+    void setEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, EffectivePolicy ep);
+    
+    EffectivePolicy getEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi);
+    
+    void setEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep);
+    
+    
+    
+    PolicyRegistry getRegistry();
+    
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java Wed Mar 28 09:08:23 2007
@@ -19,9 +19,14 @@
 
 package org.apache.cxf.ws.policy;
 
+import java.util.Collection;
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.extension.Registry;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.neethi.Assertion;
 
 
 /**
@@ -30,4 +35,7 @@
  */
 public interface PolicyInterceptorProviderRegistry 
     extends Registry<QName, PolicyInterceptorProvider> {
+    
+    List<Interceptor> getInterceptors(Collection<Assertion> alterative, boolean out, boolean fault);
+
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java Wed Mar 28 09:08:23 2007
@@ -62,5 +62,15 @@
         a.setData(data);
         return a;        
     } 
+    
+    @SuppressWarnings("unchecked")
+    public static <T> JaxbAssertion<T> cast(Assertion a) {
+        return (JaxbAssertion<T>)a;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> JaxbAssertion<T> cast(Assertion a, Class<T> type) {
+        return (JaxbAssertion<T>)a;
+    }
 
 }

Added: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java?view=auto&rev=523385
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java (added)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java Wed Mar 28 09:08:23 2007
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class AssertionInfoMapTest extends Assert {
+
+    private IMocksControl control;
+    
+    @Before
+    public void setUp() {
+        control = EasyMock.createNiceControl();        
+    } 
+    
+    @Test
+    public void testAlternativeSupported() {
+        Assertion a1 = control.createMock(Assertion.class);
+        QName aqn = new QName("http://x.y.z", "a");
+        EasyMock.expect(a1.getName()).andReturn(aqn).anyTimes();
+        Assertion a2 = control.createMock(Assertion.class);
+        EasyMock.expect(a2.getName()).andReturn(aqn).anyTimes();
+        Assertion b = control.createMock(Assertion.class);
+        QName bqn = new QName("http://x.y.z", "b");
+        EasyMock.expect(b.getName()).andReturn(bqn).anyTimes();
+        Assertion c = control.createMock(Assertion.class);
+        QName cqn = new QName("http://x.y.z", "c");
+        EasyMock.expect(c.getName()).andReturn(cqn).anyTimes();
+        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, Assertion.class));
+        AssertionInfo ai1 = new AssertionInfo(a1);
+        AssertionInfo ai2 = new AssertionInfo(a2);
+        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
+        AssertionInfo bi = new AssertionInfo(b);
+        AssertionInfo ci = new AssertionInfo(c);
+        ais.add(ai1);
+        ais.add(ai2);
+        aim.put(aqn, ais);
+        aim.put(bqn, Collections.singleton(bi));
+        aim.put(cqn, Collections.singleton(ci));
+        ai2.setAsserted(true);
+        bi.setAsserted(true);
+        ci.setAsserted(true);
+        EasyMock.expect(a1.equal(a1)).andReturn(true).anyTimes();
+        EasyMock.expect(a2.equal(a2)).andReturn(true).anyTimes();
+        EasyMock.expect(b.equal(b)).andReturn(true).anyTimes();
+        EasyMock.expect(c.equal(c)).andReturn(true).anyTimes();
+        
+        
+        List<Assertion> alt1 = new ArrayList<Assertion>();
+        alt1.add(a1);
+        alt1.add(b);
+        
+        List<Assertion> alt2 = new ArrayList<Assertion>();
+        alt2.add(a2);
+        alt2.add(c);
+                
+        control.replay();
+        assertTrue(!aim.supportsAlternative(alt1));
+        assertTrue(aim.supportsAlternative(alt2));
+        control.verify();     
+    }  
+    
+    @Test
+    public void testCheckEffectivePolicy() { 
+        Policy p = new Policy();
+        QName aqn = new QName("http://x.y.z", "a");
+        Assertion a = new PrimitiveAssertion(aqn);
+        QName bqn = new QName("http://x.y.z", "b");
+        Assertion b = new PrimitiveAssertion(bqn);
+        QName cqn = new QName("http://x.y.z", "c");
+        Assertion c = new PrimitiveAssertion(cqn);
+        All alt1 = new All();
+        alt1.addAssertion(a);
+        alt1.addAssertion(b);
+        All alt2 = new All();
+        alt2.addAssertion(c);
+        ExactlyOne ea = new ExactlyOne();
+        ea.addPolicyComponent(alt1);
+        ea.addPolicyComponent(alt2);
+        p.addPolicyComponent(ea);   
+        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, Assertion.class));
+        AssertionInfo ai = new AssertionInfo(a);
+        AssertionInfo bi = new AssertionInfo(b);
+        AssertionInfo ci = new AssertionInfo(c);
+        aim.put(aqn, Collections.singleton(ai));
+        aim.put(bqn, Collections.singleton(bi));
+        aim.put(cqn, Collections.singleton(ci));
+        
+        try {
+            aim.checkEffectivePolicy(p);
+            fail("Expected PolicyException not thrown.");
+        } catch (PolicyException ex) {
+            // expected
+        }
+        
+        ai.setAsserted(true);
+        ci.setAsserted(true);
+        
+        aim.checkEffectivePolicy(p);
+    }  
+}

Propchange: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java Wed Mar 28 09:08:23 2007
@@ -30,6 +30,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.neethi.Assertion;
 
@@ -59,6 +60,7 @@
             LOG.fine("No endpoint.");
             return;
         }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -68,19 +70,19 @@
         Conduit conduit = msg.getConduit();
         
         // We do not know the underlying message type yet - so we pre-emptively add interceptors 
-        // that can deal with the response and all of the operation's possible fault messages.
+        // that can deal with all faults returned to this client endpoint.
         
-        EndpointPolicyInfo epi = pe.getEndpointPolicyInfo(e, conduit);
+        EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit);
         
-        List<Interceptor> policyInFaultInterceptors = epi.getInFaultInterceptors();
-        for (Interceptor poi : policyInFaultInterceptors) {
-            msg.getInterceptorChain().add(poi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", poi.getClass().getSimpleName());
+        List<Interceptor> faultInterceptors = ep.getFaultInterceptors();
+        for (Interceptor i : faultInterceptors) {
+            msg.getInterceptorChain().add(i);
+            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of endpoint's fault vocabulary into message
         
-        Collection<Assertion> assertions = epi.getFaultVocabulary();
+        Collection<Assertion> assertions = ep.getFaultVocabulary();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java Wed Mar 28 09:08:23 2007
@@ -30,6 +30,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.neethi.Assertion;
 
@@ -59,6 +60,7 @@
             LOG.fine("No endpoint.");
             return;
         }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -68,19 +70,19 @@
         Conduit conduit = msg.getConduit();
         
         // We do not know the underlying message type yet - so we pre-emptively add interceptors 
-        // that can deal with the response and all of the operation's possible fault messages.
+        // that can deal with any resposes or faults returned to this client endpoint.
         
-        EndpointPolicyInfo epi = pe.getEndpointPolicyInfo(e, conduit);
+        EndpointPolicy ep = pe.getClientEndpointPolicy(ei, conduit);
         
-        List<Interceptor> policyInInterceptors = epi.getInInterceptors();
-        for (Interceptor poi : policyInInterceptors) {
-            msg.getInterceptorChain().add(poi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", poi.getClass().getSimpleName());            
+        List<Interceptor> interceptors = ep.getInterceptors();
+        for (Interceptor i : interceptors) {
+            msg.getInterceptorChain().add(i);
+            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());            
         }
         
         // insert assertions of endpoint's vocabulary into message
         
-        Collection<Assertion> assertions = epi.getVocabulary();
+        Collection<Assertion> assertions = ep.getVocabulary();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java Wed Mar 28 09:08:23 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.neethi.Assertion;
 
@@ -65,7 +66,8 @@
         if (null == e) {
             LOG.fine("No endpoint.");
             return;
-        }        
+        } 
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -76,17 +78,18 @@
         
         // add the required interceptors
         
-        OutPolicyInfo opi = pe.getClientRequestPolicyInfo(e, boi, conduit);
+        EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(ei, boi, conduit);
+        PolicyUtils.logPolicy(LOG, Level.FINEST, "Using effective policy: ", effectivePolicy.getPolicy());
         
-        List<Interceptor> policyOutInterceptors = opi.getInterceptors();
-        for (Interceptor poi : policyOutInterceptors) {            
-            msg.getInterceptorChain().add(poi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", poi.getClass().getSimpleName());
+        List<Interceptor> interceptors = effectivePolicy.getInterceptors();
+        for (Interceptor i : interceptors) {            
+            msg.getInterceptorChain().add(i);
+            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of the chosen alternative into the message
         
-        Collection<Assertion> assertions = opi.getChosenAlternative();
+        Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Copied: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java (from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?view=diff&rev=523385&p1=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java&r1=523191&p2=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java Wed Mar 28 09:08:23 2007
@@ -29,12 +29,12 @@
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Assertion;
@@ -43,62 +43,61 @@
 /**
  * 
  */
-public class OutPolicyInfo {
+public class EffectivePolicyImpl implements EffectivePolicy {
     
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(OutPolicyInfo.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(EffectivePolicyImpl.class);    
     
     protected Policy policy;     
     protected Collection<Assertion> chosenAlternative;
     protected List<Interceptor> interceptors;
     
-    public void initialise(EndpointPolicyInfo epi, PolicyEngine engine) {
+    public Policy getPolicy() {
+        return policy;        
+    }
+    
+    public List<Interceptor> getInterceptors() {
+        return interceptors;
+    }
+    
+    public Collection<Assertion> getChosenAlternative() {
+        return chosenAlternative;
+    }
+    
+    
+    void initialise(EndpointPolicyImpl epi, PolicyEngineImpl engine) {
         policy = epi.getPolicy();
         chosenAlternative = epi.getChosenAlternative();
         initialiseInterceptors(engine);  
     }
     
-    void initialise(Endpoint e, 
+    void initialise(EndpointInfo ei, 
                     BindingOperationInfo boi, 
-                    PolicyEngine engine, 
+                    PolicyEngineImpl engine, 
                     Assertor assertor,
                     boolean requestor) {
-        initialisePolicy(e, boi, engine, requestor);
+        initialisePolicy(ei, boi, engine, requestor);
         chooseAlternative(engine, assertor);
         initialiseInterceptors(engine);  
     }
     
-    void initialise(Endpoint e, 
+    void initialise(EndpointInfo ei, 
                     BindingFaultInfo bfi, 
-                    PolicyEngine engine, 
+                    PolicyEngineImpl engine, 
                     Assertor assertor) {
-        initialisePolicy(e, bfi, engine);
+        initialisePolicy(ei, bfi, engine);
         chooseAlternative(engine, assertor);
         initialiseInterceptors(engine);  
     }
-   
-    public Policy getPolicy() {
-        return policy;        
-    }
-    
-    public List<Interceptor> getInterceptors() {
-        return interceptors;
-    }
-    
-    public Collection<Assertion> getChosenAlternative() {
-        return chosenAlternative;
-    }
-    
-    
-    
-    void initialisePolicy(Endpoint e,
+     
+    void initialisePolicy(EndpointInfo ei,
                           BindingOperationInfo boi,  
-                          PolicyEngine engine, 
+                          PolicyEngineImpl engine, 
                           boolean requestor) {
         BindingMessageInfo bmi = requestor ? boi.getInput() : boi.getOutput();
         if (requestor) {
-            policy = engine.getEndpointPolicyInfo(e, (Conduit)null).getPolicy();
+            policy = engine.getClientEndpointPolicy(ei, (Conduit)null).getPolicy();
         } else {
-            policy = engine.getEndpointPolicyInfo(e, (Destination)null).getPolicy();
+            policy = engine.getServerEndpointPolicy(ei, (Destination)null).getPolicy();
         }
         
         policy = policy.merge(engine.getAggregatedOperationPolicy(boi));
@@ -108,15 +107,15 @@
         policy = (Policy)policy.normalize(true);
     }
     
-    void initialisePolicy(Endpoint e, BindingFaultInfo bfi, PolicyEngine engine) {
+    void initialisePolicy(EndpointInfo ei, BindingFaultInfo bfi, PolicyEngineImpl engine) {
         BindingOperationInfo boi = bfi.getBindingOperation();
-        policy = engine.getEndpointPolicyInfo(e, (Destination)null).getPolicy();         
+        policy = engine.getServerEndpointPolicy(ei, (Destination)null).getPolicy();         
         policy = policy.merge(engine.getAggregatedOperationPolicy(boi));
         policy = policy.merge(engine.getAggregatedFaultPolicy(bfi));
         policy = (Policy)policy.normalize(true);
     }
 
-    void chooseAlternative(PolicyEngine engine, Assertor assertor) {
+    void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) {
         Iterator alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
             List<Assertion> alternative = CastUtils.cast((List)alternatives.next(), Assertion.class);
@@ -129,7 +128,7 @@
 
     }
 
-    void initialiseInterceptors(PolicyEngine engine) {
+    void initialiseInterceptors(PolicyEngineImpl engine) {
         PolicyInterceptorProviderRegistry reg 
             = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
         List<Interceptor> out = new ArrayList<Interceptor>();
@@ -144,40 +143,6 @@
             }
         }
         setInterceptors(out);
-    }
-    
-    void checkEffectivePolicy(AssertionInfoMap aim) {
-        Iterator alternatives = policy.getAlternatives();
-        while (alternatives.hasNext()) {      
-            List<Assertion> alternative = CastUtils.cast((List)alternatives.next(), Assertion.class);
-            if (alternativeSupported(alternative, aim)) {
-                return;
-            }
-        }
-        
-        throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE));
-    }
-    
-    boolean alternativeSupported(List<Assertion> alternative, AssertionInfoMap aim) {
-        
-        for (Assertion a : alternative) {
-            boolean asserted = false;
-            Collection<AssertionInfo> ais = aim.get(a.getName());
-            if (null != ais) {
-                for (AssertionInfo ai : ais) {
-                    // if (ai.getAssertion() == a && ai.isAsserted()) {
-                    if (ai.getAssertion().equal(a) && ai.isAsserted()) {
-                        asserted = true;
-                        break;
-                    }
-                }
-            }
-            if (!asserted) {
-                return false;
-            }
-        }
-        
-        return true;
     }
     
     // for tests

Copied: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java (from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyInfo.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?view=diff&rev=523385&p1=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyInfo.java&r1=523191&p2=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyInfo.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java Wed Mar 28 09:08:23 2007
@@ -42,24 +42,17 @@
 /**
  * 
  */
-public class EndpointPolicyInfo {
+public class EndpointPolicyImpl implements EndpointPolicy {
     
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(EndpointPolicyInfo.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(EndpointPolicyImpl.class);
     
     private Policy policy;
     private Collection<Assertion> chosenAlternative;
     private Collection<Assertion> vocabulary;
     private Collection<Assertion> faultVocabulary;
-    private List<Interceptor> inInterceptors;
-    private List<Interceptor> inFaultInterceptors;
+    private List<Interceptor> interceptors;
+    private List<Interceptor> faultInterceptors;
     
-    void initialise(EndpointInfo ei, boolean isServer, PolicyEngine engine, Assertor assertor) {
-        initialisePolicy(ei, engine);
-        chooseAlternative(engine, assertor);
-        initialiseVocabulary(ei, isServer, engine);
-        initialiseInterceptors(ei, isServer, engine); 
-    }
-   
     public Policy getPolicy() {
         return policy;        
     }
@@ -76,21 +69,29 @@
         return faultVocabulary;
     }    
     
-    public List<Interceptor> getInInterceptors() {
-        return inInterceptors;
+    public List<Interceptor> getInterceptors() {
+        return interceptors;
+    }
+    
+    public List<Interceptor> getFaultInterceptors() {
+        return faultInterceptors;
     }
     
-    public List<Interceptor> getInFaultInterceptors() {
-        return inFaultInterceptors;
+    
+    void initialise(EndpointInfo ei, boolean isServer, PolicyEngineImpl engine, Assertor assertor) {
+        initialisePolicy(ei, engine);
+        chooseAlternative(engine, assertor);
+        initialiseVocabulary(ei, isServer, engine);
+        initialiseInterceptors(ei, isServer, engine); 
     }
-      
-    void initialisePolicy(EndpointInfo ei, PolicyEngine engine) {
+   
+    void initialisePolicy(EndpointInfo ei, PolicyEngineImpl engine) {
         policy = engine.getAggregatedServicePolicy(ei.getService());
         policy = policy.merge(engine.getAggregatedEndpointPolicy(ei));
         policy = (Policy)policy.normalize(true);
     }
 
-    void chooseAlternative(PolicyEngine engine, Assertor assertor) {
+    void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) {
         Iterator alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
             List<Assertion> alternative = CastUtils.cast((List)alternatives.next(), Assertion.class);
@@ -102,7 +103,7 @@
         throw new PolicyException(new Message("NO_ALTERNATIVE_EXC", BUNDLE));
     }
     
-    void initialiseVocabulary(EndpointInfo ei, boolean requestor, PolicyEngine engine) {
+    void initialiseVocabulary(EndpointInfo ei, boolean requestor, PolicyEngineImpl engine) {
         vocabulary = new ArrayList<Assertion>();
         if (requestor) {
             faultVocabulary = new ArrayList<Assertion>();
@@ -146,12 +147,12 @@
         }
     }
 
-    void initialiseInterceptors(EndpointInfo ei, boolean requestor, PolicyEngine engine) {
+    void initialiseInterceptors(EndpointInfo ei, boolean requestor, PolicyEngineImpl engine) {
         PolicyInterceptorProviderRegistry reg 
             = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
-        inInterceptors = new ArrayList<Interceptor>();
+        interceptors = new ArrayList<Interceptor>();
         if (requestor) {
-            inFaultInterceptors = new ArrayList<Interceptor>();
+            faultInterceptors = new ArrayList<Interceptor>();
         }
         
         Set<QName> v = new HashSet<QName>();
@@ -162,7 +163,7 @@
         for (QName qn : v) {
             PolicyInterceptorProvider pp = reg.get(qn);
             if (null != pp) {
-                inInterceptors.addAll(pp.getInInterceptors());
+                interceptors.addAll(pp.getInInterceptors());
             }
         }
         
@@ -178,7 +179,7 @@
         for (QName qn : faultV) {
             PolicyInterceptorProvider pp = reg.get(qn);
             if (null != pp) {
-                inFaultInterceptors.addAll(pp.getInFaultInterceptors());
+                faultInterceptors.addAll(pp.getInFaultInterceptors());
             }
         }        
     }
@@ -201,12 +202,12 @@
         faultVocabulary = v;
     }
     
-    void setInInterceptors(List<Interceptor> in) {
-        inInterceptors = in;
+    void setInterceptors(List<Interceptor> in) {
+        interceptors = in;
     }
     
-    void setInFaultInterceptors(List<Interceptor> inFault) {
-        inFaultInterceptors = inFault;
+    void setFaultInterceptors(List<Interceptor> inFault) {
+        faultInterceptors = inFault;
     }
     
     

Copied: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (from r523191, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?view=diff&rev=523385&p1=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java&r1=523191&p2=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Wed Mar 28 09:08:23 2007
@@ -31,7 +31,6 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.BindingFaultInfo;
@@ -52,60 +51,32 @@
 /**
  * 
  */
-public class PolicyEngine implements BusExtension {
-     
+public class PolicyEngineImpl implements PolicyEngine, BusExtension {
+    
     private Bus bus;
     private PolicyRegistry registry;
     private Collection<PolicyProvider> policyProviders;
     private boolean registerInterceptors;
 
-    private Map<BindingOperation, OutPolicyInfo> clientRequestInfo;
+    private Map<BindingOperation, EffectivePolicy> clientRequestInfo;
     
-    private Map<BindingOperation, OutPolicyInfo> clientResponseInfo;
+    private Map<BindingOperation, EffectivePolicy> clientResponseInfo;
     
-    private Map<BindingFault, OutPolicyInfo> clientFaultInfo;
+    private Map<BindingFault, EffectivePolicy> clientFaultInfo;
     
-    private Map<Endpoint, EndpointPolicyInfo> endpointInfo;
+    private Map<BindingOperation, EffectivePolicy> serverRequestInfo;
     
-    private Map<BindingOperation, OutPolicyInfo> serverRequestInfo;
+    private Map<BindingOperation, EffectivePolicy> serverResponseInfo;
     
-    private Map<BindingOperation, OutPolicyInfo> serverResponseInfo;
+    private Map<BindingFault, EffectivePolicy> serverFaultInfo;
     
-    private Map<BindingFault, OutPolicyInfo> serverFaultInfo;
+    private Map<EndpointInfo, EndpointPolicy> endpointInfo;
 
-    public PolicyEngine() {        
+    public PolicyEngineImpl() { 
         init();
     }
     
-    protected final void init() {
-        
-        registry = new PolicyRegistryImpl();
-        
-        clientRequestInfo 
-            = new ConcurrentHashMap<BindingOperation, OutPolicyInfo>();
-    
-        clientResponseInfo 
-            = new ConcurrentHashMap<BindingOperation, OutPolicyInfo>();
-    
-        clientFaultInfo 
-            = new ConcurrentHashMap<BindingFault, OutPolicyInfo>();
-    
-        endpointInfo 
-            = new ConcurrentHashMap<Endpoint, EndpointPolicyInfo>();
-    
-        serverRequestInfo 
-            = new ConcurrentHashMap<BindingOperation, OutPolicyInfo>();
-    
-        serverResponseInfo 
-            = new ConcurrentHashMap<BindingOperation, OutPolicyInfo>();
-    
-        serverFaultInfo 
-            = new ConcurrentHashMap<BindingFault, OutPolicyInfo>();
-    }
-    
-    public Class<?> getRegistrationType() {
-        return PolicyEngine.class;
-    }
+    // configuration
     
     public void setBus(Bus b) {
         bus = b;
@@ -139,6 +110,187 @@
         registerInterceptors = ri;
     }
     
+    // BusExtension interface
+    
+    public Class<?> getRegistrationType() {
+        return PolicyEngine.class;
+    }
+    
+    // PolicyEngine interface
+    
+    public EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                           Conduit c) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        EffectivePolicy effectivePolicy = clientRequestInfo.get(bo);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            Assertor assertor = null;
+            if (c instanceof Assertor) {
+                assertor = (Assertor)c;
+            }
+            epi.initialise(ei, boi, this, assertor, true);
+            clientRequestInfo.put(bo, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+    
+    public void setEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                EffectivePolicy ep) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        clientRequestInfo.put(bo, ep);
+    }
+    
+    public EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi,
+                                                            Destination d) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        EffectivePolicy effectivePolicy = serverResponseInfo.get(bo);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            Assertor assertor = null;
+            if (d instanceof Assertor) {
+                assertor = (Assertor)d;
+            }
+            epi.initialise(ei, boi, this, assertor, false);
+            serverResponseInfo.put(bo, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+
+    public void setEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                 EffectivePolicy ep) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        serverResponseInfo.put(bo, ep);
+    }
+      
+    public EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, 
+                                                         Destination d) {
+        BindingFault bf = new BindingFault(ei, bfi);
+        EffectivePolicy effectivePolicy = serverFaultInfo.get(bf);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            Assertor assertor = null;
+            if (d instanceof Assertor) {
+                assertor = (Assertor)d;
+            }
+            epi.initialise(ei, bfi, this, assertor);
+            serverFaultInfo.put(bf, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+
+    public void setEffectiveServerFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep) {
+        BindingFault bf = new BindingFault(ei, bfi);
+        serverFaultInfo.put(bf, ep);
+    }
+    
+    public EndpointPolicy getClientEndpointPolicy(EndpointInfo ei, Conduit conduit) {
+        EndpointPolicy endpointPolicy = endpointInfo.get(ei);
+        if (null != endpointPolicy) {
+            return endpointPolicy;
+        }
+        Assertor assertor = conduit instanceof Assertor ? (Assertor)conduit : null;
+        return createEndpointPolicyInfo(ei, false, assertor);
+    }
+   
+    public EndpointPolicy getServerEndpointPolicy(EndpointInfo ei, Destination destination) {
+        EndpointPolicy endpointPolicy = endpointInfo.get(ei);
+        if (null != endpointPolicy) {
+            return endpointPolicy;
+        }
+        Assertor assertor = destination instanceof Assertor ? (Assertor)destination : null;
+        return createEndpointPolicyInfo(ei, true, assertor);
+    }
+    
+    public void setEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
+        endpointInfo.put(ei, ep);
+    }
+    
+    public EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        EffectivePolicy effectivePolicy = serverRequestInfo.get(bo);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            epi.initialisePolicy(ei, boi, this, false);
+            serverRequestInfo.put(bo, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+    
+    public void setEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                EffectivePolicy ep) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        serverRequestInfo.put(bo, ep);
+    }
+    
+    public EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        EffectivePolicy effectivePolicy = clientResponseInfo.get(bo);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            epi.initialisePolicy(ei, boi, this, true);            
+            clientResponseInfo.put(bo, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+    
+    public void setEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, 
+                                                 EffectivePolicy ep) {
+        BindingOperation bo = new BindingOperation(ei, boi);
+        clientResponseInfo.put(bo, ep);
+    }
+    
+    public EffectivePolicy getEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi) {
+        BindingFault bf = new BindingFault(ei, bfi);
+        EffectivePolicy effectivePolicy = clientFaultInfo.get(bf);
+        if (null == effectivePolicy) {
+            EffectivePolicyImpl epi = createOutPolicyInfo();
+            epi.initialisePolicy(ei, bfi, this);
+            clientFaultInfo.put(bf, epi);
+            effectivePolicy = epi;
+        }
+        return effectivePolicy;
+    }
+    
+    public void setEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep) {
+        BindingFault bf = new BindingFault(ei, bfi);
+        clientFaultInfo.put(bf, ep);
+    }    
+    
+    // implementation
+    
+    protected final void init() {
+        
+        registry = new PolicyRegistryImpl();
+        
+        clientRequestInfo 
+            = new ConcurrentHashMap<BindingOperation, EffectivePolicy>();
+    
+        clientResponseInfo 
+            = new ConcurrentHashMap<BindingOperation, EffectivePolicy>();
+    
+        clientFaultInfo 
+            = new ConcurrentHashMap<BindingFault, EffectivePolicy>();
+    
+        endpointInfo 
+            = new ConcurrentHashMap<EndpointInfo, EndpointPolicy>();
+    
+        serverRequestInfo 
+            = new ConcurrentHashMap<BindingOperation, EffectivePolicy>();
+    
+        serverResponseInfo 
+            = new ConcurrentHashMap<BindingOperation, EffectivePolicy>();
+    
+        serverFaultInfo 
+            = new ConcurrentHashMap<BindingFault, EffectivePolicy>();
+    }
+    
+    
+    
     @PostConstruct
     public void addBusInterceptors() {
         if (null == bus || !registerInterceptors) {
@@ -176,7 +328,7 @@
         bus.getInFaultInterceptors().add(verifyInFault);
     }  
     
-    public Policy getAggregatedServicePolicy(ServiceInfo si) {
+    Policy getAggregatedServicePolicy(ServiceInfo si) {
         Policy aggregated = null;
         for (PolicyProvider pp : getPolicyProviders()) {
             Policy p = pp.getEffectivePolicy(si);
@@ -189,7 +341,7 @@
         return aggregated == null ? new Policy() : aggregated;
     }
 
-    public Policy getAggregatedEndpointPolicy(EndpointInfo ei) {
+    Policy getAggregatedEndpointPolicy(EndpointInfo ei) {
         Policy aggregated = null;
         for (PolicyProvider pp : getPolicyProviders()) {
             Policy p = pp.getEffectivePolicy(ei);
@@ -202,7 +354,7 @@
         return aggregated == null ? new Policy() : aggregated;
     }
     
-    public Policy getAggregatedOperationPolicy(BindingOperationInfo boi) {
+    Policy getAggregatedOperationPolicy(BindingOperationInfo boi) {
         Policy aggregated = null;
         for (PolicyProvider pp : getPolicyProviders()) {
             Policy p = pp.getEffectivePolicy(boi);
@@ -215,7 +367,7 @@
         return aggregated == null ? new Policy() : aggregated;
     }
     
-    public Policy getAggregatedMessagePolicy(BindingMessageInfo bmi) {
+    Policy getAggregatedMessagePolicy(BindingMessageInfo bmi) {
         Policy aggregated = null;
         for (PolicyProvider pp : getPolicyProviders()) {
             Policy p = pp.getEffectivePolicy(bmi);
@@ -228,7 +380,7 @@
         return aggregated == null ? new Policy() : aggregated;
     }
     
-    public Policy getAggregatedFaultPolicy(BindingFaultInfo bfi) {
+    Policy getAggregatedFaultPolicy(BindingFaultInfo bfi) {
         Policy aggregated = null;
         for (PolicyProvider pp : getPolicyProviders()) {
             Policy p = pp.getEffectivePolicy(bfi);
@@ -249,7 +401,7 @@
      * @param includeOptional flag indicating if optional assertions should be included
      * @return the assertions
      */
-    public Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
+    Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
         
         Collection<Assertion> assertions = new ArrayList<Assertion>();
         
@@ -295,7 +447,7 @@
      * @param includeOptional flag indicating if optional assertions should be included
      * @return the vocabulary
      */
-    public Set<QName> getVocabulary(PolicyComponent pc, boolean includeOptional) {
+    Set<QName> getVocabulary(PolicyComponent pc, boolean includeOptional) {
         Collection<Assertion> assertions = getAssertions(pc, includeOptional);
         Set<QName> vocabulary = new HashSet<QName>();
         for (Assertion a : assertions) {
@@ -303,147 +455,20 @@
         }
         return vocabulary;
     }
-    
-    public OutPolicyInfo getClientRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, Conduit c) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        OutPolicyInfo opi = clientRequestInfo.get(bo);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            Assertor assertor = null;
-            if (c instanceof Assertor) {
-                assertor = (Assertor)c;
-            }
-            opi.initialise(e, boi, this, assertor, true);
-            clientRequestInfo.put(bo, opi);
-        }
-        return opi;
-    }
-    
-    public void setClientRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        clientRequestInfo.put(bo, opi);
-    }
-    
-    public OutPolicyInfo getServerRequestPolicyInfo(Endpoint e, BindingOperationInfo boi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        OutPolicyInfo opi = serverRequestInfo.get(bo);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            opi.initialisePolicy(e, boi, this, false);
-            serverRequestInfo.put(bo, opi);
-        }
-        return opi;
-    }
-    
-    public void setServerRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        serverRequestInfo.put(bo, opi);
-    }
-    
-    public OutPolicyInfo getClientResponsePolicyInfo(Endpoint e, BindingOperationInfo boi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        OutPolicyInfo opi = clientResponseInfo.get(bo);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            opi.initialisePolicy(e, boi, this, true);
-            clientResponseInfo.put(bo, opi);
-        }
-        return opi;
-    }
-    
-    public void setClientResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        clientResponseInfo.put(bo, opi);
-    }
-    
-    public OutPolicyInfo getClientFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi) {
-        BindingFault bf = new BindingFault(e, bfi);
-        OutPolicyInfo opi = clientFaultInfo.get(bf);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            opi.initialisePolicy(e, bfi, this);
-            clientFaultInfo.put(bf, opi);
-        }
-        return opi;
-    }
-    
-    public void setClientFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, OutPolicyInfo opi) {
-        BindingFault bf = new BindingFault(e, bfi);
-        clientFaultInfo.put(bf, opi);
-    }
-    
-    public EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Conduit conduit) {
-        EndpointPolicyInfo epi = endpointInfo.get(e);
-        if (null != epi) {
-            return epi;
-        }
-        Assertor assertor = conduit instanceof Assertor ? (Assertor)conduit : null;
-        return createEndpointPolicyInfo(e, false, assertor);
-    }
+      
    
-    public EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Destination destination) {
-        EndpointPolicyInfo epi = endpointInfo.get(e);
-        if (null != epi) {
-            return epi;
-        }
-        Assertor assertor = destination instanceof Assertor ? (Assertor)destination : null;
-        return createEndpointPolicyInfo(e, true, assertor);
-    }
     
-    EndpointPolicyInfo createEndpointPolicyInfo(Endpoint e, boolean isServer, Assertor assertor) {
-        EndpointPolicyInfo epi = createEndpointPolicyInfo();
-        epi.initialise(e.getEndpointInfo(), isServer, this, assertor);
-        endpointInfo.put(e, epi);
+    
+    EndpointPolicyImpl createEndpointPolicyInfo(EndpointInfo ei, boolean isServer, Assertor assertor) {
+        EndpointPolicyImpl epi = createEndpointPolicyInfo();
+        epi.initialise(ei, isServer, this, assertor);
+        endpointInfo.put(ei, epi);
 
         return epi;
     }
     
-    public void setEndpointPolicyInfo(Endpoint e, EndpointPolicyInfo epi) {
-        endpointInfo.put(e, epi);
-    }
-    
-    
-    public OutPolicyInfo getServerResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, 
-                                                         Destination d) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        OutPolicyInfo opi = serverResponseInfo.get(bo);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            Assertor assertor = null;
-            if (d instanceof Assertor) {
-                assertor = (Assertor)d;
-            }
-            opi.initialise(e, boi, this, assertor, false);
-            serverResponseInfo.put(bo, opi);
-        }
-        return opi;
-    }
-    
-    public void setServerResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
-        BindingOperation bo = new BindingOperation(e, boi);
-        serverResponseInfo.put(bo, opi);
-    }
     
-    public OutPolicyInfo getServerFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, 
-                                                         Destination d) {
-        BindingFault bf = new BindingFault(e, bfi);
-        OutPolicyInfo opi = serverFaultInfo.get(bf);
-        if (null == opi) {
-            opi = createOutPolicyInfo();
-            Assertor assertor = null;
-            if (d instanceof Assertor) {
-                assertor = (Assertor)d;
-            }
-            opi.initialise(e, bfi, this, assertor);
-            serverFaultInfo.put(bf, opi);
-        }
-        return opi;
-    }
     
-    public void setServerFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, OutPolicyInfo opi) {
-        BindingFault bf = new BindingFault(e, bfi);
-        serverFaultInfo.put(bf, opi);
-    }
     
 
     /**
@@ -472,11 +497,11 @@
      * Class used as key in the client request policy and server response policy maps.
      */
     class BindingOperation {
-        Endpoint endpoint;
+        EndpointInfo ei;
         BindingOperationInfo boi;
         
-        BindingOperation(Endpoint e, BindingOperationInfo b) {
-            endpoint = e;
+        BindingOperation(EndpointInfo e, BindingOperationInfo b) {
+            ei = e;
             boi = b;
         }
 
@@ -488,9 +513,13 @@
         @Override
         public boolean equals(Object obj) {
             BindingOperation other = (BindingOperation)obj;
-            return boi.equals(other.boi) && endpoint.equals(other.endpoint);
+            return boi.equals(other.boi) && ei.equals(other.ei);
         }
         
+        @Override
+        public String toString() {
+            return ei.getName().toString() + "." + boi.getName().toString();
+        }
         
         
     }
@@ -499,11 +528,11 @@
      * Class used as key in the server fault policy map.
      */
     class BindingFault {
-        Endpoint endpoint;
+        EndpointInfo ei;
         BindingFaultInfo bfi;
         
-        BindingFault(Endpoint e, BindingFaultInfo b) {
-            endpoint = e;
+        BindingFault(EndpointInfo e, BindingFaultInfo b) {
+            ei = e;
             bfi = b;
         }
         
@@ -515,19 +544,22 @@
         @Override
         public boolean equals(Object obj) {
             BindingFault other = (BindingFault)obj;
-            return bfi.equals(other.bfi) && endpoint.equals(other.endpoint);
+            return bfi.equals(other.bfi) && ei.equals(other.ei);
+        }
+        
+        @Override
+        public String toString() {
+            return ei.getName().toString() + "." + bfi.getFaultInfo().toString();
         }
     }
     
     // for test
     
-    OutPolicyInfo createOutPolicyInfo() {
-        return new OutPolicyInfo();
+    EffectivePolicyImpl createOutPolicyInfo() {
+        return new EffectivePolicyImpl();
     }
     
-    EndpointPolicyInfo createEndpointPolicyInfo() {
-        return new EndpointPolicyInfo();
+    EndpointPolicyImpl createEndpointPolicyInfo() {
+        return new EndpointPolicyImpl();
     }
-
-
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Wed Mar 28 09:08:23 2007
@@ -19,12 +19,17 @@
 
 package org.apache.cxf.ws.policy;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.neethi.Assertion;
 
 /**
  * 
@@ -43,5 +48,22 @@
 
     public Class<?> getRegistrationType() {
         return PolicyInterceptorProviderRegistry.class;
+    }
+    
+    public List<Interceptor> getInterceptors(Collection<Assertion> alternative, boolean out, boolean fault) {
+        List<Interceptor> interceptors = new ArrayList<Interceptor>();
+        for (Assertion a : alternative) {
+            if (a.isOptional()) {
+                continue;
+            }
+            QName qn = a.getName();
+            PolicyInterceptorProvider pp = get(qn);
+            if (null != pp) {
+                interceptors.addAll(out                
+                    ? (fault ? pp.getOutFaultInterceptors() : pp.getOutInterceptors())       
+                    : (fault ? pp.getInFaultInterceptors() : pp.getInInterceptors())); 
+            }
+        }
+        return interceptors;
     }
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java Wed Mar 28 09:08:23 2007
@@ -28,6 +28,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 
 /**
  * 
@@ -66,7 +67,8 @@
         if (null == e) {
             LOG.fine("No endpoint.");
             return;
-        }        
+        }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -78,8 +80,8 @@
             return;
         }
         
-        OutPolicyInfo opi = pe.getClientFaultPolicyInfo(e, bfi);
-        opi.checkEffectivePolicy(aim);
+        EffectivePolicy effectivePolicy = pe.getEffectiveClientFaultPolicy(ei, bfi);
+        aim.checkEffectivePolicy(effectivePolicy.getPolicy());
         LOG.fine("Verified policies for inbound message.");
     }
 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java Wed Mar 28 09:08:23 2007
@@ -28,6 +28,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 
 /**
  * 
@@ -60,7 +61,8 @@
         if (null == e) {
             LOG.fine("No endpoint.");
             return;
-        }        
+        } 
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -77,14 +79,14 @@
             return;
         }
         
-        OutPolicyInfo opi = null;
+        EffectivePolicy effectivePolicy = null;
         if (PolicyUtils.isRequestor(message)) {
-            opi = pe.getClientResponsePolicyInfo(e, boi);
+            effectivePolicy = pe.getEffectiveClientResponsePolicy(ei, boi);
         } else {
-            opi = pe.getServerRequestPolicyInfo(e, boi);
+            effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi);
         }
                 
-        opi.checkEffectivePolicy(aim);
+        aim.checkEffectivePolicy(effectivePolicy.getPolicy());
         LOG.fine("Verified policies for inbound message.");
     }
 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java Wed Mar 28 09:08:23 2007
@@ -30,6 +30,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Assertion;
 
@@ -58,7 +59,8 @@
         if (null == e) {
             LOG.fine("No endpoint.");
             return;
-        }        
+        }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -68,19 +70,19 @@
         Destination destination = msg.getDestination();
         
         // We do not know the underlying message type yet - so we pre-emptively add interceptors 
-        // that can deal with any requests on the underlying endpoint
+        // that can deal with any messages to this endpoint
         
-        EndpointPolicyInfo epi = pe.getEndpointPolicyInfo(e, destination);
+        EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination);
         
-        List<Interceptor> policyInInterceptors = epi.getInInterceptors();
-        for (Interceptor poi : policyInInterceptors) {
-            msg.getInterceptorChain().add(poi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", poi.getClass().getSimpleName());
+        List<Interceptor> interceptors = ep.getInterceptors();
+        for (Interceptor i : interceptors) {
+            msg.getInterceptorChain().add(i);
+            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of endpoint's vocabulary into message
         
-        Collection<Assertion> assertions = epi.getVocabulary();
+        Collection<Assertion> assertions = ep.getVocabulary();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java Wed Mar 28 09:08:23 2007
@@ -32,6 +32,7 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Assertion;
 
@@ -67,6 +68,7 @@
             LOG.fine("No endpoint.");
             return;
         }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -84,17 +86,17 @@
             return;
         }  
         
-        OutPolicyInfo opi = pe.getServerFaultPolicyInfo(e, bfi, destination);
+        EffectivePolicy effectivePolicy = pe.getEffectiveServerFaultPolicy(ei, bfi, destination);
         
-        List<Interceptor> outInterceptors = opi.getInterceptors();
-        for (Interceptor oi : outInterceptors) {
+        List<Interceptor> interceptors = effectivePolicy.getInterceptors();
+        for (Interceptor oi : interceptors) {
             msg.getInterceptorChain().add(oi);
             LOG.log(Level.INFO, "Added interceptor of type {0}", oi.getClass().getSimpleName());
         }
         
         // insert assertions of the chosen alternative into the message
         
-        Collection<Assertion> assertions = opi.getChosenAlternative();
+        Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java Wed Mar 28 09:08:23 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Assertion;
 
@@ -66,6 +67,7 @@
             LOG.fine("No endpoint.");
             return;
         }
+        EndpointInfo ei = e.getEndpointInfo();
         
         PolicyEngine pe = bus.getExtension(PolicyEngine.class);
         if (null == pe) {
@@ -73,17 +75,17 @@
         }
         
         Destination destination = msg.getDestination();
-        OutPolicyInfo opi = pe.getServerResponsePolicyInfo(e, boi, destination);
+        EffectivePolicy effectivePolicy = pe.getEffectiveServerResponsePolicy(ei, boi, destination);
         
-        List<Interceptor> outInterceptors = opi.getInterceptors();
-        for (Interceptor oi : outInterceptors) {
+        List<Interceptor> interceptors = effectivePolicy.getInterceptors();
+        for (Interceptor oi : interceptors) {
             msg.getInterceptorChain().add(oi);
             LOG.log(Level.INFO, "Added interceptor of type {0}", oi.getClass().getSimpleName());           
         }
         
         // insert assertions of the chosen alternative into the message
              
-        Collection<Assertion> assertions = opi.getChosenAlternative();
+        Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
         if (null != assertions) {
             msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java?view=diff&rev=523385&r1=523384&r2=523385
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java Wed Mar 28 09:08:23 2007
@@ -22,14 +22,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyEngineImpl;
 import org.apache.cxf.ws.policy.PolicyProvider;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
-public class InitializingPolicyEngine extends PolicyEngine implements InitializingBean, 
+public class InitializingPolicyEngine extends PolicyEngineImpl implements InitializingBean, 
     ApplicationContextAware  {
 
     private ApplicationContext context;



Mime
View raw message