Author: andreasmyth
Date: Fri Aug 3 01:44:27 2007
New Revision: 562386
URL: http://svn.apache.org/viewvc?view=rev&rev=562386
Log:
Added custom bean to configure external policy attachment providers.
Changed ws_policy demo to use custom beans and features instead of plain Spring
beans.
Added:
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/beans.xml
- copied, changed from r562186,
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/engine.xml
Removed:
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/engine.xml
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/NamespaceHandler.java
incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy-config.xsd
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-optional.xml
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
Fri Aug 3 01:44:27 2007
@@ -19,44 +19,23 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:p="http://cxf.apache.org/policy-config"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
- xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
- http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+ xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/policy-config
http://cxf.apache.org/schemas/policy-config.xsd
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<http:conduit
name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
<http:client
DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
</http:conduit>
- <bean id="org.apache.cxf.ws.policy.PolicyEngine"
class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
- <property name="bus" ref="cxf"/>
- <property name="enabled" value="true"/>
- </bean>
-
- <bean id="loggingIn"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
- <bean id="loggingOut"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
-
- <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
- <property name="inInterceptors">
- <list>
- <ref bean="loggingIn"/>
- </list>
- </property>
- <!--
- <property name="inFaultInterceptors">
- <list>
- </list>
- </property>
- -->
- <property name="outInterceptors">
- <list>
- <ref bean="loggingOut"/>
- </list>
- </property>
- <property name="outFaultInterceptors">
- <list>
- <ref bean="loggingOut"/>
- </list>
- </property>
- </bean>
+ <cxf:bus>
+ <cxf:features>
+ <p:policies/>
+ </cxf:features>
+ </cxf:bus>
</beans>
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
Fri Aug 3 01:44:27 2007
@@ -19,19 +19,19 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:p="http://cxf.apache.org/policy-config"
xsi:schemaLocation="
-http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="org.apache.cxf.ws.policy.PolicyEngine"
class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
- <property name="bus" ref="cxf"/>
- <property name="enabled" value="true"/>
- </bean>
-
- <bean
class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
- <constructor-arg ref="cxf"/>
- <property name="location" value="addr-external.xml"/>
- </bean>
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/policy-config
http://cxf.apache.org/schemas/policy-config.xsd
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
+ <cxf:bus>
+ <cxf:features>
+ <p:policies/>
+ </cxf:features>
+ </cxf:bus>
+
+ <p:externalAttachment location="addr-external.xml"/>
</beans>
Modified:
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
Fri Aug 3 01:44:27 2007
@@ -56,6 +56,10 @@
bus = b;
}
+ public void setBus(Bus b) {
+ bus = b;
+ }
+
public void setBuilder(PolicyBuilder b) {
builder = b;
}
Modified:
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/NamespaceHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/NamespaceHandler.java?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/NamespaceHandler.java
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/NamespaceHandler.java
Fri Aug 3 01:44:27 2007
@@ -24,6 +24,8 @@
public void init() {
registerBeanDefinitionParser("policies", new
PolicyFeatureBeanDefinitionParser());
registerBeanDefinitionParser("engine", new
PolicyEngineBeanDefinitionParser());
- registerBeanDefinitionParser("constants", new
PolicyConstantsBeanDefinitionParser());
+ registerBeanDefinitionParser("constants", new
PolicyConstantsBeanDefinitionParser());
+ registerBeanDefinitionParser("externalAttachment",
+ new
ExternalAttachmentProviderBeanDefinitionParser());
}
}
Modified:
incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy-config.xsd
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy-config.xsd?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy-config.xsd
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/main/resources/schemas/policy-config.xsd
Fri Aug 3 01:44:27 2007
@@ -115,4 +115,24 @@
</xsd:attribute>
</xsd:complexType>
</xsd:element>
+
+ <xsd:element name="externalAttachment">
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="beans:identifiedType">
+ <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
+ <xsd:attribute name="location" type="xsd:string"
default="http://www.w3.org/2006/07/ws-policy">
+ <xsd:annotation>
+ <xsd:documentation>
+ Location of the external attachment document.
+ It must be specified in form of a Spring Resource type
property, e.g.
+ classpath:etc/policies.xml or
file:/x1/resources/polcies.xml.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
</xsd:schema>
Modified:
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/PolicyBeansTest.java
Fri Aug 3 01:44:27 2007
@@ -18,11 +18,16 @@
*/
package org.apache.cxf.ws.policy.spring;
+import java.util.Collection;
+
import junit.framework.Assert;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.ws.policy.PolicyConstants;
import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyEngineImpl;
+import org.apache.cxf.ws.policy.PolicyProvider;
+import org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider;
import org.apache.cxf.ws.policy.selector.MaximalAlternativeSelector;
import org.junit.After;
import org.junit.Test;
@@ -40,7 +45,7 @@
@Test
public void testParse() {
- bus = new
SpringBusFactory().createBus("org/apache/cxf/ws/policy/spring/engine.xml");
+ bus = new
SpringBusFactory().createBus("org/apache/cxf/ws/policy/spring/beans.xml");
PolicyEngine pe = bus.getExtension(PolicyEngine.class);
assertTrue("Policy engine is not enabled", pe.isEnabled());
assertTrue("Unknown assertions are not ignored",
pe.isIgnoreUnknownAssertions());
@@ -50,6 +55,17 @@
assertEquals("http://www.w3.org/ns/ws-policy",
bus.getExtension(PolicyConstants.class).getNamespace());
+
+ PolicyEngineImpl pei = (PolicyEngineImpl)pe;
+ Collection<PolicyProvider> providers = pei.getPolicyProviders();
+ assertEquals(4, providers.size());
+ int n = 0;
+ for (PolicyProvider pp : providers) {
+ if (pp instanceof ExternalAttachmentProvider) {
+ n++;
+ }
+ }
+ assertEquals("Unexpected number of external providers", 2, n);
}
Copied:
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/beans.xml
(from r562186,
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/engine.xml)
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/beans.xml?view=diff&rev=562386&p1=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/engine.xml&r1=562186&p2=incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/beans.xml&r2=562386
==============================================================================
---
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/engine.xml
(original)
+++
incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/spring/beans.xml
Fri Aug 3 01:44:27 2007
@@ -32,12 +32,18 @@
<p:engine
enabled="true"
- ignoreUnknownAssertions="true" >
+ ignoreUnknownAssertions="true">
<p:alternativeSelector>
<bean
class="org.apache.cxf.ws.policy.selector.MaximalAlternativeSelector"/>
</p:alternativeSelector>
</p:engine>
<p:constants namespace="http://www.w3.org/ns/ws-policy"/>
+
+ <p:externalAttachment id="external4"
+
location="classpath:/org/apache/cxf/ws/policy/attachment/external/attachments4.xml"/>
+
+ <p:externalAttachment
+
location="classpath:/org/apache/cxf/ws/policy/attachment/external/attachments3.xml"/>
</beans>
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-optional.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-optional.xml?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-optional.xml
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-optional.xml
Fri Aug 3 01:44:27 2007
@@ -43,9 +43,7 @@
</cxf:features>
</cxf:bus>
- <bean
class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
- <constructor-arg ref="cxf"/>
- <property name="location"
value="org/apache/cxf/systest/ws/policy/addr-optional-external.xml"/>
- </bean>
+ <p:externalAttachment
location="org/apache/cxf/systest/ws/policy/addr-optional-external.xml"/>
+
</beans>
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml?view=diff&rev=562386&r1=562385&r2=562386
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml
Fri Aug 3 01:44:27 2007
@@ -38,9 +38,6 @@
</cxf:features>
</cxf:bus>
- <bean
class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
- <constructor-arg ref="cxf"/>
- <property name="location"
value="org/apache/cxf/systest/ws/policy/addr-external.xml"/>
- </bean>
+ <p:externalAttachment
location="org/apache/cxf/systest/ws/policy/addr-external.xml"/>
</beans>