ws-wsif-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ow...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/java WSIFOperation_Java.java
Date Wed, 14 May 2003 12:30:23 GMT
owenb       2003/05/14 05:30:22

  Modified:    java/src/org/apache/wsif/providers/java
                        WSIFOperation_Java.java
  Log:
  Minor changes to getMethods
  
  Revision  Changes    Path
  1.44      +99 -87    xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java
  
  Index: WSIFOperation_Java.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- WSIFOperation_Java.java	6 May 2003 09:14:52 -0000	1.43
  +++ WSIFOperation_Java.java	14 May 2003 12:30:22 -0000	1.44
  @@ -431,113 +431,125 @@
        * @return the subset of allMethods that match this WSDL operation
        */
       protected Method[] getMethods(Method[] allMethods) throws WSIFException {
  -        Trc.entry(this, allMethods);
  +        try {
  +            Trc.entry(this, allMethods);
   
  -        ArrayList candidates = new ArrayList();
  +            ArrayList candidates = new ArrayList();
   
  -        if (!fieldIsConstructor) {
  +            if (!fieldIsConstructor) {
   
  -            // Java methods start with a lower case but WSDL uses either case 
  -            String bindingMethodName = fieldJavaOperationModel.getMethodName();
  -            String bindingMethodName2 = null;
  -            if (Character.isUpperCase(bindingMethodName.charAt(0))) {
  -                StringBuffer sb = new StringBuffer(bindingMethodName);
  -                sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
  -                bindingMethodName2 = sb.toString();
  -            }
  +                // Java methods start with a lower case but WSDL uses either case 
  +                String bindingMethodName =
  +                    fieldJavaOperationModel.getMethodName();
  +                String bindingMethodName2 = null;
  +                if (Character.isUpperCase(bindingMethodName.charAt(0))) {
  +                    StringBuffer sb = new StringBuffer(bindingMethodName);
  +                    sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
  +                    bindingMethodName2 = sb.toString();
  +                }
   
  -            Object[] args = getMethodArgumentClasses();
  -            Object retClass = getMethodReturnClass();
  +                Object[] args = getMethodArgumentClasses();
  +                Object retClass = getMethodReturnClass();
   
  -            for (int i = 0; i < allMethods.length; i++) {
  -                String methodName = allMethods[i].getName();
  -                if (!(methodName.equals(bindingMethodName)
  -                    || methodName.equals(bindingMethodName2))) {
  -                    continue;
  -                }
  -                Class[] params = allMethods[i].getParameterTypes();
  -                if (params.length != args.length)
  -                    continue;
  -                Class retType = allMethods[i].getReturnType();
  -
  -                boolean tryAMap = false;
  -                if (multiOutParts) {
  -                    Class mapClass = java.util.Map.class;
  -                    boolean found = false;
  -                    if (mapClass.getName().equals(retType.getName())) {
  -                        tryAMap = true;
  -                    } else if (mapClass.isAssignableFrom(retType)) {
  -                        tryAMap = true;
  +                for (int i = 0; i < allMethods.length; i++) {
  +                    String methodName = allMethods[i].getName();
  +                    if (!(methodName.equals(bindingMethodName)
  +                        || methodName.equals(bindingMethodName2))) {
  +                        continue;
                       }
  -                }
  -                if (!tryAMap) {
  -                    if (retClass != null && retClass instanceof Vector) {
  -                        Vector vec = (Vector) retClass;
  +
  +                    Class[] params = allMethods[i].getParameterTypes();
  +                    if (params.length != args.length)
  +                        continue;
  +                    Class retType = allMethods[i].getReturnType();
  +
  +                    boolean tryAMap = false;
  +                    if (multiOutParts) {
  +                        Class mapClass = java.util.Map.class;
                           boolean found = false;
  -                        for (int p = 0; p < vec.size(); p++) {
  -                            Class cl = (Class) vec.get(p);
  -                            if (cl.getName().equals(retType.getName())) {
  -                                found = true;
  -                                break;
  -                            } else if (cl.isAssignableFrom(retType)) {
  -                                found = true;
  -                                break;
  -                            }
  +                        if (mapClass.getName().equals(retType.getName())) {
  +                            tryAMap = true;
  +                        } else if (mapClass.isAssignableFrom(retType)) {
  +                            tryAMap = true;
                           }
  -                        if (!found)
  -                            continue;
  -                    } else {
  -                        if (retType != null && retClass != null) {
  -                            if (!(((Class) retClass)
  -                                .getName()
  -                                .equals(retType.getName()))
  -                                && !(((Class) retClass)
  -                                    .isAssignableFrom(retType)))
  +                    }
  +                    if (!tryAMap) {
  +                        if (retClass != null && retClass instanceof Vector) {
  +                            Vector vec = (Vector) retClass;
  +                            boolean found = false;
  +                            for (int p = 0; p < vec.size(); p++) {
  +                                Class cl = (Class) vec.get(p);
  +                                if (cl.getName().equals(retType.getName())) {
  +                                    found = true;
  +                                    break;
  +                                } else if (cl.isAssignableFrom(retType)) {
  +                                    found = true;
  +                                    break;
  +                                }
  +                            }
  +                            if (!found)
                                   continue;
  +                        } else {
  +                            if (retType != null && retClass != null) {
  +                                if (!(((Class) retClass)
  +                                    .getName()
  +                                    .equals(retType.getName()))
  +                                    && !(((Class) retClass)
  +                                        .isAssignableFrom(retType)))
  +                                    continue;
  +                            }
                           }
                       }
  -                }
   
  -                boolean match = true;
  -                for (int j = 0; j < params.length; j++) {
  -                    Object obj = args[j];
  -                    if (obj instanceof Vector) {
  -                        Vector vec = (Vector) obj;
  -                        boolean found = false;
  -                        for (int p = 0; p < vec.size(); p++) {
  -                            Class cl = (Class) vec.get(p);
  -                            if (cl.getName().equals(params[j].getName())) {
  -                                found = true;
  +                    boolean match = true;
  +                    for (int j = 0; j < params.length; j++) {
  +                        Object obj = args[j];
  +                        if (obj instanceof Vector) {
  +                            Vector vec = (Vector) obj;
  +                            boolean found = false;
  +                            for (int p = 0; p < vec.size(); p++) {
  +                                Class cl = (Class) vec.get(p);
  +                                if (cl.getName().equals(params[j].getName())) {
  +                                    found = true;
  +                                    break;
  +                                } else if (params[j].isAssignableFrom(cl)) {
  +                                    found = true;
  +                                    break;
  +                                }
  +                            }
  +                            if (!found) {
  +                                match = false;
                                   break;
  -                            } else if (params[j].isAssignableFrom(cl)) {
  -                                found = true;
  +                            }
  +                        } else {
  +                            if (!(((Class) obj)
  +                                .getName()
  +                                .equals(params[j].getName()))
  +                                && !(params[j].isAssignableFrom((Class) obj)))
{
  +                                match = false;
                                   break;
                               }
                           }
  -                        if (!found) {
  -                            match = false;
  -                            break;
  -                        }
  -                    } else {
  -                        if (!(((Class) obj)
  -                            .getName()
  -                            .equals(params[j].getName()))
  -                            && !(params[j].isAssignableFrom((Class) obj))) {
  -                            match = false;
  -                            break;
  -                        }
                       }
  -                }
  -                if (match) {
  -                    candidates.add(allMethods[i]);
  +                    if (match) {
  +                        candidates.add(allMethods[i]);
  +                    }
                   }
               }
  -        }
   
  -        Method[] methods =
  -            (Method[]) candidates.toArray(new Method[candidates.size()]);
  -        Trc.exit(methods);
  -        return methods;
  +            Method[] methods =
  +                (Method[]) candidates.toArray(new Method[candidates.size()]);
  +            Trc.exit(methods);
  +            return methods;
  +        } catch (Exception e) {
  +            if (e instanceof WSIFException) {
  +                throw (WSIFException) e;
  +            } else {
  +                throw new WSIFException(
  +                    "Failure to get list of possible methods for Java service"
  +                        + e);
  +            }
  +        }
       }
   
       protected Operation getOperation() throws Exception {
  
  
  

Mime
View raw message