Author: rfeng
Date: Wed Jun 11 08:25:58 2008
New Revision: 666703

URL: http://svn.apache.org/viewvc?rev=666703&view=rev
Log:
Add the missing file in the previous commit

Modified:
    
incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java

Modified: 
incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java?rev=666703&r1=666702&r2=666703&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
 Wed Jun 11 08:25:58 2008
@@ -69,15 +69,16 @@
         this.visitors = javaFactory.getInterfaceVisitors();
     }
 
-    public void introspectInterface(JavaInterface javaInterface, Class<?> 
clazz) throws InvalidInterfaceException {
+    public void introspectInterface(JavaInterface javaInterface, Class<?> 
clazz)
+        throws InvalidInterfaceException {
         javaInterface.setJavaClass(clazz);
 
         boolean remotable = clazz.isAnnotationPresent(Remotable.class);
-        
+
         // Consider @javax.ejb.Remote, java.rmi.Remote and javax.ejb.EJBObject
         // equivalent to @Remotable
         if (!remotable) {
-            for (Annotation annotation: clazz.getAnnotations()) {
+            for (Annotation annotation : clazz.getAnnotations()) {
                 if 
("javax.ejb.Remote".equals(annotation.annotationType().getName())) {
                     remotable = true;
                     break;
@@ -85,14 +86,14 @@
             }
         }
         if (!remotable) {
-            for (Class<?> superInterface: clazz.getInterfaces()) {
+            for (Class<?> superInterface : clazz.getInterfaces()) {
                 if (Remote.class == superInterface || 
"javax.ejb.EJBObject".equals(superInterface.getName())) {
                     remotable = true;
                     break;
                 }
             }
         }
-        
+
         javaInterface.setRemotable(remotable);
 
         boolean conversational = 
clazz.isAnnotationPresent(Conversational.class);
@@ -103,10 +104,10 @@
         if (callback != null && !Void.class.equals(callback.value())) {
             callbackClass = callback.value();
             if (remotable && 
!callbackClass.isAnnotationPresent(Remotable.class)) {
-               throw new InvalidCallbackException("Callback must be remotable 
on a remotable interface");
+                throw new InvalidCallbackException("Callback must be remotable 
on a remotable interface");
             }
             if (!remotable && 
callbackClass.isAnnotationPresent(Remotable.class)) {
-               throw new InvalidCallbackException("Callback must not be 
remotable on a local interface");
+                throw new InvalidCallbackException("Callback must not be 
remotable on a local interface");
             }
         } else if (callback != null && Void.class.equals(callback.value())) {
             throw new InvalidCallbackException("No callback interface 
specified on annotation");
@@ -141,10 +142,15 @@
         return rawType;
     }
 
-    private <T> List<Operation> getOperations(Class<T> clazz, boolean 
remotable, boolean conversational, String ns)
-        throws InvalidInterfaceException {
-
-        Type[] genericInterfaces = clazz.getGenericInterfaces();
+    private <T> List<Operation> getOperations(Class<T> clazz,
+                                              boolean remotable,
+                                              boolean conversational,
+                                              String ns) throws 
InvalidInterfaceException {
+
+        Set<Type> genericInterfaces = new HashSet<Type>();
+        for (Type t : clazz.getGenericInterfaces()) {
+            genericInterfaces.add(t);
+        }
         Map<String, Type> typeBindings = new HashMap<String, Type>();
         for (Type genericInterface : genericInterfaces) {
             if (genericInterface instanceof ParameterizedType) {
@@ -182,16 +188,16 @@
             boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
             if (nonBlocking) {
                 if (!(returnType == void.class)) {
-                        throw new InvalidOperationException(
-                             "Method should return 'void' when declared with 
an @OneWay annotation. "+method,
-                             method);
+                    throw new InvalidOperationException(
+                                                        "Method should return 
'void' when declared with an @OneWay annotation. " + method,
+                                                        method);
                 }
                 if (!(faultTypes.length == 0)) {
-                        throw new InvalidOperationException(
-                             "Method should not declare exceptions with an 
@OneWay annotation. "+method,
-                             method);
+                    throw new InvalidOperationException(
+                                                        "Method should not 
declare exceptions with an @OneWay annotation. " + method,
+                                                        method);
                 }
-             }
+            }
 
             ConversationSequence conversationSequence = 
ConversationSequence.CONVERSATION_NONE;
             if (method.isAnnotationPresent(EndsConversation.class)) {
@@ -208,23 +214,29 @@
             // Set outputType to null for void
             XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
             DataType<XMLType> returnDataType =
-                returnType == void.class ? null : new 
DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType,
-                                                                            
xmlReturnType);
+                returnType == void.class ? null : new 
DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType, method
+                    .getGenericReturnType(), xmlReturnType);
             List<DataType> paramDataTypes = new 
ArrayList<DataType>(parameterTypes.length);
+            Type[] genericParamTypes = method.getGenericParameterTypes();
             for (int i = 0; i < parameterTypes.length; i++) {
                 Class paramType = parameterTypes[i];
                 XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), 
null);
-                paramDataTypes.add(new 
DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, paramType, xmlParamType));
+                paramDataTypes.add(new 
DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, paramType, genericParamTypes[i],
+                                                             xmlParamType));
             }
             List<DataType> faultDataTypes = new 
ArrayList<DataType>(faultTypes.length);
-            for (Class<?> faultType : faultTypes) {
+            Type[] genericFaultTypes = method.getGenericExceptionTypes();
+            for (int i = 0; i < faultTypes.length; i++) {
+                Class<?> faultType = faultTypes[i];
                 // Only add checked exceptions
                 // JAXWS Specification v2.1 section 3.7 says RemoteException 
should not be mapped
                 if (Exception.class.isAssignableFrom(faultType) && 
(!RuntimeException.class.isAssignableFrom(faultType))
                     && (!RemoteException.class.isAssignableFrom(faultType))) {
                     XMLType xmlFaultType = new XMLType(new QName(ns, 
faultType.getSimpleName()), null);
-                    DataType<XMLType> faultDataType = new 
DataTypeImpl<XMLType>(faultType, xmlFaultType);
-                    faultDataTypes.add(new 
DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, faultDataType));
+                    DataType<XMLType> faultDataType =
+                        new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, 
faultType, genericFaultTypes[i], xmlFaultType);
+                    faultDataTypes.add(new 
DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i],
+                                                                  
faultDataType));
                 }
             }
 


Reply via email to