You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jp...@apache.org on 2013/02/08 09:46:03 UTC
svn commit: r1443886 - in /cxf/branches/2.7.x-fixes:
rt/core/src/main/java/org/apache/cxf/service/factory/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/
rt/frontend/simple/src/main/java/org/apache/cxf/frontend/
rt/ws/policy/src/main/java/org/ap...
Author: jpell
Date: Fri Feb 8 08:46:02 2013
New Revision: 1443886
URL: http://svn.apache.org/r1443886
Log:
CXF-4816 added support for method @Policy annotations in jaxws implementations
Removed:
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceClient.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceClient.java
Modified:
cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleService.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceImpl.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleService.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslcertclient.xml
cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml
Modified: cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java (original)
+++ cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListener.java Fri Feb 8 08:46:02 2013
@@ -100,7 +100,7 @@ public interface FactoryBeanListener {
SERVER_CREATED,
/**
- * BindingInfo, BindingOperationInfo
+ * BindingInfo, BindingOperationInfo, Implementation Method
*/
BINDING_OPERATION_CREATED,
Modified: cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Fri Feb 8 08:46:02 2013
@@ -2325,7 +2325,7 @@ public class ReflectionServiceFactoryBea
return 1;
}
- protected MethodDispatcher getMethodDispatcher() {
+ public MethodDispatcher getMethodDispatcher() {
return methodDispatcher;
}
protected void setMethodDispatcher(MethodDispatcher m) {
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java Fri Feb 8 08:46:02 2013
@@ -184,7 +184,7 @@ public class AbstractJAXRSFactoryBean ex
BindingInfo bi = bindingFactory.createBindingInfo(serviceFactory.getService(),
binding, bindingConfig);
for (BindingOperationInfo boi : bi.getOperations()) {
- serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, boi, boi);
+ serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, bi, boi, null);
}
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, bi);
@@ -244,7 +244,7 @@ public class AbstractJAXRSFactoryBean ex
for (ClassResourceInfo cri : list) {
initializeAnnotationInterceptors(ep, cri.getServiceClass());
serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep,
- cri.getServiceClass());
+ cri.getServiceClass(), null);
}
return ep;
}
Modified: cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java Fri Feb 8 08:46:02 2013
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.frontend;
+import java.lang.reflect.Method;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -342,7 +343,8 @@ public abstract class AbstractWSDLBasedE
for (BindingOperationInfo boi : inf.getOperations()) {
serviceFactory.updateBindingOperation(boi);
- serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, inf, boi);
+ Method m = serviceFactory.getMethodDispatcher().getMethod(boi);
+ serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, inf, boi, m);
}
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, inf);
return inf;
Modified: cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java Fri Feb 8 08:46:02 2013
@@ -86,7 +86,7 @@ public class PolicyAnnotationListener im
case ENDPOINT_SELECTED: {
Class<?> cls = (Class<?>)args[2];
- Class<?> implCls = args.length > 3 ? (Class<?>)args[3] : null;
+ Class<?> implCls = (Class<?>)args[3];
Endpoint ep = (Endpoint)args[1];
if (ep.getEndpointInfo().getInterface() != null) {
addPolicies(factory, ep, cls);
@@ -107,12 +107,22 @@ public class PolicyAnnotationListener im
break;
}
+ case BINDING_OPERATION_CREATED:
+ BindingOperationInfo boi = (BindingOperationInfo) args[1];
+ Method m = (Method)args[2];
+ addPolicies(factory, boi.getOperationInfo(), m);
+ break;
+
default:
//ignore
}
}
private void addPolicies(AbstractServiceFactoryBean factory, OperationInfo inf, Method m) {
+ if (m == null) {
+ return;
+ }
+
Policy p = m.getAnnotation(Policy.class);
Policies ps = m.getAnnotation(Policies.class);
if (p != null || ps != null) {
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java Fri Feb 8 08:46:02 2013
@@ -38,8 +38,8 @@ import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.service.model.MessageInfo.Type;
import org.apache.cxf.systest.ws.common.SecurityTestUtil;
import org.apache.cxf.systest.ws.policy.javafirst.BindingSimpleService;
-import org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleServiceClient;
-import org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleServiceClient;
+import org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService;
+import org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleService;
import org.apache.cxf.systest.ws.policy.server.JavaFirstPolicyServer;
import org.apache.cxf.systest.ws.wssec11.client.UTPasswordCallback;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -213,9 +213,9 @@ public class JavaFirstPolicyServiceTest
"org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml"
});
- NoAlternativesOperationSimpleServiceClient simpleService = clientContext
+ NoAlternativesOperationSimpleService simpleService = clientContext
.getBean("NoAlternativesOperationSimpleServiceClient",
- NoAlternativesOperationSimpleServiceClient.class);
+ NoAlternativesOperationSimpleService.class);
try {
simpleService.doStuff();
@@ -262,9 +262,9 @@ public class JavaFirstPolicyServiceTest
"org/apache/cxf/systest/ws/policy/client/sslcertclient.xml"
});
- NoAlternativesOperationSimpleServiceClient simpleService = clientContext
+ NoAlternativesOperationSimpleService simpleService = clientContext
.getBean("NoAlternativesOperationSimpleServiceClient",
- NoAlternativesOperationSimpleServiceClient.class);
+ NoAlternativesOperationSimpleService.class);
try {
simpleService.doStuff();
@@ -307,8 +307,8 @@ public class JavaFirstPolicyServiceTest
"org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml"
});
- OperationSimpleServiceClient simpleService = clientContext
- .getBean("OperationSimpleServiceClient", OperationSimpleServiceClient.class);
+ OperationSimpleService simpleService = clientContext
+ .getBean("OperationSimpleServiceClient", OperationSimpleService.class);
try {
simpleService.doStuff();
@@ -340,8 +340,8 @@ public class JavaFirstPolicyServiceTest
"org/apache/cxf/systest/ws/policy/client/sslcertclient.xml"
});
- OperationSimpleServiceClient simpleService = clientContext
- .getBean("OperationSimpleServiceClient", OperationSimpleServiceClient.class);
+ OperationSimpleService simpleService = clientContext
+ .getBean("OperationSimpleServiceClient", OperationSimpleService.class);
try {
simpleService.doStuff();
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleService.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleService.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleService.java Fri Feb 8 08:46:02 2013
@@ -22,19 +22,12 @@ package org.apache.cxf.systest.ws.policy
import javax.jws.WebMethod;
import javax.jws.WebService;
-import org.apache.cxf.annotations.Policy;
-import org.apache.cxf.annotations.Policy.Placement;
-
@WebService(name = "NoAlternativesOperationSimpleService",
targetNamespace = "http://www.example.org/contract/NoAlternativesOperationSimpleService")
-public interface NoAlternativesOperationSimpleService {
- @Policy(uri = "classpath:/java_first_policies/UsernamePolicy.xml",
- placement = Placement.BINDING_OPERATION)
+public interface NoAlternativesOperationSimpleService {
@WebMethod(operationName = "doStuff")
void doStuff();
- @Policy(uri = "classpath:/java_first_policies/UsernamePasswordPolicy.xml",
- placement = Placement.BINDING_OPERATION)
@WebMethod(operationName = "ping")
void ping();
}
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceImpl.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceImpl.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/NoAlternativesOperationSimpleServiceImpl.java Fri Feb 8 08:46:02 2013
@@ -21,15 +21,22 @@ package org.apache.cxf.systest.ws.policy
import javax.jws.WebService;
+import org.apache.cxf.annotations.Policy;
+import org.apache.cxf.annotations.Policy.Placement;
+
@WebService(name = "NoAlternativesOperationSimpleService",
endpointInterface = "org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService",
serviceName = "NoAlternativesOperationSimpleService",
targetNamespace = "http://www.example.org/contract/NoAlternativesOperationSimpleService")
public class NoAlternativesOperationSimpleServiceImpl implements NoAlternativesOperationSimpleService {
+ @Policy(uri = "classpath:/java_first_policies/UsernamePolicy.xml",
+ placement = Placement.BINDING_OPERATION)
@Override
public void doStuff() {
}
+ @Policy(uri = "classpath:/java_first_policies/UsernamePasswordPolicy.xml",
+ placement = Placement.BINDING_OPERATION)
@Override
public void ping() {
}
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleService.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleService.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleService.java Fri Feb 8 08:46:02 2013
@@ -22,13 +22,9 @@ package org.apache.cxf.systest.ws.policy
import javax.jws.WebMethod;
import javax.jws.WebService;
-import org.apache.cxf.annotations.Policy;
-import org.apache.cxf.annotations.Policy.Placement;
-
@WebService(name = "OperationSimpleService",
targetNamespace = "http://www.example.org/contract/OperationSimpleService")
public interface OperationSimpleService {
- @Policy(uri = "classpath:/java_first_policies/AlternativesPolicy.xml", placement = Placement.BINDING_OPERATION)
@WebMethod(operationName = "doStuff")
void doStuff();
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java Fri Feb 8 08:46:02 2013
@@ -21,10 +21,14 @@ package org.apache.cxf.systest.ws.policy
import javax.jws.WebService;
+import org.apache.cxf.annotations.Policy;
+import org.apache.cxf.annotations.Policy.Placement;
+
@WebService(name = "OperationSimpleService",
endpointInterface = "org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleService",
serviceName = "OperationSimpleService", targetNamespace = "http://www.example.org/contract/OperationSimpleService")
public class OperationSimpleServiceImpl implements OperationSimpleService {
+ @Policy(uri = "classpath:/java_first_policies/AlternativesPolicy.xml", placement = Placement.BINDING_OPERATION)
@Override
public void doStuff() {
}
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslcertclient.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslcertclient.xml?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslcertclient.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslcertclient.xml Fri Feb 8 08:46:02 2013
@@ -51,12 +51,12 @@
</jaxws:client>
<jaxws:client id="OperationSimpleServiceClient"
- serviceClass="org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleServiceClient"
+ serviceClass="org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleService"
address="https://localhost:${testutil.ports.JavaFirstPolicyServer.3}/OperationSimpleService">
</jaxws:client>
<jaxws:client id="NoAlternativesOperationSimpleServiceClient"
- serviceClass="org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleServiceClient"
+ serviceClass="org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService"
address="https://localhost:${testutil.ports.JavaFirstPolicyServer.3}/NoAlternativesOperationSimpleService">
</jaxws:client>
</beans>
Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml?rev=1443886&r1=1443885&r2=1443886&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml Fri Feb 8 08:46:02 2013
@@ -46,12 +46,12 @@
</jaxws:client>
<jaxws:client id="OperationSimpleServiceClient"
- serviceClass="org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleServiceClient"
+ serviceClass="org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleService"
address="https://localhost:${testutil.ports.JavaFirstPolicyServer.3}/OperationSimpleService">
</jaxws:client>
<jaxws:client id="NoAlternativesOperationSimpleServiceClient"
- serviceClass="org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleServiceClient"
+ serviceClass="org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService"
address="https://localhost:${testutil.ports.JavaFirstPolicyServer.3}/NoAlternativesOperationSimpleService">
</jaxws:client>
</beans>