You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/10/08 06:00:18 UTC

svn commit: r307252 [1/2] - in /beehive/trunk: system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ wsm/src/api/javax/jws/soap/ wsm/...

Author: ekoneil
Date: Fri Oct  7 20:59:52 2005
New Revision: 307252

URL: http://svn.apache.org/viewcvs?rev=307252&view=rev
Log:
Migrate the WSM sandbox into the trunk/ line.

This significantly changes the architecture of the build-time of WSM to using the APT Mirror APIs with a pluggable abstraction for creating the web service object model from Java reflection info or from an XMLBean.

This is a *work in progress*; I wouldn't be surprised if this broke existing .jws files, though the change passes both the WSM and web service control test suites.  In fact, the JSR 181 annotation processing isn't even fully implemented yet.  

Help welcom on making this real, but this is a good start.  I'll continue working on cleaning this up; the messiest part is the handling of type information.  One of the big changes here was switching from using java.lang.Class to java.lang.String when representing types.  There's an aptly named class HackUtils that is used to do simple conversion from Class -> String, but this needs lots more work and cleanup.  

BB: self
Tests: WSM + system controls pass


Added:
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/ObjectModelStoreException.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/model/jsr181/ObjectModelStoreException.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/HackUtils.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/HackUtils.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/apt/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/checker/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/generator/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/generator/WsmResourceGenerator.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/WsmResourceGenerator.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/
      - copied from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java
      - copied, changed from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java
      - copied unchanged from r306873, beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java
Removed:
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/java/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181MethodMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ParameterMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181TypeMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/TypeMappingUtil.java
Modified:
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ParameterInfo.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java
    beehive/trunk/wsm/src/api/javax/jws/soap/SOAPBinding.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
    beehive/trunk/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsMethodMetadata.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsParameterMetadata.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/ValidationException.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultMethodMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultParameterMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/wsdl/Model2AJava.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/wsdl/Schema.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/wsdl/Utilities.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/wsdl/WSDLParser.java
    beehive/trunk/wsm/src/core/org/apache/beehive/wsm/wsdl/wsdl2ajava.vm
    beehive/trunk/wsm/test/build.xml
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/model/BarTestCase.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/model/FooTestCase.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/processor/apt/WsmAnnotationProcessorEndpointInterfaceTest.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java Fri Oct  7 20:59:52 2005
@@ -113,12 +113,12 @@
      */
     static String transformInvalidJavaIdentifier(String id)
     {
-        if (id == null) throw new IllegalArgumentException("id cannot be null");
+        if (id == null)
+            throw new IllegalArgumentException("id cannot be null");
 
         final int len = id.length();
-        if (len == 0) {
+        if (len == 0)
             return "_";
-        }
 
         //
         // begin the transform

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/MethodInfo.java Fri Oct  7 20:59:52 2005
@@ -19,54 +19,49 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.LinkedList;
 
 /**
  * Method info for the Velocity engine.
  */
 public final class MethodInfo {
 
-    private ArrayList<ParameterInfo> _params;
-    private final String _name;
+    private LinkedList<ParameterInfo> _params;
+    private String _name;
     private String _returnTypeName;
 
     /**
-     * Create a new Method info instance.
-     * @param name The method name.
-     * @param returnType The return type of the method.
      */
-    MethodInfo(String name, Class returnType) {
-        _params = new ArrayList<ParameterInfo>();
+    MethodInfo() {
+        _params = new LinkedList<ParameterInfo>();
+    }
 
+    void setName(String name) {
         if (!GeneratorUtils.isValidJavaIdentifier(name)) {
             _name = GeneratorUtils.transformInvalidJavaIdentifier(name);
-            System.out.println("Warning: method name " + name
-                    + " is not a valid Java method name, changing to: " + _name);
-        } else {
-            _name = name;
-        }
 
-        _returnTypeName = returnType.getCanonicalName();
-        if (_returnTypeName.startsWith("java.lang.")) {
-            _returnTypeName = _returnTypeName.substring(_returnTypeName.lastIndexOf('.')+1);
+            /* todo: i18n */
+            System.out.println("Warning: method name " + name + " is not a valid Java method name, changing to: " + _name);
         }
+        else _name = name;
     }
 
     /**
      * Add a parameter to the method's parameter list (parameter mode is IN).
      * @param name The parameter name.
-     * @param clazz The parameter class.
+     * @param typeName The parameter class.
      */
-    void addParameter(String name, Class clazz) {
-        _params.add(new ParameterInfo(name, _params.size(), clazz, ParameterInfo.ParamMode.IN));
+    void addParameter(String name, String typeName) {
+        _params.add(new ParameterInfo(name, _params.size(), typeName, ParameterInfo.ParamMode.IN));
     }
 
     /**
      * Add a parameter to the method's parameter list (parameter mode is OUT / INOUT).
      * @param name The parameter name.
-     * @param clazz The parameter class.
+     * @param typeName The parameter class.
      */
-    void addOutParameter(String name, Class clazz) {
-        _params.add(new ParameterInfo(name, _params.size(), clazz, ParameterInfo.ParamMode.OUT));
+    void addOutParameter(String name, String typeName) {
+        _params.add(new ParameterInfo(name, _params.size(), typeName, ParameterInfo.ParamMode.OUT));
     }
 
     /**
@@ -75,6 +70,15 @@
      */
     public String getName() {
         return _name;
+    }
+
+    void setReturnTypeName(String returnType) {
+        System.out.println("***** returnType: " + returnType);
+        
+        _returnTypeName = returnType;
+        if (_returnTypeName.startsWith("java.lang.")) {
+            _returnTypeName = _returnTypeName.substring(_returnTypeName.lastIndexOf('.')+1);
+        }
     }
 
     /**

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ParameterInfo.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ParameterInfo.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ParameterInfo.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ParameterInfo.java Fri Oct  7 20:59:52 2005
@@ -31,7 +31,8 @@
     private static final String PARAM_BASE_NAME = "param";
 
     enum ParamMode {
-        IN, OUT, INOUT }
+        IN, OUT, INOUT
+    }
 
     private final String _name;
     private final String _className;
@@ -40,12 +41,11 @@
      * package protected constructor.
      * @param name The parameter name, if null a name will be generated based on the position parameter.
      * @param position The position in the argument list of this parameter.
-     * @param clazz The Java class of the parameter.
+     * @param typeName The class name of the parameter
      * @param mode Mode may be any of the values defined by the ParamMode enumeration.
      */
-    ParameterInfo(String name, int position, Class clazz, ParamMode mode)
-    {
-        _className = resolveParameterType(clazz, mode);
+    ParameterInfo(String name, int position, String typeName, ParamMode mode) {
+        _className = resolveParameterType(typeName, mode);
 
         if (name == null) {
             _name = PARAM_BASE_NAME + position;
@@ -79,58 +79,53 @@
 
     /**
      * Given the class and mode of the parameter, generate the classname.
-     * @param paramClass Parameter class.
+     * @param typeName Parameter class name.
      * @param paramMode Mode.
      * @return A string containing the class name of the parameter.
      */
-    private String resolveParameterType(Class paramClass, ParamMode paramMode)
-    {
-        if (paramMode == ParamMode.INOUT || paramMode == ParamMode.OUT) {
-            return getHolderForType(paramClass);
-        } else {
-            String nm = paramClass.getCanonicalName();
-            if (nm.startsWith("java.lang.")) {
-                nm = nm.substring(nm.lastIndexOf('.')+1);
-            }
-            return nm;
+    private String resolveParameterType(String typeName, ParamMode paramMode) {
+        if (paramMode == ParamMode.INOUT || paramMode == ParamMode.OUT)
+            return getHolderForType(typeName);
+        else {
+            if (typeName.startsWith("java.lang."))
+                typeName = typeName.substring(typeName.lastIndexOf('.')+1);
+            return typeName;
         }
     }
 
     /**
      * Find the holder type for a parameter with a mode of OUT or INOUT.
-     * @param clazz Class of the parameter.
+     * @param typeName the class name of the parameter
      * @return A String containing the fully qualified holder class name.
      */
-    private String getHolderForType(Class clazz)
-    {
-        if (clazz == int.class) {
+    private String getHolderForType(String typeName) {
+        /* todo: arbitrary array support */
+        if (typeName.equals(int.class.getName()))
             return "javax.xml.rpc.holders.IntHolder";
-        } else if (clazz == boolean.class) {
+        else if (typeName.equals(boolean.class.getName()))
             return "javax.xml.rpc.holders.BooleanHolder";
-        } else if (clazz == new byte[0].getClass()) {
+        else if (typeName.equals("[B"))
             return "javax.xml.rpc.holders.ByteArrayHolder";
-        } else if (clazz == byte.class) {
+        else if (typeName.equals(byte.class.getName()))
             return "javax.xml.rpc.holders.ByteHolder";
-        } else if (clazz == double.class) {
+        else if (typeName.equals(double.class.getName()))
             return "javax.xml.rpc.holders.DoubleHolder";
-        } else if (clazz == float.class) {
+        else if (typeName.equals(float.class.getName()))
             return "javax.xml.rpc.holders.FloatHolder";
-        } else if (clazz == long.class) {
+        else if (typeName.equals(long.class.getName()))
             return "javax.xml.rpc.holders.LongHolder";
-        } else if (clazz == short.class) {
+        else if (typeName.equals(short.class.getName()))
             return "javax.xml.rpc.holders.ShortHolder";
-        } else if (clazz == String.class) {
+        else if (typeName.equals(String.class.getName()))
             return "javax.xml.rpc.holders.StringHolder";
-        } else if (clazz == BigDecimal.class) {
+        else if (typeName.equals(BigDecimal.class.getName()))
             return "javax.xml.rpc.holders.BigDecimalHolder";
-        } else if (clazz == BigInteger.class) {
+        else if (typeName.equals(BigInteger.class.getName()))
             return "javax.xml.rpc.holders.BigIntegerHolder";
-        } else if (clazz == Calendar.class) {
+        else if (typeName.equals(Calendar.class.getName()))
             return "javax.xml.rpc.holders.CalendarHolder";
-        } else if (clazz == QName.class) {
+        else if (typeName.equals(QName.class.getName()))
             return "javax.xml.rpc.holders.QNameHolder";
-        } else {
-            return "org.apache.beehive.wsm.databinding.GenericHolder<" + clazz.getCanonicalName() + ">";
-        }
+        else return "org.apache.beehive.wsm.databinding.GenericHolder<" + typeName + ">";
     }
 }

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java Fri Oct  7 20:59:52 2005
@@ -33,6 +33,7 @@
 import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
 import org.apache.beehive.wsm.wsdl.Utilities;
 import org.apache.beehive.wsm.wsdl.WSDLParser;
+import org.apache.beehive.wsm.processor2.HackUtils;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -201,19 +202,23 @@
      * @param wsm BeehiveWsTypeMetadata model
      * @return An array list containing the methods of the service control.
      */
-    static private ArrayList<MethodInfo> buildMethodList(BeehiveWsTypeMetadata wsm)
-    {
+    private static ArrayList<MethodInfo> buildMethodList(BeehiveWsTypeMetadata wsm) {
         ArrayList<MethodInfo> methodList = new ArrayList<MethodInfo>();
 
         for(BeehiveWsMethodMetadata method : wsm.getMethods()) {
-            MethodInfo m = new  MethodInfo(method.getWmOperationName(), method.getJavaReturnType());
+            MethodInfo m = new  MethodInfo();
+            m.setName(method.getWmOperationName());
+            /* todo: need to put this readable name stuff into a single place... */
+            m.setReturnTypeName(HackUtils.convertToReadableName(method.getJavaReturnType()));
 
             for(BeehiveWsParameterMetadata param : method.getParams()) {
-                if (param.getWpMode() == WebParam.Mode.IN) {
-                    m.addParameter(param.getWpName(), param.getJavaType());
-                } else {
-                    m.addOutParameter(param.getWpName(), param.getJavaType());
-                }
+                String javaType = HackUtils.convertToReadableName(param.getJavaType());
+
+                System.out.println("%%%%%%% param.getJavaType: " + javaType);
+
+                if (param.getWpMode() == WebParam.Mode.IN)
+                    m.addParameter(param.getWpName(), javaType);
+                else m.addOutParameter(param.getWpName(), javaType);
             }
             methodList.add(m);
         }

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.java Fri Oct  7 20:59:52 2005
@@ -576,12 +576,15 @@
 
         Type[] genericParamTypes = method.getGenericParameterTypes();
         Class[] paramTypes = method.getParameterTypes();
+        String[] paramTypeNames = new String[paramTypes.length];
         for(int i = 0; i < paramTypes.length; i++) {
             if(Holder.class.isAssignableFrom(paramTypes[i])) {
-                paramTypes[i] = TypeRegistrar.getHoldersValueClass(genericParamTypes[i]);
+                paramTypeNames[i] = TypeRegistrar.getHoldersValueClass(genericParamTypes[i]).getCanonicalName();
             }
+            else paramTypeNames[i] = paramTypes[i].getCanonicalName();
         }
-        BeehiveWsMethodMetadata wmm = _beehiveTypeMetadata.getMethod(operationName, paramTypes);
+
+        BeehiveWsMethodMetadata wmm = _beehiveTypeMetadata.getMethod(operationName, paramTypeNames);
         if(wmm == null) {
             StringBuffer sb = new StringBuffer("No Jsr181MethodMetadata found for " + operationName + '(');
             boolean first = true;

Modified: beehive/trunk/wsm/src/api/javax/jws/soap/SOAPBinding.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/api/javax/jws/soap/SOAPBinding.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/api/javax/jws/soap/SOAPBinding.java (original)
+++ beehive/trunk/wsm/src/api/javax/jws/soap/SOAPBinding.java Fri Oct  7 20:59:52 2005
@@ -23,11 +23,6 @@
 @Retention(value = RetentionPolicy.RUNTIME)
 @Target(value = ElementType.TYPE)
 public @interface SOAPBinding {
-    ParameterStyle parameterStyle() default ParameterStyle.WRAPPED;
-
-    Style style() default Style.DOCUMENT;
-
-    Use use() default Use.LITERAL;
 
     public enum ParameterStyle {
         BARE, WRAPPED
@@ -40,4 +35,10 @@
     public enum Use {
         LITERAL, ENCODED
     }
+
+    ParameterStyle parameterStyle() default ParameterStyle.WRAPPED;
+
+    Style style() default Style.DOCUMENT;
+
+    Use use() default Use.LITERAL;
 }

Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java Fri Oct  7 20:59:52 2005
@@ -18,11 +18,13 @@
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
+import java.lang.reflect.Array;
 import java.rmi.Remote;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Arrays;
 import javax.jws.WebParam;
 import javax.jws.soap.SOAPBinding;
 import javax.wsdl.OperationType;
@@ -61,6 +63,7 @@
 import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
 import org.apache.beehive.wsm.registration.TypeRegistrar;
 import org.apache.beehive.wsm.util.InvalidTypeMappingException;
+import org.apache.beehive.wsm.processor2.HackUtils;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
 import org.apache.xmlbeans.XmlBeans;
@@ -115,6 +118,8 @@
 
         // Walk the methods
         for(BeehiveWsMethodMetadata meth : wsm.getMethods()) {
+            System.out.println("method: " + meth);
+
             String operationName = meth.getWmOperationName();
             if(null != operationName && 0 < operationName.length()) {
                 // set the Operations properties
@@ -135,7 +140,7 @@
 
                     QName qn = null;
                     QName odReturnType = od.getReturnType();
-                    final Class returnType = meth.getJavaReturnType();
+                    final Class returnType = createClass(meth.getJavaReturnType());
 
                     // if we are processing an rpc encoded service, and the qname of the return type
                     // from the operation desc has a name space uri of soapenc, there is no need to
@@ -164,7 +169,9 @@
                 int pcnt = 0;
                 for(BeehiveWsParameterMetadata param : meth.getParams()) {
                     ParameterDesc pd = od.getParameter(pcnt++);
-                    final Class paramType = param.getJavaType();
+
+                    /* eko: requires a Java Class */
+                    final Class paramType = createClass(param.getJavaType());
 
                     if(pd.getTypeQName() == null) {
                         // set the typeQName if it is not set already
@@ -228,8 +235,8 @@
                     fd.setXmlType(qname);
                     fd.setQName(qname);
                     fd.setComplex(true);
-                    
-                    
+
+
                     ArrayList parameters = fd.getParameters();
 
                     if (parameters != null) {
@@ -243,7 +250,7 @@
                          *  // Parameters // We add a single parameter which
                          * points to the type if (fault.getParameters() == null) {
                          * if (xmlType == null) { ......
-                         * 
+                         *
                          */
                         // make sure the parmeter description points to the
                         // type, since the
@@ -252,7 +259,7 @@
                         // need to set the type
                         ParameterDesc parameter = (ParameterDesc) parameters.get(0);
                         parameter.setTypeQName(qname);
-                        
+
                         // give each fault a unique name, the name will be used
                         // in the "<details>" section of the soapfault message
                         parameter.setQName( new QName(qname.getNamespaceURI(), qname.getLocalPart()+"Fault"));
@@ -617,6 +624,13 @@
                 sd.setStyle(Style.DOCUMENT);
             }
         }
+    }
+
+    private static final Class createClass(String className) {
+        if(className == null)
+            throw new RuntimeException("Encountered a null class name!");
+
+        return HackUtils.convertToClass(className);
     }
 }
 

Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java Fri Oct  7 20:59:52 2005
@@ -27,35 +27,37 @@
 import org.apache.beehive.wsm.wsdl.Utilities;
 import org.apache.xmlbeans.XmlException;
 
-public class Wsdl2AJava {
+public final class Wsdl2AJava {
 
-    public static int main(String args[]) {
+    public static void main(String[] args) {
 
         if(args.length != 2) {
             System.out.println("Usage:  Wsdl2AJava <wsdlFileName> <base source dir>");
-            return -1;
+            return;
         }
         
         File baseDir = new File(args[1]);
         if(!baseDir.exists())
             baseDir.mkdirs();
-        
+
+        System.out.println("Base source directory: " + args[1]);
+        System.out.println("Processing WSDL: " + args[0]);
+
         SystemTypeLookupService lookupService = new SystemTypeLookupService();
         XmlBeanWSDLProcessor processor;
         try {
             processor = new XmlBeanWSDLProcessor(Utilities.parseWSDL(args[0]), lookupService);
         } catch (MalformedURLException e) {
-            System.out.println("Unable to find WSDL with URL '" + args[0] + "'.  Cause: " + e.getMessage());
-            e.printStackTrace();
-            return -1;
+            System.out.println("Unable to find WSDL with URL '" + args[0] + "'.");
+            return;
         } catch (XmlException e) {
-            System.out.println("Failed with an invalid WSDL at '" + args[0] + "'.  Cause: " + e);
+            System.out.println("Failed generating an Annotated Web Service from WSDL '"  + args[0] + "'.  Cause: " + e);
             e.printStackTrace();
-            return -1;
+            return;
         } catch (IOException e) {
-            System.out.println("Failed with an IOException generating the Annotated JWS.  Cause: " + e);
+            System.out.println("Failed generating an Annotated Web Service from WSDL.  Cause: " + e);
             e.printStackTrace();
-            return -1;
+            return;
         }
 
         BeehiveWsTypeMetadata om;
@@ -63,10 +65,10 @@
             om = processor.getObjectModel();
             Model2AJava.generateAnnotatedJavaFromOM(om, baseDir);
        } catch (Exception e) {
-           System.out.println("Error:  Failed in generating the Annotated JWS.  Cause: " + e);
+           System.out.println("Error:  Failed generating the Annotated Web Service.  Cause: " + e);
            e.printStackTrace();
-           return -1;
+           return;
         }
-        return 0;
+        return;
     }
 }

Modified: beehive/trunk/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory (original)
+++ beehive/trunk/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory Fri Oct  7 20:59:52 2005
@@ -1,5 +1,5 @@
 #
 # This configures APT so the WsmAnnotationProcessorFactory can be used to process WSM annotations
 #
-org.apache.beehive.wsm.processor.apt.WsmAnnotationProcessorFactory
+org.apache.beehive.wsm.processor2.apt.WsmAnnotationProcessorFactory
 

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanTypeLookup.java Fri Oct  7 20:59:52 2005
@@ -120,7 +120,6 @@
         */
         for(Method meth : declared) {
             Class returnType = meth.getReturnType();
-            //System.out.println(returnType.getName());
             if(!returnType.equals(Void.TYPE)) {
                 /*
                 * NOTE jcolwell@bea.com 2004-Nov-12 --

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsMethodMetadata.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsMethodMetadata.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsMethodMetadata.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsMethodMetadata.java Fri Oct  7 20:59:52 2005
@@ -56,13 +56,10 @@
 
     public abstract void setJavaMethodName(String methodName);
 
-    public abstract Class getJavaReturnType();
-
-    public abstract String getJavaReturnTypeFullName();
+    public abstract String getJavaReturnType();
 
     public abstract QName getXmlReturnType();
 
     public abstract void setXmlReturnType(QName xmlType);
 
-    public abstract void setReturnType(Class javaType);
-}
\ No newline at end of file
+    public abstract void setReturnType(String javaType);}
\ No newline at end of file

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsParameterMetadata.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsParameterMetadata.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsParameterMetadata.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsParameterMetadata.java Fri Oct  7 20:59:52 2005
@@ -40,12 +40,9 @@
 
     public abstract void setWpTargetNamespace(String wpTargetNamespace);
 
-    public abstract Class getJavaType();
+    public abstract String getJavaType();
 
-    public abstract void setJavaType(Class javaType);
-
-    /* todo: this should be moved to web service elementtype later. */
-    public abstract String getJavaTypeFullName(); 
+    public abstract void setJavaType(String javaType);
 
     public abstract QName getXmlType();
 

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java Fri Oct  7 20:59:52 2005
@@ -24,14 +24,6 @@
  */
 public abstract class  BeehiveWsTypeMetadata {
 
-    public abstract String getHcFileName();
-
-    public abstract void setHcFileName(String hcFileName);
-
-    public abstract  String getHcName();
-
-    public abstract  void setHcName(String hcName);
-
     public abstract String getSiValue();
 
     public abstract void setSiValue(String siValue);
@@ -64,14 +56,9 @@
 
     public abstract Collection<? extends BeehiveWsMethodMetadata> getMethods();
 
-    public abstract BeehiveWsMethodMetadata getMethod(String methodName, Class... paramTypes);
+    public abstract BeehiveWsMethodMetadata getMethod(String methodName, String... paramTypes);
 
-    /**
-     * @throws ValidationException if duplicate methods are encountered or if a
-     *                             Document style service attempts to overload methods.
-     */
-    public abstract void addMethod(BeehiveWsMethodMetadata method)
-        throws ValidationException;
+    public abstract void addMethod(BeehiveWsMethodMetadata method);
 
     public abstract List<? extends BeehiveWsSOAPMessageHandlerInfo> getSoapHandlers();
 
@@ -80,6 +67,4 @@
     public abstract String getClassName();
 
     public abstract void setClassName(String className);
-
-
 }

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/ValidationException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/ValidationException.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/ValidationException.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/ValidationException.java Fri Oct  7 20:59:52 2005
@@ -18,7 +18,7 @@
 package org.apache.beehive.wsm.model;
 
 public class ValidationException
-    extends Exception {
+    extends RuntimeException {
     
     public ValidationException() {
         super();

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultMethodMetadataImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultMethodMetadataImpl.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultMethodMetadataImpl.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultMethodMetadataImpl.java Fri Oct  7 20:59:52 2005
@@ -1,240 +1,213 @@
-/*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.wsm.model.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.namespace.QName;
-
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-import org.apache.beehive.wsm.model.ValidationException;
-
-public class DefaultMethodMetadataImpl
-    extends  BeehiveWsMethodMetadata
-    implements java.io.Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private String wmOperationName;
-    private String wmAction;
-    private boolean oneway = false;
-    private ArrayList<BeehiveWsParameterMetadata> params = new ArrayList<BeehiveWsParameterMetadata>();
-    private String wrName;
-    private String wrTargetNamespace;
-    private String javaMethodName;
-    private Class javaReturnType;
-    private QName mXMLReturnType;
-
-    public DefaultMethodMetadataImpl() {
-        super();
-    }
-
-    public DefaultMethodMetadataImpl(String methodName, Class returnType) {
-        this();
-        javaMethodName = methodName;
-        javaReturnType = returnType;
-    }
-
-    public DefaultMethodMetadataImpl(String operationName, Class javaType, QName xmlReturnType) {
-        this(operationName, javaType);
-        setXmlReturnType(xmlReturnType);
-    }
-
-    public boolean isOneWay() {
-        return oneway;
-    }
-
-    public void setOneWay(boolean oneway) {
-        this.oneway = oneway;
-    }
-
-    public String getWmAction() {
-        return wmAction;
-    }
-
-    public void setWmAction(String wmAction) {
-        this.wmAction = wmAction;
-    }
-
-    public String getWmOperationName() {
-        return wmOperationName;
-    }
-
-    public void setWmOperationName(String wmOperationName) {
-        this.wmOperationName = wmOperationName;
-    }
-
-    public String getWrName() {
-        return wrName;
-    }
-
-    public void setWrName(String wrName) {
-        this.wrName = wrName;
-    }
-
-    public String getWrTargetNamespace() {
-        return wrTargetNamespace;
-    }
-
-    public void setWrTargetNamespace(String wrTargetNamespace) {
-        this.wrTargetNamespace = wrTargetNamespace;
-    }
-
-    public List<BeehiveWsParameterMetadata> getParams() {
-        return Collections.unmodifiableList(params);
-    }
-
-    public void addParams(List<? extends BeehiveWsParameterMetadata> parameters) {
-        if(null != parameters) {
-            params.addAll(parameters);
-        }
-        // todo: checks
-    }
-
-    public void addParam(BeehiveWsParameterMetadata parameter) {
-        if(null != parameter) {
-            params.add(parameter);
-        }
-        // todo: checks
-    }
-
-    public String getJavaMethodName() {
-        return javaMethodName;
-    }
-
-    public void setJavaMethodName(String methodName) {
-        this.javaMethodName = methodName;
-    }
-
-    public Class getJavaReturnType() {
-        return javaReturnType;
-    }
-
-    public String getSignature() {
-        StringBuilder sb = new StringBuilder(getJavaMethodName());
-        sb.append('(');
-        boolean firstParam = true;
-        if(null != params) {
-            for(BeehiveWsParameterMetadata p : params) {
-                if(firstParam) {
-                    firstParam = false;
-                }
-                else {
-                    sb.append(',');
-                }
-                sb.append(p.getJavaType());
-            }
-        }
-        sb.append(')');
-        return sb.toString();
-    }
-
-    public String toString() {
-        String signature = getJavaReturnType().toString() + " " + getJavaMethodName() + "( ";
-        for(BeehiveWsParameterMetadata p : params) {
-            signature += p.getJavaType().toString() + " ";
-        }
-        return signature + ")";
-    }
-
-    public boolean equals(Object o) {
-        if(! (o instanceof DefaultMethodMetadataImpl)) {
-            return false;
-        }
-        DefaultMethodMetadataImpl m = (DefaultMethodMetadataImpl)o;
-
-        // check name
-        if(! getJavaMethodName().equals(m.getJavaMethodName())) {
-            return false;
-        }
-
-        // check return type
-        if(! getJavaReturnType().equals(m.getJavaReturnType())) {
-            return false;
-        }
-
-        // check all parameters (types, not names!)
-        if(params.size() != m.params.size()) {
-            return false;
-        }
-        for(int i = 0; i < params.size(); i++) {
-            if(! m.params.get(i).getJavaType().equals(params.get(i).getJavaType())) {
-                return false;
-            }
-        }
-        // check exceptions?
-
-        return true;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.beehive.wsm.jsr181.model.Jsr181MethodMetadata#getJavaReturnTypeFullName()
-     *
-     * NOTE THIS METHOD AND SUPPORTING METHOD SHOULD BE MOVED OUT TO A ELEMENT CLASS
-     * THAT ENCAPSULATES QNAME AND CLASS
-
-     */
-    public String getJavaReturnTypeFullName() {
-        return getClassName(getJavaReturnType());
-    }
-
-    public QName getXmlReturnType() {
-        return mXMLReturnType;
-    }
-
-    public void setXmlReturnType(QName xmlReturnType) {
-        mXMLReturnType = xmlReturnType;
-    }
-
-    /*
-      * @see org.apache.beehive.wsm.jsr181.model.Jsr181MethodMetadata#setReturnType(java.lang.Class)
-      */
-    public void setReturnType(Class javaType) {
-        this.javaReturnType = javaType;
-    }
-
-    /*
-     * @see org.apache.beehive.wsm.jsr181.model.BeehiveWsMethodMetadata#findParam(java.lang.String)
-     */
-    public BeehiveWsParameterMetadata findParam(String parmName) {
-        // walk the list of parameters until the parameter with paramName is found
-        // there are small number of parameters, so walking the list should be ok
-        if(null == parmName)
-            return null;
-
-        BeehiveWsParameterMetadata res = null;
-        for(BeehiveWsParameterMetadata nxtParam : params) {
-            if(parmName.equals(nxtParam.getWpName())) {
-                res = nxtParam;
-                break;
-            }
-        }
-        return res;
-    }
-
-    private String getClassName(Class cls) {
-        if(cls.isArray()) {
-            return getClassName(cls.getComponentType()) + "[]";
-        }
-        else {
-            return cls.getName().replace('$', '.');
-        }
-    }
-}
\ No newline at end of file
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.model.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
+import org.apache.beehive.wsm.processor2.HackUtils;
+
+public class DefaultMethodMetadataImpl
+    extends BeehiveWsMethodMetadata
+    implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private boolean oneway = false;
+    private String wmOperationName;
+    private String wmAction;
+    private String wrName;
+    private String wrTargetNamespace;
+    private String javaMethodName;
+    private String javaReturnType;
+    private ArrayList<BeehiveWsParameterMetadata> params = new ArrayList<BeehiveWsParameterMetadata>();
+    private QName mXMLReturnType;
+
+    public DefaultMethodMetadataImpl() {
+        super();
+    }
+
+    public boolean isOneWay() {
+        return oneway;
+    }
+
+    public void setOneWay(boolean oneway) {
+        this.oneway = oneway;
+    }
+
+    public String getWmAction() {
+        return wmAction;
+    }
+
+    public void setWmAction(String wmAction) {
+        this.wmAction = wmAction;
+    }
+
+    public String getWmOperationName() {
+        return wmOperationName;
+    }
+
+    public void setWmOperationName(String wmOperationName) {
+        this.wmOperationName = wmOperationName;
+    }
+
+    public String getWrName() {
+        return wrName;
+    }
+
+    public void setWrName(String wrName) {
+        this.wrName = wrName;
+    }
+
+    public String getWrTargetNamespace() {
+        return wrTargetNamespace;
+    }
+
+    public void setWrTargetNamespace(String wrTargetNamespace) {
+        this.wrTargetNamespace = wrTargetNamespace;
+    }
+
+    public List<BeehiveWsParameterMetadata> getParams() {
+        return Collections.unmodifiableList(params);
+    }
+
+    public void addParams(List<? extends BeehiveWsParameterMetadata> parameters) {
+        if(null != parameters) {
+            params.addAll(parameters);
+        }
+        // todo: checks
+    }
+
+    public void addParam(BeehiveWsParameterMetadata parameter) {
+        if(null != parameter) {
+            params.add(parameter);
+        }
+        // todo: checks
+    }
+
+    public String getJavaMethodName() {
+        return javaMethodName;
+    }
+
+    public void setJavaMethodName(String methodName) {
+        this.javaMethodName = methodName;
+    }
+
+    public String getJavaReturnType() {
+        return javaReturnType;
+    }
+
+    public String getSignature() {
+        StringBuilder sb = new StringBuilder(getJavaMethodName());
+        sb.append('(');
+        boolean firstParam = true;
+        if(null != params) {
+            for(BeehiveWsParameterMetadata p : params) {
+                if(firstParam) {
+                    firstParam = false;
+                }
+                else {
+                    sb.append(',');
+                }
+                sb.append(p.getJavaType());
+            }
+        }
+        sb.append(')');
+        return sb.toString();
+    }
+
+    public String toString() {
+        String signature = getJavaReturnType() + " " + getJavaMethodName() + "( ";
+        for(BeehiveWsParameterMetadata p : params) {
+            signature += p.getJavaType().toString() + " ";
+        }
+        return signature + ")";
+    }
+
+    public boolean equals(Object o) {
+        if(! (o instanceof DefaultMethodMetadataImpl)) {
+            return false;
+        }
+        DefaultMethodMetadataImpl m = (DefaultMethodMetadataImpl)o;
+
+        // check name
+        if(! getJavaMethodName().equals(m.getJavaMethodName())) {
+            return false;
+        }
+
+        // check return type
+        if(! getJavaReturnType().equals(m.getJavaReturnType())) {
+            return false;
+        }
+
+        // check all parameters (types, not names!)
+        if(params.size() != m.params.size()) {
+            return false;
+        }
+        for(int i = 0; i < params.size(); i++) {
+            if(! m.params.get(i).getJavaType().equals(params.get(i).getJavaType())) {
+                return false;
+            }
+        }
+        // check exceptions?
+
+        return true;
+    }
+
+    public QName getXmlReturnType() {
+        return mXMLReturnType;
+    }
+
+    public void setXmlReturnType(QName xmlReturnType) {
+        mXMLReturnType = xmlReturnType;
+    }
+
+    public void setReturnType(String javaType) {
+        this.javaReturnType = javaType;
+    }
+
+    /* note: this method is called from Velocity code-generation and can't be removed until the
+       appropriate utilities are built for Velocity macros.
+     */
+    public final String getJavaReturnTypeFullName() {
+        return HackUtils.convertToReadableName(getJavaReturnType());
+    }
+
+    /*
+    * @see org.apache.beehive.wsm.jsr181.model.BeehiveWsMethodMetadata#findParam(java.lang.String)
+    */
+    public BeehiveWsParameterMetadata findParam(String parmName) {
+        // walk the list of parameters until the parameter with paramName is found
+        // there are small number of parameters, so walking the list should be ok
+        if(null == parmName)
+            return null;
+
+        BeehiveWsParameterMetadata res = null;
+        for(BeehiveWsParameterMetadata nxtParam : params) {
+            if(parmName.equals(nxtParam.getWpName())) {
+                res = nxtParam;
+                break;
+            }
+        }
+        return res;
+    }
+}

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultParameterMetadataImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultParameterMetadataImpl.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultParameterMetadataImpl.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultParameterMetadataImpl.java Fri Oct  7 20:59:52 2005
@@ -1,108 +1,93 @@
-/*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.wsm.model.impl;
-
-import javax.jws.WebParam;
-import javax.xml.namespace.QName;
-
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-import org.apache.beehive.wsm.model.ValidationException;
-
-public class DefaultParameterMetadataImpl
-    extends BeehiveWsParameterMetadata
-    implements java.io.Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private String wpName;
-    private String wpTargetNamespace;
-    private WebParam.Mode wpMode;
-    private boolean wpHeader;
-    private Class javaType;
-    private QName mXMLType;
-
-    public DefaultParameterMetadataImpl() {
-    }
-
-    public boolean isWpHeader() {
-        return wpHeader;
-    }
-
-    public void setWpHeader(boolean wpHeader) {
-        this.wpHeader = wpHeader;
-    }
-
-    public WebParam.Mode getWpMode() {
-        return wpMode;
-    }
-
-    public void setWpMode(WebParam.Mode wpMode) {
-        this.wpMode = wpMode;
-    }
-
-    public String getWpName() {
-        return wpName;
-    }
-
-    public void setWpName(String wpName) {
-        this.wpName = wpName;
-    }
-
-    public String getWpTargetNamespace() {
-        return wpTargetNamespace;
-    }
-
-    public void setWpTargetNamespace(String wpTargetNamespace) {
-        this.wpTargetNamespace = wpTargetNamespace;
-    }
-
-    public Class getJavaType() {
-        return javaType;
-    }
-
-    public void setJavaType(Class javaType) {
-        this.javaType = javaType;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.beehive.wsm.jsr181.model.Jsr181ParameterMetadata#getJavaTypeFullName()
-     *
-     * NOTE THIS METHOD AND SUPPORTING METHOD SHOULD BE MOVED OUT TO A ELEMENT CLASS
-     * THAT ENCAPSULATES QNAME AND CLASS
-     */
-    public String getJavaTypeFullName() {
-        return getClassName(getJavaType());
-    }
-
-    public QName getXmlType() {
-        return mXMLType;
-    }
-
-    public void setXmlType(QName xmlType) {
-        mXMLType = xmlType;
-    }
-
-    private String getClassName(Class cls) {
-        if(cls.isArray()) {
-            return getClassName(cls.getComponentType()) + "[]";
-        }
-        else {
-            return cls.getName().replace('$', '.');
-        }
-    }
-}
\ No newline at end of file
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.model.impl;
+
+import javax.jws.WebParam;
+import javax.xml.namespace.QName;
+
+import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
+import org.apache.beehive.wsm.processor2.HackUtils;
+
+public class DefaultParameterMetadataImpl
+    extends BeehiveWsParameterMetadata
+    implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String wpName;
+    private String wpTargetNamespace;
+    private WebParam.Mode wpMode;
+    private boolean wpHeader;
+    private String javaType;
+    private QName mXMLType;
+
+    public DefaultParameterMetadataImpl() {
+    }
+
+    public boolean isWpHeader() {
+        return wpHeader;
+    }
+
+    public void setWpHeader(boolean wpHeader) {
+        this.wpHeader = wpHeader;
+    }
+
+    public WebParam.Mode getWpMode() {
+        return wpMode;
+    }
+
+    public void setWpMode(WebParam.Mode wpMode) {
+        this.wpMode = wpMode;
+    }
+
+    public String getWpName() {
+        return wpName;
+    }
+
+    public void setWpName(String wpName) {
+        this.wpName = wpName;
+    }
+
+    public String getWpTargetNamespace() {
+        return wpTargetNamespace;
+    }
+
+    public void setWpTargetNamespace(String wpTargetNamespace) {
+        this.wpTargetNamespace = wpTargetNamespace;
+    }
+
+    public String getJavaType() {
+        return javaType;
+    }
+
+    public void setJavaType(String javaType) {
+        this.javaType = javaType;
+    }
+
+    public String getJavaTypeFullName() {
+        return HackUtils.convertToReadableName(getJavaType());
+    }
+
+    public QName getXmlType() {
+        return mXMLType;
+    }
+
+    public void setXmlType(QName xmlType) {
+        mXMLType = xmlType;
+    }
+}

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java Fri Oct  7 20:59:52 2005
@@ -1,302 +1,298 @@
-/*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$Factory
- */
-package org.apache.beehive.wsm.model.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.jws.soap.SOAPBinding;
-
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
-import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
-import org.apache.beehive.wsm.model.ValidationException;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-
-/**
- *
- */
-public class DefaultTypeMetadataImpl
-    extends BeehiveWsTypeMetadata
-    implements java.io.Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private String wsName;
-    private String wsServiceName;
-    private String wsWsdlLocation;
-    private String wsTargetNamespace;
-    private String wsEndpointInterface;
-    private Map<String, BeehiveWsMethodMetadata> methodMap = new HashMap<String, BeehiveWsMethodMetadata>();
-    private Set<BeehiveWsMethodMetadata> noDuplicateMethods;
-    private BeehiveWsSOAPBindingInfo soapBinding;
-    private List<BeehiveWsSOAPMessageHandlerInfo> soapHandlers = new ArrayList<BeehiveWsSOAPMessageHandlerInfo>();
-    private String siValue;
-    private String className;
-    private String hcFileName;
-    private String hcName;
-
-    /**
-     * Default constructor.
-     */
-    public DefaultTypeMetadataImpl() {
-    }
-
-    /**
-     * @return Returns the hcFileName.
-     */
-    public String getHcFileName() {
-        return hcFileName;
-    }
-
-    /**
-     * @param hcFileName The hcFileName to set.
-     */
-    public void setHcFileName(String hcFileName) {
-        this.hcFileName = hcFileName;
-    }
-
-    /**
-     * @return Returns the hcName.
-     */
-    public String getHcName() {
-        return hcName;
-    }
-
-    /**
-     * @param hcName The hcName to set.
-     */
-    public void setHcName(String hcName) {
-        this.hcName = hcName;
-    }
-
-
-    /**
-     * @return Returns the siRunAs.
-     */
-    public String getSiValue() {
-        return siValue;
-    }
-
-    /**
-     * @param siValue The siRunAs to set.
-     */
-    public void setSiValue(String siValue) {
-        this.siValue = siValue;
-    }
-
-    /**
-     * @return Returns the soapBinding.
-     */
-    public BeehiveWsSOAPBindingInfo getSoapBinding() {
-        if(soapBinding == null) {
-            soapBinding = new DefaultSOAPBindingInfoImpl();
-        }
-        return soapBinding;
-    }
-
-    /**
-     * @param soapBinding The soapBinding to set.
-     */
-    public void setSoapBinding(BeehiveWsSOAPBindingInfo soapBinding) {
-        this.soapBinding = soapBinding;
-    }
-
-    /**
-     * @return Returns the wsName.
-     */
-    public String getWsName() {
-        return wsName;
-    }
-
-    /**
-     * @param wsName The wsName to set.
-     */
-    public void setWsName(String wsName) {
-        this.wsName = wsName;
-    }
-
-    /**
-     * @return Returns the wsServiceName.
-     */
-    public String getWsServiceName() {
-        return wsServiceName;
-    }
-
-    /**
-     * @param wsServiceName The wsServiceName to set.
-     */
-    public void setWsServiceName(String wsServiceName) {
-        this.wsServiceName = wsServiceName;
-    }
-
-    /**
-     * @return Returns the wsTargetNamespace.
-     */
-    public String getWsTargetNamespace() {
-        return wsTargetNamespace;
-    }
-
-    /**
-     * @param wsTargetNamespace The wsTargetNamespace to set.
-     */
-    public void setWsTargetNamespace(String wsTargetNamespace) {
-        this.wsTargetNamespace = wsTargetNamespace;
-    }
-
-
-    public String[] getTargetNamespaceParts() {
-        // strip the "http://" from the targetnamespace
-        String namespace = getWsTargetNamespace().substring(7, getWsTargetNamespace().length());
-        String[] beforeTranspose = namespace.split("[\\./]");
-        String[] res = new String[beforeTranspose.length];
-        for(int i = 0; i < res.length; i++)
-            res[i] = beforeTranspose[res.length - i - 1];
-        return res;
-    }
-
-    /**
-     * @return Returns the wsEndpointInterface.
-     */
-    public String getWsEndpointInterface() {
-        return wsEndpointInterface;
-    }
-
-    /**
-     * @param wsEndpointInterface The wsEndpointInterface to set.
-     */
-    public void setWsEndpointInterface(String wsEndpointInterface) {
-        this.wsEndpointInterface = wsEndpointInterface;
-    }
-
-    /**
-     * @return Returns the wsWsdlLocation.
-     */
-    public String getWsWsdlLocation() {
-        return wsWsdlLocation;
-    }
-
-    /**
-     * @param wsWsdlLocation The wsWsdlLocation to set.
-     */
-    public void setWsWsdlLocation(String wsWsdlLocation) {
-        this.wsWsdlLocation = wsWsdlLocation;
-    }
-
-    /**
-     * @return Returns the methods.
-     */
-    public Collection<BeehiveWsMethodMetadata> getMethods() {
-        if(noDuplicateMethods == null) {
-            noDuplicateMethods = Collections
-                .unmodifiableSet(new HashSet<BeehiveWsMethodMetadata>
-                (methodMap.values()));
-        }
-        return noDuplicateMethods;
-    }
-
-    public BeehiveWsMethodMetadata getMethod(String methodName, Class... paramTypes) {
-        String sig = createCompleteMethodSignature(methodName, paramTypes);
-
-        BeehiveWsMethodMetadata meta = methodMap.get(sig);
-        if(meta == null) {
-            /*
-             * NOTE jcolwell@bea.com 2004-Nov-29 --
-             * this fallback may be a bad thing but it is nice to have if the
-             * WSDLProcessor cannot map the Java types properly when used on the
-             * client side.
-             */
-            meta = methodMap.get(methodName + '(' + paramTypes.length + ')');
-        }
-        return meta;
-    }
-
-    public void addMethod(BeehiveWsMethodMetadata method)
-        throws ValidationException {
-
-        // NOTE jcolwell@bea.com 2004-Nov-29 -- clear the Set that prevents
-        // duplicates being returned from getMethods().
-        noDuplicateMethods = null;
-        List<? extends BeehiveWsParameterMetadata> params = method.getParams();
-        Class[] paramTypes = new Class[params.size()];
-        int j = 0;
-        for(BeehiveWsParameterMetadata param : params) {
-            Class javaType = param.getJavaType();
-            if(null == javaType) {
-                throw new ValidationException("<null> is not a valid parameter class");
-            }
-            paramTypes[j++] = javaType;
-        }
-        String opName = method.getWmOperationName();
-        String sig = createCompleteMethodSignature(opName, paramTypes);
-
-        if(methodMap.containsKey(sig)) {
-            throw new ValidationException(sig + " is already present in this Web Service and duplicate methods are not permitted");
-        }
-        else if(SOAPBinding.Style.DOCUMENT.equals(getSoapBinding().getStyle()) && methodMap.containsKey(opName)) {
-            throw new ValidationException("document-style does not allow duplicate methods: " + opName);
-        }
-        else {
-            methodMap.put(sig, method);
-            methodMap.put(opName + '(' + paramTypes.length + ')', method);
-        }
-    }
-
-    public List<? extends BeehiveWsSOAPMessageHandlerInfo> getSoapHandlers() {
-        return Collections.unmodifiableList(soapHandlers);
-    }
-
-    public void addSOAPHandler(BeehiveWsSOAPMessageHandlerInfo soapHandler) {
-        soapHandlers.add(soapHandler);
-    }
-
-    public String getClassName() {
-        return className;
-    }
-
-    public void setClassName(String className) {
-        this.className = className;
-    }
-
-    /* todo: this needs to go, as it should really be in Jsr181MethodMetadataImpl!!! */
-    private String createCompleteMethodSignature(String name, Class... paramTypes) {
-
-        StringBuilder sb = new StringBuilder(name);
-        sb.append('(');
-        boolean firstParam = true;
-        if(paramTypes != null) {
-            for(Class type : paramTypes) {
-                if(firstParam) {
-                    firstParam = false;
-                }
-                else {
-                    sb.append(',');
-                }
-                sb.append(type.getName());
-            }
-        }
-        sb.append(')');
-        return sb.toString();
-    }
-}
\ No newline at end of file
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$Factory
+ */
+package org.apache.beehive.wsm.model.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
+import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
+import org.apache.beehive.wsm.model.ValidationException;
+import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
+
+/**
+ *
+ */
+public class DefaultTypeMetadataImpl
+    extends BeehiveWsTypeMetadata
+    implements java.io.Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String wsName;
+    private String wsServiceName;
+    private String wsWsdlLocation;
+    private String wsTargetNamespace;
+    private String wsEndpointInterface;
+    private Map<String, BeehiveWsMethodMetadata> methodMap = new HashMap<String, BeehiveWsMethodMetadata>();
+    private Set<BeehiveWsMethodMetadata> noDuplicateMethods;
+    private BeehiveWsSOAPBindingInfo soapBinding;
+    private List<BeehiveWsSOAPMessageHandlerInfo> soapHandlers = new ArrayList<BeehiveWsSOAPMessageHandlerInfo>();
+    private String siValue;
+    private String className;
+    private String hcFileName;
+    private String hcName;
+
+    /**
+     * Default constructor.
+     */
+    public DefaultTypeMetadataImpl() {
+    }
+
+    /**
+     * @return Returns the hcFileName.
+     */
+    public String getHcFileName() {
+        return hcFileName;
+    }
+
+    /**
+     * @param hcFileName The hcFileName to set.
+     */
+    public void setHcFileName(String hcFileName) {
+        this.hcFileName = hcFileName;
+    }
+
+    /**
+     * @return Returns the hcName.
+     */
+    public String getHcName() {
+        return hcName;
+    }
+
+    /**
+     * @param hcName The hcName to set.
+     */
+    public void setHcName(String hcName) {
+        this.hcName = hcName;
+    }
+
+
+    /**
+     * @return Returns the siRunAs.
+     */
+    public String getSiValue() {
+        return siValue;
+    }
+
+    /**
+     * @param siValue The siRunAs to set.
+     */
+    public void setSiValue(String siValue) {
+        this.siValue = siValue;
+    }
+
+    /**
+     * @return Returns the soapBinding.
+     */
+    public BeehiveWsSOAPBindingInfo getSoapBinding() {
+        if(soapBinding == null) {
+            soapBinding = new DefaultSOAPBindingInfoImpl();
+        }
+        return soapBinding;
+    }
+
+    /**
+     * @param soapBinding The soapBinding to set.
+     */
+    public void setSoapBinding(BeehiveWsSOAPBindingInfo soapBinding) {
+        this.soapBinding = soapBinding;
+    }
+
+    /**
+     * @return Returns the wsName.
+     */
+    public String getWsName() {
+        return wsName;
+    }
+
+    /**
+     * @param wsName The wsName to set.
+     */
+    public void setWsName(String wsName) {
+        this.wsName = wsName;
+    }
+
+    /**
+     * @return Returns the wsServiceName.
+     */
+    public String getWsServiceName() {
+        return wsServiceName;
+    }
+
+    /**
+     * @param wsServiceName The wsServiceName to set.
+     */
+    public void setWsServiceName(String wsServiceName) {
+        this.wsServiceName = wsServiceName;
+    }
+
+    /**
+     * @return Returns the wsTargetNamespace.
+     */
+    public String getWsTargetNamespace() {
+        return wsTargetNamespace;
+    }
+
+    /**
+     * @param wsTargetNamespace The wsTargetNamespace to set.
+     */
+    public void setWsTargetNamespace(String wsTargetNamespace) {
+        this.wsTargetNamespace = wsTargetNamespace;
+    }
+
+
+    public String[] getTargetNamespaceParts() {
+        // strip the "http://" from the targetnamespace
+        String namespace = getWsTargetNamespace().substring(7, getWsTargetNamespace().length());
+        String[] beforeTranspose = namespace.split("[\\./]");
+        String[] res = new String[beforeTranspose.length];
+        for(int i = 0; i < res.length; i++)
+            res[i] = beforeTranspose[res.length - i - 1];
+        return res;
+    }
+
+    /**
+     * @return Returns the wsEndpointInterface.
+     */
+    public String getWsEndpointInterface() {
+        return wsEndpointInterface;
+    }
+
+    /**
+     * @param wsEndpointInterface The wsEndpointInterface to set.
+     */
+    public void setWsEndpointInterface(String wsEndpointInterface) {
+        this.wsEndpointInterface = wsEndpointInterface;
+    }
+
+    /**
+     * @return Returns the wsWsdlLocation.
+     */
+    public String getWsWsdlLocation() {
+        return wsWsdlLocation;
+    }
+
+    /**
+     * @param wsWsdlLocation The wsWsdlLocation to set.
+     */
+    public void setWsWsdlLocation(String wsWsdlLocation) {
+        this.wsWsdlLocation = wsWsdlLocation;
+    }
+
+    /**
+     * @return Returns the methods.
+     */
+    public Collection<BeehiveWsMethodMetadata> getMethods() {
+        if(noDuplicateMethods == null) {
+            noDuplicateMethods = Collections
+                .unmodifiableSet(new HashSet<BeehiveWsMethodMetadata>
+                (methodMap.values()));
+        }
+        return noDuplicateMethods;
+    }
+
+    public BeehiveWsMethodMetadata getMethod(String methodName, String... paramTypes) {
+        String sig = createCompleteMethodSignature(methodName, paramTypes);
+
+        BeehiveWsMethodMetadata meta = methodMap.get(sig);
+        if(meta == null) {
+            /*
+             * NOTE jcolwell@bea.com 2004-Nov-29 --
+             * this fallback may be a bad thing but it is nice to have if the
+             * WSDLProcessor cannot map the Java types properly when used on the
+             * client side.
+             */
+            meta = methodMap.get(methodName + '(' + paramTypes.length + ')');
+        }
+        return meta;
+    }
+
+    public void addMethod(BeehiveWsMethodMetadata method) {
+
+        // NOTE jcolwell@bea.com 2004-Nov-29 -- clear the Set that prevents
+        // duplicates being returned from getMethods().
+        noDuplicateMethods = null;
+        List<? extends BeehiveWsParameterMetadata> params = method.getParams();
+        String[] paramTypes = new String[params.size()];
+        int j = 0;
+        for(BeehiveWsParameterMetadata param : params) {
+            String javaType = param.getJavaType();
+            if(null == javaType) {
+                throw new ValidationException("<null> is not a valid parameter class");
+            }
+            paramTypes[j++] = javaType;
+        }
+        String opName = method.getWmOperationName();
+        String sig = createCompleteMethodSignature(opName, paramTypes);
+
+        if(methodMap.containsKey(sig)) {
+            throw new ValidationException(sig + " is already present in this Web Service and duplicate methods are not permitted");
+        }
+        else if(SOAPBinding.Style.DOCUMENT.equals(getSoapBinding().getStyle()) && methodMap.containsKey(opName)) {
+            throw new ValidationException("document-style does not allow duplicate methods: " + opName);
+        }
+        else {
+            methodMap.put(sig, method);
+            methodMap.put(opName + '(' + paramTypes.length + ')', method);
+        }
+    }
+
+    public List<? extends BeehiveWsSOAPMessageHandlerInfo> getSoapHandlers() {
+        return Collections.unmodifiableList(soapHandlers);
+    }
+
+    public void addSOAPHandler(BeehiveWsSOAPMessageHandlerInfo soapHandler) {
+        soapHandlers.add(soapHandler);
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    /* todo: this needs to go, as it should really be in Jsr181MethodMetadataImpl!!! */
+    private String createCompleteMethodSignature(String name, String... paramTypes) {
+
+        StringBuilder sb = new StringBuilder(name);
+        sb.append('(');
+        boolean firstParam = true;
+        if(paramTypes != null) {
+            for(int i = 0; i < paramTypes.length; i++) {
+                if(i > 0)
+                    firstParam = false;
+                else sb.append(',');
+                sb.append(paramTypes[i]);
+            }
+        }
+        sb.append(')');
+        return sb.toString();
+    }
+}

Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java?rev=307252&r1=307251&r2=307252&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/jsr181/Jsr181ObjectModelStore.java Fri Oct  7 20:59:52 2005
@@ -32,38 +32,16 @@
 
 /**
  * Encapsulates all knowledge about where and how object models are persisted.
+ *
  */
 public class Jsr181ObjectModelStore {
 
+    /* todo: need to switch entirely to throwing ObjectModelStoreException */
+
     private final static String EXTENSION = ".ser";
     private final static String FILE_NAME_LOCATOR = ".webservices";
 
-    private static boolean isMarked = false;
-
-    private AnnotationProcessorEnvironment env;
-
-    /**
-     * Constructor.
-     *
-     * @param env A context that is required to access the filer.
-     *            TODO needs to be abstracted further.
-     */
-    public Jsr181ObjectModelStore(AnnotationProcessorEnvironment env) {
-        if(null == env) {
-            throw new IllegalArgumentException("illegal apt environment: <null>");
-        }
-        this.env = env;
-    }
-
-    /**
-     * Encapsulates the encoding of the pathname for object models.
-     *
-     * @param className
-     * @return File
-     */
-    public static File getLocation(String className) {
-        return new File(className + EXTENSION);
-    }
+    private Jsr181ObjectModelStore() {}
 
     /**
      * @param clazz
@@ -98,17 +76,17 @@
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static BeehiveWsTypeMetadata load(InputStream is)
+    public static final BeehiveWsTypeMetadata load(InputStream is)
         throws IOException, ClassNotFoundException {
 
         if(null == is)
             throw new IOException("cannot load object model without input stream");
 
-        Jsr181TypeMetadataImpl objectModel = null;
+        BeehiveWsTypeMetadata objectModel = null;
         ObjectInputStream ois = null;
         try {
             ois = new ObjectInputStream(is);
-            objectModel = (Jsr181TypeMetadataImpl)ois.readObject();
+            objectModel = (BeehiveWsTypeMetadata)ois.readObject();
         }
         finally {
             if(null != ois) {
@@ -122,32 +100,33 @@
      * Persists a given <code>objectModel</code>.
      *
      * @param objectModel The object mode to be persisted.
-     * @throws IOException If the object model cannot be persisted.
      */
-    public void store(BeehiveWsTypeMetadata objectModel)
-        throws IOException {
+    public static void store(AnnotationProcessorEnvironment env, BeehiveWsTypeMetadata objectModel) {
 
-        OutputStream os = env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", getLocation(objectModel.getClassName()));
+        if(objectModel == null)
+            throw new ObjectModelStoreException("Can not persist empty object model");
+
+        //env.getMessager().printNotice("Persisting object model: " + objectModel.getClassName());
+
+        OutputStream os = null;
         ObjectOutputStream oos = null;
+
         try {
-            if(null == os) {
-                throw new IOException("cannot persist object model without output stream");
-            }
-            if(null == objectModel) {
-                throw new IOException("cannot persist empty object model ");
-            }
+            Filer filer = env.getFiler();
+            os = filer.createBinaryFile(Filer.Location.CLASS_TREE, "", getLocation(objectModel.getClassName()));
             oos = new ObjectOutputStream(os);
             oos.writeObject(objectModel);
-
-            if(!isMarked) {
-                env.getFiler().createBinaryFile(Filer.Location.CLASS_TREE, "", new java.io.File(FILE_NAME_LOCATOR));
-                isMarked = true;
-            }
+        }
+        catch(IOException e) {
+            throw new ObjectModelStoreException("Exception occurred writing WSM object model.  Cause: " + e, e);
         }
         finally {
             if(null != oos) {
-                oos.flush();
-                oos.close();
+                try {
+                    oos.flush();
+                    oos.close();
+                }
+                catch(IOException ignore) {}
             }
         }
     }
@@ -212,5 +191,15 @@
             }
         }
         return fqClassName;
+    }
+
+    /**
+     * Encapsulates the encoding of the pathname for object models.
+     *
+     * @param className
+     * @return File
+     */
+    private static File getLocation(String className) {
+        return new File(className + EXTENSION);
     }
 }