Based on the section 11.1 from Java CAA spec, shouldn't we be checking
for more stuff when identifying the JAX-WS async callback and pooling
methods ? Below is the snipet from the spec that describes the logic
to identify the methods:
The additional client-side asynchronous polling and callback methods
defined by JAX-WS are recognized in a Java interface as follows:
For each method M in the interface, if another method P in the interface has
a) a method name that is M's method name with the characters
"Async" appended, and
b) the same parameter signature as M, and
c)a return type of Response<R> where R is the return type of M
then P is a JAX-WS polling method that isn't part of the SCA interface contract.
For each method M in the interface, if another method C in the interface has
a) a method name that is M's method name with the characters
"Async" appended, and
b) a parameter signature that is M's parameter signature with an additional
final parameter of type AsyncHandler<R> where R is the return
type of M, and
c) a return type of Future<?>
then C is a JAX-WS callback method that isn't part of the SCA
interface contract.
It seems that we are not checking if R type is valid when checking
Response<R> and AsyncHandler<R>. I had implemented the logic to test
these in JAXWSAsyncInterfaceProcessor.
Also, any reason why not to use a separate Interface visitor to handle
this check, instead of adding this directly into the
JavaInterfaceIntrospectorImpl ?
On Fri, Oct 23, 2009 at 3:25 AM, <[email protected]> wrote:
> Author: antelder
> Date: Fri Oct 23 10:25:33 2009
> New Revision: 828990
>
> URL: http://svn.apache.org/viewvc?rev=828990&view=rev
> Log:
> Update JavaInterfaceIntrospectorImpl to not consider teh JAXWS Async API
> methods in the overloaded ops on remotable interfaces
>
> Modified:
>
> tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
>
> Modified:
> tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
> URL:
> http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java?rev=828990&r1=828989&r2=828990&view=diff
> ==============================================================================
> ---
> tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
> (original)
> +++
> tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
> Fri Oct 23 10:25:33 2009
> @@ -31,8 +31,11 @@
> import java.util.List;
> import java.util.Map;
> import java.util.Set;
> +import java.util.concurrent.Future;
>
> import javax.xml.namespace.QName;
> +import javax.xml.ws.AsyncHandler;
> +import javax.xml.ws.Response;
>
> import org.apache.tuscany.sca.interfacedef.DataType;
> import org.apache.tuscany.sca.interfacedef.InvalidAnnotationException;
> @@ -187,7 +190,7 @@
> if (remotable && names.contains(name)) {
> throw new OverloadedOperationException(method);
> }
> - if (remotable) {
> + if (remotable && !jaxwsAsyncMethod(method)) {
> names.add(name);
> }
>
> @@ -254,4 +257,22 @@
> return operations;
> }
>
> + private boolean jaxwsAsyncMethod(Method method) {
> + if (method.getName().endsWith("Async")) {
> + if (method.getName().endsWith("Async")) {
> + if (method.getReturnType().isAssignableFrom(Future.class)) {
> + if (method.getParameterTypes().length > 0) {
> + if
> (method.getParameterTypes()[method.getParameterTypes().length-1].isAssignableFrom(AsyncHandler.class))
> {
> + return true;
> + }
> + }
> + }
> + if (method.getReturnType().isAssignableFrom(Response.class))
> {
> + return true;
> + }
> + }
> + }
> + return false;
> + }
> +
> }
>
>
>
--
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/