geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r164051 - /geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder /geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder /geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client /geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server /geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis
Date Thu, 21 Apr 2005 12:54:03 GMT
Author: gdamour
Date: Thu Apr 21 05:54:02 2005
New Revision: 164051

URL: http://svn.apache.org/viewcvs?rev=164051&view=rev
Log:
Refactoring.

o Merge TypeDescInfo and TypeMappingInfo into a single class, namely TypeInfo.

o Extract from AxisBuilder and AxisServiceBuilder the methods building the
lightweight and heavyweight type desc and mapping info and put them in
two new types of builders: LightweightTypeInfoBuilder and 
HeavyweightTypeInfoBuilder.

Added:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightTypeInfoBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/LightweightTypeInfoBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeInfoBuilder.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeInfo.java
Removed:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeMappingInfo.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java
Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
    geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ReadOnlyServiceDesc.java
    geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java (original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java Thu Apr 21 05:54:02 2005
@@ -26,6 +26,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -57,11 +58,6 @@
 import org.apache.axis.client.Service;
 import org.apache.axis.constants.Style;
 import org.apache.axis.description.JavaServiceDesc;
-import org.apache.axis.description.TypeDesc;
-import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
-import org.apache.axis.encoding.ser.ArraySerializerFactory;
-import org.apache.axis.encoding.ser.BeanDeserializerFactory;
-import org.apache.axis.encoding.ser.BeanSerializerFactory;
 import org.apache.axis.handlers.HandlerInfoChainFactory;
 import org.apache.axis.handlers.soap.SOAPService;
 import org.apache.axis.providers.java.RPCProvider;
@@ -74,7 +70,6 @@
 import org.apache.geronimo.axis.client.SerializableNoOp;
 import org.apache.geronimo.axis.client.ServiceImpl;
 import org.apache.geronimo.axis.client.ServiceMethodInterceptor;
-import org.apache.geronimo.axis.client.TypeMappingInfo;
 import org.apache.geronimo.axis.server.AxisWebServiceContainer;
 import org.apache.geronimo.axis.server.POJOProvider;
 import org.apache.geronimo.axis.server.ServiceInfo;
@@ -88,14 +83,12 @@
 import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.ClassLoaderReference;
-import org.apache.geronimo.kernel.ClassLoading;
 import org.apache.geronimo.kernel.StoredObject;
 import org.apache.geronimo.naming.reference.DeserializingReference;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
 import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointInterfaceMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
-import org.apache.xmlbeans.SchemaType;
 
 /**
  * @version $Rev:  $ $Date:  $
@@ -351,10 +344,10 @@
             operationInfos[i++] = operationInfo;
             wrapperElementQNames.addAll(operationDescBuilder.getWrapperElementQNames());
         }
-        List typeMappings = new ArrayList();
-        Map typeDescriptors = new HashMap();
-        buildTypeInfoHeavyweight(wrapperElementQNames, javaXmlTypeMappings, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), classLoader, typeMappings, typeDescriptors);
-        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass, serviceImpl, typeMappings, typeDescriptors, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
+        HeavyweightTypeInfoBuilder builder = new HeavyweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), wrapperElementQNames);
+        List typeInfo = builder.buildTypeInfo(mapping);
+        
+        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass, serviceImpl, typeInfo, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
         seiPortNameToFactoryMap.put(portName, seiFactory);
         seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory);
     }
@@ -374,114 +367,14 @@
             OperationInfo operationInfo = buildOperationInfoLightweight(method, bindingOperation, portStyle, soapVersion);
             operationInfos[i++] = operationInfo;
         }
-        List typeMappings = new ArrayList();
-        Map typeDescriptors = new HashMap();
-        buildTypeInfoLightWeight(schemaInfoBuilder, mapping, classLoader, typeMappings, typeDescriptors);
-        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass, serviceImpl, typeMappings, typeDescriptors, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
+        LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET);
+        List typeInfo = builder.buildTypeInfo(mapping);
+        
+        seiFactory = createSEIFactory(serviceName, portName, enhancedServiceEndpointClass, serviceImpl, typeInfo, location, operationInfos, handlerInfos, credentialsName, context, classLoader);
         seiPortNameToFactoryMap.put(portName, seiFactory);
         seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory);
     }
-
-    private void buildTypeInfoLightWeight(SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType mapping, ClassLoader classLoader, List typeMappings, Map typeDescriptors) throws DeploymentException {
-        Map schemaTypeKeyToSchemaTypeMap = schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap();
-        for (Iterator iterator = schemaTypeKeyToSchemaTypeMap.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            SchemaTypeKey key = (SchemaTypeKey) entry.getKey();
-//            SchemaType schemaType = (SchemaType) entry.getValue();
-            if (!key.isElement() && !key.isAnonymous()) {
-                //default settings
-                Class serializerFactoryClass = BeanSerializerFactory.class;
-                Class deserializerFactoryClass = BeanDeserializerFactory.class;
-                QName typeQName = key.getqName();
-                String namespace = typeQName.getNamespaceURI();
-                String packageName = WSDescriptorParser.getPackageFromNamespace(namespace, mapping);
-                String classShortName = typeQName.getLocalPart();
-                String className = packageName + "." + classShortName;
-
-                Class clazz = null;
-                try {
-                    clazz = ClassLoading.loadClass(className, classLoader);
-                } catch (ClassNotFoundException e) {
-                    throw new DeploymentException("Could not load java type", e);
-                }
-                if (clazz.isArray()) {
-                    serializerFactoryClass = ArraySerializerFactory.class;
-                    deserializerFactoryClass = ArrayDeserializerFactory.class;
-                }
-
-                TypeMappingInfo typeMappingInfo = new TypeMappingInfo(clazz, typeQName, serializerFactoryClass, deserializerFactoryClass);
-                typeMappings.add(typeMappingInfo);
-                //TODO construct typedesc as well.
-//                TypeDesc typeDesc = getTypeDescriptor(clazz, typeQName, javaXmlTypeMapping, schemaType);
-//                typeDescriptors.put(clazz, typeDesc);
-
-            }
-        }
-    }
-
-    public static void buildTypeInfoHeavyweight(Set wrapperElementQNames, JavaXmlTypeMappingType[] javaXmlTypeMappings, Map schemaTypeKeyToSchemaTypeMap, ClassLoader classLoader, List typeMappings, Map typeDescriptors) throws DeploymentException {
-        for (int j = 0; j < javaXmlTypeMappings.length; j++) {
-            JavaXmlTypeMappingType javaXmlTypeMapping = javaXmlTypeMappings[j];
-
-            QName typeName;
-            SchemaTypeKey key;
-            boolean isElement = javaXmlTypeMapping.getQnameScope().getStringValue().equals("element");
-            boolean isSimpleType = javaXmlTypeMapping.getQnameScope().getStringValue().equals("simpleType");
-            if (javaXmlTypeMapping.isSetRootTypeQname()) {
-                typeName = javaXmlTypeMapping.getRootTypeQname().getQNameValue();
-                key = new SchemaTypeKey(typeName, isElement, isSimpleType, false);
-
-                // Skip the wrapper elements.
-                if (wrapperElementQNames.contains(typeName)) {
-                    continue;
-                }
-            } else if (javaXmlTypeMapping.isSetAnonymousTypeQname()) {
-                String anonTypeQNameString = javaXmlTypeMapping.getAnonymousTypeQname().getStringValue();
-                int pos = anonTypeQNameString.lastIndexOf(":");
-                if (pos == -1) {
-                    throw new DeploymentException("anon QName is invalid, no final ':' " + anonTypeQNameString);
-                }
-                //this appears to be ignored...
-                typeName = new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 1));
-                key = new SchemaTypeKey(typeName, isElement, isSimpleType, true);
-
-                // Skip the wrapper elements.
-                if (wrapperElementQNames.contains(new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 2)))) {
-                    continue;
-                }
-            } else {
-                throw new DeploymentException("either root type qname or anonymous type qname must be set");
-            }
-            SchemaType schemaType = (SchemaType) schemaTypeKeyToSchemaTypeMap.get(key);
-            if (schemaType == null) {
-                throw new DeploymentException("Schema type key " + key + " not found in analyzed schema: " + schemaTypeKeyToSchemaTypeMap);
-            }
-
-            //default settings
-            Class serializerFactoryClass = BeanSerializerFactory.class;
-            Class deserializerFactoryClass = BeanDeserializerFactory.class;
-
-            String className = javaXmlTypeMapping.getJavaType().getStringValue().trim();
-
-            Class clazz = null;
-            try {
-                clazz = ClassLoading.loadClass(className, classLoader);
-            } catch (ClassNotFoundException e) {
-                throw new DeploymentException("Could not load java type", e);
-            }
-            if (clazz.isArray()) {
-                serializerFactoryClass = ArraySerializerFactory.class;
-                deserializerFactoryClass = ArrayDeserializerFactory.class;
-            }
-
-            TypeDesc typeDesc = TypeDescBuilder.getTypeDescriptor(clazz, typeName, javaXmlTypeMapping, schemaType);
-
-            TypeMappingInfo typeMappingInfo = new TypeMappingInfo(clazz, typeName, serializerFactoryClass, deserializerFactoryClass);
-            typeMappings.add(typeMappingInfo);
-            typeDescriptors.put(clazz, typeDesc);
-        }
-    }
-
+
     private Class getServiceEndpointInterfaceLightweight(PortType portType, JavaWsdlMappingType mappings, ClassLoader classLoader) throws DeploymentException {
         QName portTypeQName = portType.getQName();
         String portTypeNamespace = portTypeQName.getNamespaceURI();
@@ -498,10 +391,10 @@
     }
 
 
-    public SEIFactory createSEIFactory(QName serviceName, String portName, Class enhancedServiceEndpointClass, Object serviceImpl, List typeMappings, Map typeDescriptors, URL location, OperationInfo[] operationInfos, List handlerInfoInfos, String credentialsName, DeploymentContext deploymentContext, ClassLoader classLoader) throws DeploymentException {
+    public SEIFactory createSEIFactory(QName serviceName, String portName, Class enhancedServiceEndpointClass, Object serviceImpl, List typeInfo, URL location, OperationInfo[] operationInfos, List handlerInfoInfos, String credentialsName, DeploymentContext deploymentContext, ClassLoader classLoader) throws DeploymentException {
         List handlerInfos = buildHandlerInfosForPort(portName, handlerInfoInfos);
         try {
-            SEIFactory factory = new SEIFactoryImpl(serviceName, portName, enhancedServiceEndpointClass, operationInfos, serviceImpl, typeMappings, typeDescriptors, location, handlerInfos, classLoader, credentialsName);
+            SEIFactory factory = new SEIFactoryImpl(serviceName, portName, enhancedServiceEndpointClass, operationInfos, serviceImpl, typeInfo, location, handlerInfos, classLoader, credentialsName);
             return factory;
         } catch (ClassNotFoundException e) {
             throw new DeploymentException("Could not load GenericServiceEndpoint from application classloader", e);

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java (original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java Thu Apr 21 05:54:02 2005
@@ -45,26 +45,15 @@
 import org.apache.axis.constants.Style;
 import org.apache.axis.constants.Use;
 import org.apache.axis.description.JavaServiceDesc;
-import org.apache.axis.description.TypeDesc;
-import org.apache.axis.encoding.DeserializerFactory;
-import org.apache.axis.encoding.SerializerFactory;
 import org.apache.axis.encoding.TypeMapping;
 import org.apache.axis.encoding.TypeMappingRegistryImpl;
-import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
-import org.apache.axis.encoding.ser.ArraySerializerFactory;
-import org.apache.axis.encoding.ser.BaseDeserializerFactory;
-import org.apache.axis.encoding.ser.BaseSerializerFactory;
-import org.apache.axis.encoding.ser.BeanDeserializerFactory;
-import org.apache.axis.encoding.ser.BeanSerializerFactory;
+import org.apache.geronimo.axis.client.TypeInfo;
 import org.apache.geronimo.axis.server.ReadOnlyServiceDesc;
 import org.apache.geronimo.axis.server.ServiceInfo;
-import org.apache.geronimo.axis.server.TypeDescInfo;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.kernel.ClassLoading;
 import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
-import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.w3.x2001.xmlSchema.ImportDocument;
@@ -176,126 +165,18 @@
         serviceDesc.setTypeMappingRegistry(tmr);
         serviceDesc.setTypeMapping(typeMapping);
 
-        Map classToTypeDescInfo = new HashMap();
-
+        List typeInfo;
         if (isLightweight) {
-            buildLightweightTypes(schemaTypeKeyToSchemaTypeMap, portInfo, classLoader, typeMapping, classToTypeDescInfo);
+            LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaTypeKeyToSchemaTypeMap, wrapperElementQNames);
+            typeInfo = builder.buildTypeInfo(portInfo.getJavaWsdlMapping());
         } else {
-            JavaXmlTypeMappingType[] javaXmlTypeMappings = portInfo.getJavaWsdlMapping().getJavaXmlTypeMappingArray();
-            buildHeavyweightTypes(wrapperElementQNames, javaXmlTypeMappings, classLoader, schemaTypeKeyToSchemaTypeMap, typeMapping, classToTypeDescInfo);
+            HeavyweightTypeInfoBuilder builder = new HeavyweightTypeInfoBuilder(classLoader, schemaTypeKeyToSchemaTypeMap, wrapperElementQNames);
+            typeInfo = builder.buildTypeInfo(portInfo.getJavaWsdlMapping());
         }
-
+        TypeInfo.register(typeInfo, typeMapping);
+        
         serviceDesc.getOperations();
-        return new ReadOnlyServiceDesc(serviceDesc, classToTypeDescInfo);
-    }
-
-    private static void buildHeavyweightTypes(Set wrapperElementQNames, JavaXmlTypeMappingType[] javaXmlTypeMappings, ClassLoader classLoader, Map schemaTypeKeyToSchemaTypeMap, TypeMapping typeMapping, Map classToTypeDescInfo) throws DeploymentException {
-        for (int j = 0; j < javaXmlTypeMappings.length; j++) {
-            JavaXmlTypeMappingType javaXmlTypeMapping = javaXmlTypeMappings[j];
-
-            QName typeQName;
-            SchemaTypeKey key;
-            boolean isElement = javaXmlTypeMapping.getQnameScope().getStringValue().equals("element");
-            boolean isSimpleType = javaXmlTypeMapping.getQnameScope().getStringValue().equals("simpleType");
-            if (javaXmlTypeMapping.isSetRootTypeQname()) {
-                typeQName = javaXmlTypeMapping.getRootTypeQname().getQNameValue();
-                key = new SchemaTypeKey(typeQName, isElement, isSimpleType, false);
-
-                // Skip the wrapper elements.
-                if (wrapperElementQNames.contains(typeQName)) {
-                    continue;
-                }
-            } else if (javaXmlTypeMapping.isSetAnonymousTypeQname()) {
-                String anonTypeQNameString = javaXmlTypeMapping.getAnonymousTypeQname().getStringValue();
-                int pos = anonTypeQNameString.lastIndexOf(":");
-                if (pos == -1) {
-                    throw new DeploymentException("anon QName is invalid, no final ':' " + anonTypeQNameString);
-                }
-
-                //this appears to be ignored...
-                typeQName = new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 1));
-                key = new SchemaTypeKey(typeQName, isElement, isSimpleType, true);
-
-                // Skip the wrapper elements.
-                if (wrapperElementQNames.contains(new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 2)))) {
-                    continue;
-                }
-            } else {
-                throw new DeploymentException("either root type qname or anonymous type qname must be set");
-            }
-
-            SchemaType schemaType = (SchemaType) schemaTypeKeyToSchemaTypeMap.get(key);
-            if (schemaType == null) {
-                throw new DeploymentException("Schema type key " + key + " not found in analyzed schema: " + schemaTypeKeyToSchemaTypeMap);
-            }
-
-            //default settings
-            Class serializerFactoryClass = BeanSerializerFactory.class;
-            Class deserializerFactoryClass = BeanDeserializerFactory.class;
-
-            String className = javaXmlTypeMapping.getJavaType().getStringValue().trim();
-
-            Class clazz = null;
-            try {
-                clazz = ClassLoading.loadClass(className, classLoader);
-            } catch (ClassNotFoundException e2) {
-                throw new DeploymentException("Could not load java type", e2);
-            }
-
-            if (clazz.isArray()) {
-                serializerFactoryClass = ArraySerializerFactory.class;
-                deserializerFactoryClass = ArrayDeserializerFactory.class;
-            }
-
-            TypeDescInfo typeDescInfo = TypeDescBuilder.getTypeDescInfo(clazz, typeQName, javaXmlTypeMapping, schemaType);
-            TypeDesc.registerTypeDescForClass(clazz, typeDescInfo.buildTypeDesc());
-            classToTypeDescInfo.put(clazz, typeDescInfo);
-
-            SerializerFactory ser = BaseSerializerFactory.createFactory(serializerFactoryClass, clazz, typeQName);
-            DeserializerFactory deser = BaseDeserializerFactory.createFactory(deserializerFactoryClass, clazz, typeQName);
-
-            typeMapping.register(clazz, typeQName, ser, deser);
-        }
-    }
-
-    private static void buildLightweightTypes(Map schemaTypeKeyToSchemaTypeMap, PortInfo portInfo, ClassLoader classLoader, TypeMapping typeMapping, Map classToTypeDescInfo) throws DeploymentException {
-        for (Iterator iterator = schemaTypeKeyToSchemaTypeMap.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            SchemaTypeKey key = (SchemaTypeKey) entry.getKey();
-            SchemaType schemaType = (SchemaType) entry.getValue();
-            if (!key.isElement() && !key.isAnonymous()) {
-                //default settings
-                QName typeQName = key.getqName();
-                String namespace = typeQName.getNamespaceURI();
-                String packageName = WSDescriptorParser.getPackageFromNamespace(namespace, portInfo.getJavaWsdlMapping());
-                String classShortName = typeQName.getLocalPart();
-                String className = packageName + "." + classShortName;
-
-                Class clazz = null;
-                try {
-                    clazz = ClassLoading.loadClass(className, classLoader);
-                } catch (ClassNotFoundException e) {
-                    throw new DeploymentException("Could not load java type", e);
-                }
-
-                Class serializerFactoryClass = BeanSerializerFactory.class;
-                Class deserializerFactoryClass = BeanDeserializerFactory.class;
-
-                if (clazz.isArray()) {
-                    serializerFactoryClass = ArraySerializerFactory.class;
-                    deserializerFactoryClass = ArrayDeserializerFactory.class;
-                }
-
-                TypeDescInfo typeDescInfo = TypeDescBuilder.getTypeDescInfo(clazz, typeQName, schemaType);
-                TypeDesc.registerTypeDescForClass(clazz, typeDescInfo.buildTypeDesc());
-                classToTypeDescInfo.put(clazz, typeDescInfo);
-
-                SerializerFactory ser = BaseSerializerFactory.createFactory(serializerFactoryClass, clazz, typeQName);
-                DeserializerFactory deser = BaseDeserializerFactory.createFactory(deserializerFactoryClass, clazz, typeQName);
-
-                typeMapping.register(clazz, typeQName, ser, deser);
-            }
-        }
+        return new ReadOnlyServiceDesc(serviceDesc, typeInfo);
     }
 
     private static Set buildOperations(Binding binding, Class serviceEndpointInterface, boolean lightweight, PortInfo portInfo, Map exceptionMap, ClassLoader classLoader, JavaServiceDesc serviceDesc) throws DeploymentException {

Added: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightTypeInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightTypeInfoBuilder.java?rev=164051&view=auto
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightTypeInfoBuilder.java (added)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightTypeInfoBuilder.java Thu Apr 21 05:54:02 2005
@@ -0,0 +1,232 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.axis.builder;
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.description.AttributeDesc;
+import org.apache.axis.description.ElementDesc;
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
+import org.apache.axis.encoding.ser.BeanDeserializerFactory;
+import org.apache.axis.encoding.ser.BeanSerializerFactory;
+import org.apache.axis.encoding.ser.SimpleListDeserializerFactory;
+import org.apache.axis.encoding.ser.SimpleListSerializerFactory;
+import org.apache.geronimo.axis.client.TypeInfo;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.kernel.ClassLoading;
+import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
+import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType;
+import org.apache.geronimo.xbeans.j2ee.VariableMappingType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaType;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class HeavyweightTypeInfoBuilder implements TypeInfoBuilder {
+    private final ClassLoader cl;
+    private final Map schemaTypeKeyToSchemaTypeMap;
+    private final Set wrapperElementQNames;
+    
+    public HeavyweightTypeInfoBuilder(ClassLoader cl, Map schemaTypeKeyToSchemaTypeMap, Set wrapperElementQNames) {
+        this.cl = cl;
+        this.schemaTypeKeyToSchemaTypeMap = schemaTypeKeyToSchemaTypeMap;
+        this.wrapperElementQNames = wrapperElementQNames;
+    }
+    
+    public List buildTypeInfo(JavaWsdlMappingType mapping) throws DeploymentException {
+        List typeInfoList = new ArrayList();
+        
+        JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray();
+        for (int j = 0; j < javaXmlTypeMappings.length; j++) {
+            JavaXmlTypeMappingType javaXmlTypeMapping = javaXmlTypeMappings[j];
+
+            QName typeQName;
+            SchemaTypeKey key;
+            boolean isElement = javaXmlTypeMapping.getQnameScope().getStringValue().equals("element");
+            boolean isSimpleType = javaXmlTypeMapping.getQnameScope().getStringValue().equals("simpleType");
+            if (javaXmlTypeMapping.isSetRootTypeQname()) {
+                typeQName = javaXmlTypeMapping.getRootTypeQname().getQNameValue();
+                key = new SchemaTypeKey(typeQName, isElement, isSimpleType, false);
+
+                // Skip the wrapper elements.
+                if (wrapperElementQNames.contains(typeQName)) {
+                    continue;
+                }
+            } else if (javaXmlTypeMapping.isSetAnonymousTypeQname()) {
+                String anonTypeQNameString = javaXmlTypeMapping.getAnonymousTypeQname().getStringValue();
+                int pos = anonTypeQNameString.lastIndexOf(":");
+                if (pos == -1) {
+                    throw new DeploymentException("anon QName is invalid, no final ':' " + anonTypeQNameString);
+                }
+
+                //this appears to be ignored...
+                typeQName = new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 1));
+                key = new SchemaTypeKey(typeQName, isElement, isSimpleType, true);
+
+                // Skip the wrapper elements.
+                if (wrapperElementQNames.contains(new QName(anonTypeQNameString.substring(0, pos), anonTypeQNameString.substring(pos + 2)))) {
+                    continue;
+                }
+            } else {
+                throw new DeploymentException("either root type qname or anonymous type qname must be set");
+            }
+
+            //default settings
+            Class serializerFactoryClass = BeanSerializerFactory.class;
+            Class deserializerFactoryClass = BeanDeserializerFactory.class;
+
+            String className = javaXmlTypeMapping.getJavaType().getStringValue().trim();
+
+            Class clazz = null;
+            try {
+                clazz = ClassLoading.loadClass(className, cl);
+            } catch (ClassNotFoundException e2) {
+                throw new DeploymentException("Could not load java type", e2);
+            }
+
+            if (clazz.isArray()) {
+                serializerFactoryClass = ArraySerializerFactory.class;
+                deserializerFactoryClass = ArrayDeserializerFactory.class;
+            } else if (clazz == List.class) {
+                serializerFactoryClass = SimpleListSerializerFactory.class;
+                deserializerFactoryClass = SimpleListDeserializerFactory.class;
+            }
+
+            TypeInfo.UpdatableTypeInfo internalTypeInfo = new TypeInfo.UpdatableTypeInfo(); 
+            internalTypeInfo.setClazz(clazz);
+            internalTypeInfo.setQName(typeQName);
+            internalTypeInfo.setSerializerClass(serializerFactoryClass);
+            internalTypeInfo.setDeserializerClass(deserializerFactoryClass);
+            
+            populateInternalTypeInfo(clazz, typeQName, key, javaXmlTypeMapping, internalTypeInfo);
+
+            typeInfoList.add(internalTypeInfo.buildTypeInfo());
+        }
+        
+        return typeInfoList;
+    }
+    
+    private void populateInternalTypeInfo(Class javaClass, QName typeQName, SchemaTypeKey key, JavaXmlTypeMappingType javaXmlTypeMapping, TypeInfo.UpdatableTypeInfo typeInfo) throws DeploymentException {
+        SchemaType schemaType = (SchemaType) schemaTypeKeyToSchemaTypeMap.get(key);
+        if (schemaType == null) {
+            throw new DeploymentException("Schema type key " + key + " not found in analyzed schema: " + schemaTypeKeyToSchemaTypeMap);
+        }
+        String ns = key.getqName().getNamespaceURI();
+        
+        typeInfo.setCanSearchParents(schemaType.getDerivationType() == SchemaType.DT_RESTRICTION);
+        
+        Map nameToType = new HashMap();
+        if (null  == schemaType.getContentModel()) {
+            ;
+        } else if (SchemaParticle.SEQUENCE == schemaType.getContentModel().getParticleType()) {
+            SchemaParticle[] properties = schemaType.getContentModel().getParticleChildren();
+            for (int i = 0; i < properties.length; i++) {
+                SchemaParticle parameter = properties[i];
+                // TODO why the ns of parameter.getName() is wrong?
+                nameToType.put(new QName(ns, parameter.getName().getLocalPart()) , parameter);
+            }
+        } else if (SchemaParticle.ELEMENT == schemaType.getContentModel().getParticleType()) {
+            SchemaParticle parameter = schemaType.getContentModel();
+            // TODO why the ns of parameter.getName() is wrong?
+            nameToType.put(new QName(ns, parameter.getName().getLocalPart()) , parameter);
+        } else {
+            throw new DeploymentException("Only sequence particle types are supported." +
+                    " SchemaType name =" + schemaType.getName());
+        }
+        
+        VariableMappingType[] variableMappings = javaXmlTypeMapping.getVariableMappingArray();
+        FieldDesc[] fields = new FieldDesc[variableMappings.length];
+        typeInfo.setFields(fields);
+        
+        PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[0];
+        try {
+            propertyDescriptors = Introspector.getBeanInfo(javaClass).getPropertyDescriptors();
+        } catch (IntrospectionException e) {
+            throw new DeploymentException("Class " + javaClass + " is not a valid javabean", e);
+        }
+        Map properties = new HashMap();
+        for (int i = 0; i < propertyDescriptors.length; i++) {
+            PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
+            properties.put(propertyDescriptor.getName(), propertyDescriptor.getPropertyType());
+        }
+        for (int i = 0; i < variableMappings.length; i++) {
+            VariableMappingType variableMapping = variableMappings[i];
+            String fieldName = variableMapping.getJavaVariableName().getStringValue().trim();
+
+            if (variableMapping.isSetXmlAttributeName()) {
+                AttributeDesc attributeDesc = new AttributeDesc();
+                attributeDesc.setFieldName(fieldName);
+                Class javaType = (Class) properties.get(fieldName);
+                if (javaType == null) {
+                    throw new DeploymentException("field name " + fieldName + " not found in " + properties);
+                }
+                attributeDesc.setJavaType(javaType);
+                QName xmlName = new QName("", variableMapping.getXmlAttributeName().getStringValue().trim());
+                attributeDesc.setXmlName(xmlName);
+                // TODO retrieve the type of the attribute.
+                QName xmlType = schemaType.getName();
+                attributeDesc.setXmlType(xmlType);
+                fields[i] = attributeDesc;
+            } else {
+                ElementDesc elementDesc = new ElementDesc();
+                elementDesc.setFieldName(fieldName);
+                Class javaType = (Class) properties.get(fieldName);
+                if (javaType == null) {
+                    //see if it is a public field
+                    try {
+                        Field field = javaClass.getField(fieldName);
+                        javaType = field.getType();
+                    } catch (NoSuchFieldException e) {
+                        throw new DeploymentException("field name " + fieldName + " not found in " + properties);
+                    }
+                }
+                elementDesc.setJavaType(javaType);
+                
+                QName xmlName = new QName(ns, variableMapping.getXmlElementName().getStringValue().trim());
+                SchemaParticle particle = (SchemaParticle) nameToType.get(xmlName);
+                if (null == particle) {
+                    throw new DeploymentException("element " + xmlName + " not found in schema " + schemaType.getName());
+                } else if (SchemaParticle.ELEMENT != particle.getParticleType()) {
+                    throw new DeploymentException(xmlName + " is not an element in schema " + schemaType.getName());
+                }
+                elementDesc.setNillable(particle.isNillable());
+                elementDesc.setXmlName(xmlName);
+                elementDesc.setXmlType(particle.getType().getName());
+                
+                if (javaType.isArray()) {
+                    elementDesc.setMinOccurs(particle.getIntMinOccurs());
+                    elementDesc.setMaxOccurs(particle.getIntMaxOccurs());
+                }
+
+                fields[i] = elementDesc;
+            }
+        }
+    }
+}

Added: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/LightweightTypeInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/LightweightTypeInfoBuilder.java?rev=164051&view=auto
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/LightweightTypeInfoBuilder.java (added)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/LightweightTypeInfoBuilder.java Thu Apr 21 05:54:02 2005
@@ -0,0 +1,171 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.axis.builder;
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.description.ElementDesc;
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
+import org.apache.axis.encoding.ser.BeanDeserializerFactory;
+import org.apache.axis.encoding.ser.BeanSerializerFactory;
+import org.apache.geronimo.axis.client.TypeInfo;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.kernel.ClassLoading;
+import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaType;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class LightweightTypeInfoBuilder implements TypeInfoBuilder {
+    private final ClassLoader cl;
+    private final Map schemaTypeKeyToSchemaTypeMap;
+    private final Set wrapperElementQNames;
+    
+    public LightweightTypeInfoBuilder(ClassLoader cl, Map schemaTypeKeyToSchemaTypeMap, Set wrapperElementQNames) {
+        this.cl = cl;
+        this.schemaTypeKeyToSchemaTypeMap = schemaTypeKeyToSchemaTypeMap;
+        this.wrapperElementQNames = wrapperElementQNames;
+    }
+    
+    public List buildTypeInfo(JavaWsdlMappingType mapping) throws DeploymentException {
+        List typeInfoList = new ArrayList();
+        
+        for (Iterator iterator = schemaTypeKeyToSchemaTypeMap.keySet().iterator(); iterator.hasNext();) {
+            SchemaTypeKey key = (SchemaTypeKey) iterator.next();
+            if (!key.isElement() && !key.isAnonymous()) {
+                //default settings
+                QName typeQName = key.getqName();
+                String namespace = typeQName.getNamespaceURI();
+                String packageName = WSDescriptorParser.getPackageFromNamespace(namespace, mapping);
+                String classShortName = typeQName.getLocalPart();
+                String className = packageName + "." + classShortName;
+
+                Class clazz = null;
+                try {
+                    clazz = ClassLoading.loadClass(className, cl);
+                } catch (ClassNotFoundException e) {
+                    throw new DeploymentException("Could not load java type", e);
+                }
+
+                Class serializerFactoryClass = BeanSerializerFactory.class;
+                Class deserializerFactoryClass = BeanDeserializerFactory.class;
+
+                if (clazz.isArray()) {
+                    serializerFactoryClass = ArraySerializerFactory.class;
+                    deserializerFactoryClass = ArrayDeserializerFactory.class;
+                }
+
+                TypeInfo.UpdatableTypeInfo internalTypeInfo = new TypeInfo.UpdatableTypeInfo(); 
+                internalTypeInfo.setClazz(clazz);
+                internalTypeInfo.setQName(typeQName);
+                internalTypeInfo.setSerializerClass(serializerFactoryClass);
+                internalTypeInfo.setDeserializerClass(deserializerFactoryClass);
+                
+                populateInternalTypeInfo(clazz, typeQName, key, internalTypeInfo);
+
+                typeInfoList.add(internalTypeInfo.buildTypeInfo());
+            }
+        }
+        
+        return typeInfoList;
+    }
+    
+    private void populateInternalTypeInfo(Class javaClass, QName typeQName, SchemaTypeKey key, TypeInfo.UpdatableTypeInfo typeInfo) throws DeploymentException {
+        SchemaType schemaType = (SchemaType) schemaTypeKeyToSchemaTypeMap.get(key);
+        if (schemaType == null) {
+            throw new DeploymentException("Schema type key " + key + " not found in analyzed schema: " + schemaTypeKeyToSchemaTypeMap);
+        }
+        String ns = key.getqName().getNamespaceURI();
+
+        typeInfo.setCanSearchParents(schemaType.getDerivationType() == SchemaType.DT_RESTRICTION);
+
+        Map nameToType = new HashMap();
+        if (null  == schemaType.getContentModel()) {
+            ;
+        } else if (SchemaParticle.SEQUENCE == schemaType.getContentModel().getParticleType()) {
+            SchemaParticle[] properties = schemaType.getContentModel().getParticleChildren();
+            for (int i = 0; i < properties.length; i++) {
+                SchemaParticle parameter = properties[i];
+                if (SchemaParticle.ELEMENT != parameter.getType().getContentModel().getParticleType()) {
+                    throw new DeploymentException(parameter.getName() + " is not an element in schema " + schemaType.getName());
+                }
+                // TODO why the ns of parameter.getName() is wrong?
+                nameToType.put(new QName(ns, parameter.getName().getLocalPart()) , parameter);
+            }
+        } else if (SchemaParticle.ELEMENT == schemaType.getContentModel().getParticleType()) {
+            SchemaParticle parameter = schemaType.getContentModel();
+            // TODO why the ns of parameter.getName() is wrong?
+            nameToType.put(new QName(ns, parameter.getName().getLocalPart()) , parameter);
+        } else {
+            throw new DeploymentException("Only all, choice and sequence particle types are supported." +
+                    " SchemaType name =" + schemaType.getName());
+        }
+        
+        PropertyDescriptor[] descriptors;
+        try {
+            descriptors = Introspector.getBeanInfo(javaClass).getPropertyDescriptors();
+        } catch (IntrospectionException e) {
+            throw new DeploymentException("Class " + javaClass + " is not a valid javabean", e);
+        }
+        Map nameToClass = new HashMap();
+        for (int i = 0; i < descriptors.length; i++) {
+            nameToClass.put(descriptors[i].getName(), descriptors[i].getPropertyType());
+        }
+
+        int idx = 0;
+        FieldDesc[] fields = new FieldDesc[nameToType.size()];
+        typeInfo.setFields(fields);
+        for (Iterator iter = nameToType.entrySet().iterator(); iter.hasNext();) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            QName fieldName = (QName) entry.getKey();
+            SchemaParticle particle = (SchemaParticle) entry.getValue();
+            
+            ElementDesc elementDesc = new ElementDesc();
+            elementDesc.setFieldName(fieldName.getLocalPart());
+            
+            Class javaType = (Class) nameToClass.get(fieldName);
+            if (null == javaType) {
+                throw new DeploymentException("Field " + fieldName + " is not defined by class " + javaClass.getName());
+            }
+            elementDesc.setJavaType(javaType);
+            elementDesc.setNillable(particle.isNillable());
+            elementDesc.setXmlName(fieldName);
+            elementDesc.setXmlType(particle.getType().getName());
+            
+            if (javaType.isArray()) {
+                elementDesc.setMinOccurs(particle.getIntMinOccurs());
+                elementDesc.setMaxOccurs(particle.getIntMaxOccurs());
+            }
+
+            fields[idx++] = elementDesc;
+        }
+    }
+}

Added: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeInfoBuilder.java?rev=164051&view=auto
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeInfoBuilder.java (added)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeInfoBuilder.java Thu Apr 21 05:54:02 2005
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.axis.builder;
+
+import java.util.List;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
+
+public interface TypeInfoBuilder {
+    public List buildTypeInfo(JavaWsdlMappingType mapping)throws DeploymentException;
+}

Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original)
+++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Thu Apr 21 05:54:02 2005
@@ -23,6 +23,7 @@
 import java.net.URLClassLoader;
 import java.rmi.Remote;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -131,7 +132,6 @@
         AxisBuilder builder = new AxisBuilder();
 
         ServiceImpl serviceInstance = new ServiceImpl(null, null);
-        List typeMappings = new ArrayList();
 
         URL location = new URL("http://geronimo.apache.org/ws");
 
@@ -139,8 +139,7 @@
         OperationInfo[] operationInfos = new OperationInfo[]{op};
         Class serviceEndpointClass = builder.enhanceServiceEndpointInterface(MockPort.class, context, module, isolatedCl);
         String portName = "foo";
-        Map typeDescriptors = new HashMap();
-        SEIFactory serviceInterfaceFactory = builder.createSEIFactory(null, portName, serviceEndpointClass, serviceInstance, typeMappings, typeDescriptors, location, operationInfos, handlerInfos, null, context, isolatedCl);
+        SEIFactory serviceInterfaceFactory = builder.createSEIFactory(null, portName, serviceEndpointClass, serviceInstance, Collections.EMPTY_LIST, location, operationInfos, handlerInfos, null, context, isolatedCl);
         assertNotNull(serviceInterfaceFactory);
         Remote serviceInterface = serviceInterfaceFactory.createServiceEndpoint();
         assertTrue(serviceInterface instanceof MockPort);

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java Thu Apr 21 05:54:02 2005
@@ -32,11 +32,11 @@
  */
 public class GenericServiceEndpoint extends org.apache.axis.client.Stub {
 
-    private final List typeMappings;
+    private final List typeInfo;
 
-    public GenericServiceEndpoint(QName portQName, Service service, List typeMappings, URL location) {
+    public GenericServiceEndpoint(QName portQName, Service service, List typeInfo, URL location) {
         this.service = service;
-        this.typeMappings = typeMappings;
+        this.typeInfo = typeInfo;
         cachedEndpoint = location;
         cachedPortName = portQName;
     }
@@ -80,9 +80,9 @@
                     //TODO these constants probably need to be parameters of GSE.
                     _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
                     _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
-                    for (Iterator iterator = typeMappings.iterator(); iterator.hasNext();) {
-                        TypeMappingInfo info = (TypeMappingInfo) iterator.next();
-                        _call.registerTypeMapping(info.getClazz(), info.getqName(), info.getSerializerClass(), info.getDeserializerClass(), false);
+                    for (Iterator iterator = typeInfo.iterator(); iterator.hasNext();) {
+                        TypeInfo info = (TypeInfo) iterator.next();
+                        _call.registerTypeMapping(info.getClazz(), info.getqName(), info.getSerFactoryClass(), info.getDeserFactoryClass(), false);
                     }
                 }
             }

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java Thu Apr 21 05:54:02 2005
@@ -25,7 +25,6 @@
 import java.rmi.Remote;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ServiceException;
@@ -54,15 +53,14 @@
     private final OperationInfo[] operationInfos;
     private transient final FastConstructor constructor;
     private final Object serviceImpl;
-    private final List typeMappings;
-    private final Map typeDescriptors;
+    private final List typeInfo;
     private final URL location;
     private final List handlerInfos;
     private final String credentialsName;
     private transient HandlerInfoChainFactory handlerInfoChainFactory;
     private transient OperationInfo[] sortedOperationInfos;
 
-    public SEIFactoryImpl(QName serviceName, String portName, Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeMappings, Map typeDescriptors, URL location, List handlerInfos, ClassLoader classLoader, String credentialsName) throws ClassNotFoundException {
+    public SEIFactoryImpl(QName serviceName, String portName, Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeInfo, URL location, List handlerInfos, ClassLoader classLoader, String credentialsName) throws ClassNotFoundException {
         this.serviceName = serviceName;
         this.portQName = new QName("", portName);
         this.serviceEndpointClass = serviceEndpointClass;
@@ -71,8 +69,7 @@
             constructorTypes = classLoader == null? SERVICE_ENDPOINT_CONSTRUCTOR_TYPES: new Class[] {classLoader.loadClass(GenericServiceEndpoint.class.getName())};
         this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes);
         this.serviceImpl = serviceImpl;
-        this.typeMappings = typeMappings;
-        this.typeDescriptors = typeDescriptors;
+        this.typeInfo = typeInfo;
         this.location = location;
         this.handlerInfos = handlerInfos;
         this.credentialsName = credentialsName;
@@ -89,17 +86,15 @@
             sortedOperationInfos[index] = operationInfo;
         }
         //register our type descriptors
-        for (Iterator iterator = typeDescriptors.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            Class javaClass = (Class) entry.getKey();
-            TypeDesc typeDesc = (TypeDesc) entry.getValue();
-            TypeDesc.registerTypeDescForClass(javaClass, typeDesc);
+        for (Iterator iterator = typeInfo.iterator(); iterator.hasNext();) {
+            TypeInfo info = (TypeInfo) iterator.next();
+            TypeDesc.registerTypeDescForClass(info.getClass(), info.buildTypeDesc());
         }
     }
 
     public Remote createServiceEndpoint() throws ServiceException {
         Service service = ((ServiceImpl)serviceImpl).getService();
-        GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, typeMappings, location);
+        GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, typeInfo, location);
         Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos, credentialsName);
         Callback[] callbacks = new Callback[]{SerializableNoOp.INSTANCE, callback};
         Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
@@ -118,7 +113,7 @@
 
     private Object readResolve() throws ObjectStreamException {
         try {
-            return new SEIFactoryImpl(serviceName, portQName.getLocalPart(), serviceEndpointClass, operationInfos, serviceImpl, typeMappings, typeDescriptors, location, handlerInfos, null, credentialsName);
+            return new SEIFactoryImpl(serviceName, portQName.getLocalPart(), serviceEndpointClass, operationInfos, serviceImpl, typeInfo, location, handlerInfos, null, credentialsName);
         } catch (ClassNotFoundException e) {
             throw new InvalidClassException(GenericServiceEndpoint.class.getName(), "this is impossible");
         }

Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeInfo.java?rev=164051&view=auto
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeInfo.java (added)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/TypeInfo.java Thu Apr 21 05:54:02 2005
@@ -0,0 +1,145 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.axis.client;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.DeserializerFactory;
+import javax.xml.rpc.encoding.SerializerFactory;
+import javax.xml.rpc.encoding.TypeMapping;
+
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.description.TypeDesc;
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class TypeInfo implements Serializable {
+    private final Class clazz;
+    private final QName qName;
+    private final Class serFactoryClass;
+    private final Class deserFactoryClass;
+    private final boolean canSearchParents;
+    private final FieldDesc[] fields;
+
+    public static void register(List typeInfo, TypeMapping typeMapping) {
+        for (Iterator iter = typeInfo.iterator(); iter.hasNext();) {
+            TypeInfo info = (TypeInfo) iter.next();
+            info.register(typeMapping);
+        }
+    }
+
+    public TypeInfo(Class clazz, QName qName, Class serializerClass, Class deserializerClass, boolean canSearchParents, FieldDesc[] fields) {
+        this.clazz = clazz;
+        this.qName = qName;
+        this.serFactoryClass = serializerClass;
+        this.deserFactoryClass = deserializerClass;
+        this.canSearchParents =canSearchParents;
+        this.fields = fields;
+    }
+
+    public Class getClazz() {
+        return clazz;
+    }
+
+    public QName getqName() {
+        return qName;
+    }
+
+    public Class getSerFactoryClass() {
+        return serFactoryClass;
+    }
+
+    public Class getDeserFactoryClass() {
+        return deserFactoryClass;
+    }
+    
+    public boolean isCanSearchParents() {
+        return canSearchParents;
+    }
+
+    public FieldDesc[] getFields() {
+        return fields;
+    }
+    
+    public TypeDesc buildTypeDesc() {
+        TypeDesc typeDesc = new TypeDesc(clazz, canSearchParents);
+        typeDesc.setXmlType(qName);
+        typeDesc.setFields(fields);
+        return typeDesc;
+    }
+
+    public void register(TypeMapping typeMapping) {
+        SerializerFactory ser = BaseSerializerFactory.createFactory(serFactoryClass, clazz, qName);
+        DeserializerFactory deser = BaseDeserializerFactory.createFactory(deserFactoryClass, clazz, qName);
+
+        typeMapping.register(clazz, qName, ser, deser);
+    }
+    
+    public static class UpdatableTypeInfo {
+        private Class clazz;
+        private QName qName;
+        private Class serializerClass;
+        private Class deserializerClass;
+        private boolean canSearchParents;
+        private FieldDesc[] fields;
+        
+        public TypeInfo buildTypeInfo() {
+            if (null == clazz) {
+                throw new IllegalStateException("clazz is null");
+            } else if (null == qName) {
+                throw new IllegalStateException("qName is null");
+            } else if (null == serializerClass) {
+                throw new IllegalStateException("serializerClass is null");
+            } else if (null == deserializerClass) {
+                throw new IllegalStateException("deserializerClass is null");
+            } else if (null == fields) {
+                throw new IllegalStateException("fields is null");
+            }
+            return new TypeInfo(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields);
+        }
+
+        public void setClazz(Class clazz) {
+            this.clazz = clazz;
+        }
+
+        public void setDeserializerClass(Class deserializerClass) {
+            this.deserializerClass = deserializerClass;
+        }
+
+        public void setFields(FieldDesc[] fields) {
+            this.fields = fields;
+        }
+
+        public void setQName(QName name) {
+            qName = name;
+        }
+
+        public void setSerializerClass(Class serializerClass) {
+            this.serializerClass = serializerClass;
+        }
+
+        public void setCanSearchParents(boolean canSearchParents) {
+            this.canSearchParents = canSearchParents;
+        }
+    }
+}

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ReadOnlyServiceDesc.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ReadOnlyServiceDesc.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ReadOnlyServiceDesc.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/ReadOnlyServiceDesc.java Thu Apr 21 05:54:02 2005
@@ -23,7 +23,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -34,13 +33,14 @@
 import org.apache.axis.description.TypeDesc;
 import org.apache.axis.encoding.TypeMapping;
 import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.geronimo.axis.client.TypeInfo;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ReadOnlyServiceDesc extends JavaServiceDesc implements Externalizable {
     private JavaServiceDesc serviceDesc;
-    private Map classToTypeDescInfo;
+    private List typeInfo;
 
     /**
      * Only required as Externalizable.
@@ -48,9 +48,9 @@
     public ReadOnlyServiceDesc() {
     }
 
-    public ReadOnlyServiceDesc(JavaServiceDesc serviceDesc, Map classToTypeDescInfo) {
+    public ReadOnlyServiceDesc(JavaServiceDesc serviceDesc, List typeInfo) {
         this.serviceDesc = serviceDesc;
-        this.classToTypeDescInfo = classToTypeDescInfo;
+        this.typeInfo = typeInfo;
     }
 
     public Class getImplClass() {
@@ -203,23 +203,21 @@
     }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        classToTypeDescInfo = (Map) in.readObject();
+        typeInfo = (List) in.readObject();
         
         // one must register the TypeDesc before to deserialize the JavaServiceDesc
         // as it contains a bunch of BeanXXXFactory instances which need 
         // them registered to properly recreate the state of the factories.
-        for (Iterator iter = classToTypeDescInfo.entrySet().iterator(); iter.hasNext();) {
-            Map.Entry entry = (Map.Entry) iter.next();
-            Class clazz = (Class) entry.getKey();
-            TypeDescInfo typeDescInfo = (TypeDescInfo) entry.getValue();
-            TypeDesc.registerTypeDescForClass(clazz, typeDescInfo.buildTypeDesc());
+        for (Iterator iter = typeInfo.iterator(); iter.hasNext();) {
+            TypeInfo info = (TypeInfo) iter.next();
+            TypeDesc.registerTypeDescForClass(info.getClazz(), info.buildTypeDesc());
         }
         
         serviceDesc = (JavaServiceDesc) in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(classToTypeDescInfo);
+        out.writeObject(typeInfo);
         out.writeObject(serviceDesc);
     }
 }

Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java?rev=164051&r1=164050&r2=164051&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java (original)
+++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java Thu Apr 21 05:54:02 2005
@@ -17,6 +17,7 @@
 
 import java.io.InputStream;
 import java.net.URI;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.namespace.QName;
@@ -81,7 +82,7 @@
         serviceDesc.addOperationDesc(op);
 
         serviceDesc.getOperations();
-        ReadOnlyServiceDesc sd = new ReadOnlyServiceDesc(serviceDesc, new HashMap());
+        ReadOnlyServiceDesc sd = new ReadOnlyServiceDesc(serviceDesc, Collections.EMPTY_LIST);
 
         Class pojoClass = cl.loadClass("org.apache.geronimo.axis.testData.echosample.EchoBean");
 



Mime
View raw message