You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/03/30 00:26:36 UTC

cvs commit: xml-axis/java/src/org/apache/axis/description ServiceDesc.java

gdaniels    02/03/29 15:26:36

  Modified:    java/src/org/apache/axis/description ServiceDesc.java
  Log:
  If we find a Skeleton class, ask it for an array of OperationDescs.
  
  Revision  Changes    Path
  1.9       +64 -49    xml-axis/java/src/org/apache/axis/description/ServiceDesc.java
  
  Index: ServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ServiceDesc.java	29 Mar 2002 15:05:21 -0000	1.8
  +++ ServiceDesc.java	29 Mar 2002 23:26:36 -0000	1.9
  @@ -185,9 +185,14 @@
           this.implClass = implClass;
           if (Skeleton.class.isAssignableFrom(implClass)) {
               isSkeletonClass = true;
  +            loadSkeletonOperations();
           }
       }
   
  +    private void loadSkeletonOperations() {
  +
  +    }
  +
       public TypeMapping getTypeMapping() {
           return tm;
       }
  @@ -422,6 +427,43 @@
               !allowedMethods.contains(methodName))
               return;
   
  +        // If we're a skeleton class, make sure we don't already have any
  +        // OperationDescs for this name (as that might cause conflicts),
  +        // then load them up from the Skeleton class.
  +        if (isSkeletonClass) {
  +            // FIXME : Check for existing ones and fault if found
  +
  +            if (skelMethod == null) {
  +                // Grab metadata from the Skeleton for parameter info
  +                try {
  +                    skelMethod = implClass.getDeclaredMethod(
  +                                            "getOperationDescsByName",
  +                                            new Class [] { int.class });
  +                } catch (NoSuchMethodException e) {
  +                } catch (SecurityException e) {
  +                }
  +                if (skelMethod == null) {
  +                    // FIXME : Throw an error?
  +                    return;
  +                }
  +            }
  +            try {
  +                OperationDesc [] skelDescs =
  +                        (OperationDesc [])skelMethod.invoke(implClass,
  +                                            new Object [] { methodName });
  +                for (int i = 0; i < skelDescs.length; i++) {
  +                    OperationDesc operationDesc = skelDescs[i];
  +                    addOperationDesc(operationDesc);
  +                }
  +            } catch (IllegalAccessException e) {
  +                return;
  +            } catch (IllegalArgumentException e) {
  +                return;
  +            } catch (InvocationTargetException e) {
  +                return;
  +            }
  +        }
  +
           // OK, go find any current OperationDescs for this method name and
           // make sure they're synced with the actual class.
           if (name2OperationsMap != null) {
  @@ -477,60 +519,33 @@
           operation.setReturnType(tm.getTypeQName(method.getReturnType()));
   
           Class [] paramTypes = method.getParameterTypes();
  +        String [] paramNames =
  +                JavaUtils.getParameterNamesFromDebugInfo(method);
   
  -        if (isSkeletonClass) {
  -            if (skelMethod == null) {
  -                // Grab metadata from the Skeleton for parameter info
  -                try {
  -                    skelMethod = implClass.getDeclaredMethod(
  -                                            "getOperationDescByName",
  -                                            new Class [] { int.class });
  -                } catch (NoSuchMethodException e) {
  -                } catch (SecurityException e) {
  -                }
  -                if (skelMethod == null) {
  -                    // FIXME : Throw an error?
  -                    return;
  -                }
  -            }
  -            try {
  -                OperationDesc skelDesc =
  -                        (OperationDesc)skelMethod.invoke(implClass,
  -                                            new Object [] { method.getName() });
  -            } catch (IllegalAccessException e) {
  -            } catch (IllegalArgumentException e) {
  -            } catch (InvocationTargetException e) {
  +        for (int k = 0; k < paramTypes.length; k++) {
  +            Class type = paramTypes[k];
  +            ParameterDesc paramDesc = new ParameterDesc();
  +            // If we have a name for this param, use it, otherwise call
  +            // it "in*"
  +            if (paramNames != null) {
  +                paramDesc.setName(paramNames[k+1]);
  +            } else {
  +                paramDesc.setName("in" + k);
               }
  -            //operation.setParameters(skelDesc.getParameters());
  -        } else {
  -            String [] paramNames =
  -                    JavaUtils.getParameterNamesFromDebugInfo(method);
  -
  -            for (int k = 0; k < paramTypes.length; k++) {
  -                Class type = paramTypes[k];
  -                ParameterDesc paramDesc = new ParameterDesc();
  -                // If we have a name for this param, use it, otherwise call
  -                // it "in*"
  -                if (paramNames != null) {
  -                    paramDesc.setName(paramNames[k+1]);
  -                } else {
  -                    paramDesc.setName("in" + k);
  -                }
  -                paramDesc.setJavaType(type);
  +            paramDesc.setJavaType(type);
   
  -                // If it's a Holder, mark it INOUT and set the type to the
  -                // held type.  Otherwise it's IN with its own type.
  +            // If it's a Holder, mark it INOUT and set the type to the
  +            // held type.  Otherwise it's IN with its own type.
   
  -                Class heldClass = JavaUtils.getHolderValueType(type);
  -                if (heldClass != null) {
  -                    paramDesc.setMode(ParameterDesc.INOUT);
  -                    paramDesc.setTypeQName(tm.getTypeQName(heldClass));
  -                } else {
  -                    paramDesc.setMode(ParameterDesc.IN);
  -                    paramDesc.setTypeQName(tm.getTypeQName(type));
  -                }
  -                operation.addParameter(paramDesc);
  +            Class heldClass = JavaUtils.getHolderValueType(type);
  +            if (heldClass != null) {
  +                paramDesc.setMode(ParameterDesc.INOUT);
  +                paramDesc.setTypeQName(tm.getTypeQName(heldClass));
  +            } else {
  +                paramDesc.setMode(ParameterDesc.IN);
  +                paramDesc.setTypeQName(tm.getTypeQName(type));
               }
  +            operation.addParameter(paramDesc);
           }
   
           addOperationDesc(operation);