Author: mmerz
Date: Mon Jan 10 13:30:43 2005
New Revision: 124831

URL: http://svn.apache.org/viewcvs?view=rev&rev=124831
Log:
Removed the CollectionSerializer and all references to it.  This class was left
over from the early days working on WSM and was not very useful as arrays are a 
better bet when using web services.

Contributor: Jonathan Colwell


Removed:
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializer.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializerFactory.java
Modified:
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java?view=diff&rev=124831&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java&r1=124830&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java&r2=124831
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   Mon Jan 10 13:30:43 2005
@@ -50,7 +50,6 @@
 import org.apache.axis.utils.BeanPropertyDescriptor;
 import org.apache.axis.wsdl.fromJava.Namespaces;
 import org.apache.axis.wsdl.fromJava.Types;
-import org.apache.beehive.wsm.axis.util.encoding.CollectionSerializerFactory;
 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanDeserializerFactory;
 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
 import org.apache.beehive.wsm.jsr181.model.Jsr181MethodMetadata;
@@ -235,198 +234,179 @@
         {
             TypeMapping tm = desc.getTypeMapping();
             QName q = tm.getTypeQName(type);
-            if (Collection.class.isAssignableFrom(type))
+
+            if (null == q)
             {
-                /*
-                 * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
-                 * overriding the default Axis conversion of all Collections
-                 * to {http://schemas.xmlsoap.org/soap/encoding/}Array
-                 * since the namespace prefix is left hanging with literal use
-                 */
-                q = generateQName(type, desc);
-                tm.register(
-                    type,
-                    q,
-                    new CollectionSerializerFactory(type, q),
-                    new VectorDeserializerFactory(type, q));
+                // q = generateQName(type, desc);
+                q = new QName(defaultNameSpace,
+                              Types.getLocalNameFromFullName(type.getName()));
             }
-            else
+            if (type.isArray())
             {
-                if (null == q)
+                if (! tm.isRegistered(type, q))
                 {
-                   // q = generateQName(type, desc);
-                    q = new QName(defaultNameSpace,
-                            Types.getLocalNameFromFullName(type.getName()));
+                    tm.register(type,
+                                q,
+                                new ArraySerializerFactory(type, q),
+                                new ArrayDeserializerFactory());
                 }
-                if (type.isArray())
+                configureTypeMapping(desc, type.getComponentType(), 
defaultNameSpace);
+            }
+            else if (! tm.isRegistered(type, q))
+            {
+                if (XmlObject.class.isAssignableFrom(type))
                 {
-                    if (! tm.isRegistered(type, q))
-                    {
-                        tm.register(
-                            type,
-                            q,
-                            new ArraySerializerFactory(type, q),
-                            new ArrayDeserializerFactory()
-                        );
-                    }
-                    configureTypeMapping(desc, type.getComponentType(), 
defaultNameSpace);
+                    q = XmlBeans.typeForClass(type).getName();
+                    tm.register(type,
+                                q,
+                                new XmlBeanSerializerFactory(type, q),
+                                new XmlBeanDeserializerFactory(type, q));
                 }
-                else if (! tm.isRegistered(type, q))
+                /*
+                 * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- these datahandler
+                 * using classes are generally already registered but 
+                 * just in case...
+                 */
+                else if (isActivationEnabled() &&
+                         (java.awt.Image.class.isAssignableFrom(type)
+                          || getMultipartClass().isAssignableFrom(type)
+                          || getDataHandlerClass().isAssignableFrom(type)))
                 {
-                    if (XmlObject.class.isAssignableFrom(type))
-                    {
-                        q = XmlBeans.typeForClass(type).getName();
-                        tm.register(
-                            type,
-                            q,
-                            new XmlBeanSerializerFactory(type, q),
-                            new XmlBeanDeserializerFactory(type, q));
+                    try {
+                        /*
+                         * NOTE [EMAIL PROTECTED] 2004-Oct-08 -- doing 
+                         * reflection here in case AXIS was built without 
+                         * attachment support.
+                         */
+                        ClassLoader cl = AxisHook.class.getClassLoader();
+                        Class<SerializerFactory> sfClass =
+                            (Class<SerializerFactory>)
+                            
cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory");
+                        Class<DeserializerFactory> dsfClass =
+                            (Class<DeserializerFactory>)
+                            
cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory");
+                        Constructor<SerializerFactory> sfCon =
+                            sfClass.getConstructor(Class.class,
+                                                   QName.class);
+                        Constructor<DeserializerFactory> dsfCon =
+                            dsfClass.getConstructor(Class.class,
+                                                    QName.class);
+                        SerializerFactory sf = sfCon.newInstance(type, q);
+                        DeserializerFactory dsf = dsfCon.newInstance(type, q);
+                        tm.register(type, q, sf, dsf);
                     }
-                    /*
-                     * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- these datahandler
-                     * using classes are generally already registered but 
-                     * just in case...
-                     */
-                    else if (isActivationEnabled() &&
-                            (java.awt.Image.class.isAssignableFrom(type)
-                            || getMultipartClass().isAssignableFrom(type)
-                            || getDataHandlerClass().isAssignableFrom(type)))
+                    catch (Exception e)
                     {
-                        try {
-                            /*
-                             * NOTE [EMAIL PROTECTED] 2004-Oct-08 -- doing 
-                             * reflection here in case AXIS was built without 
-                             * attachment support.
-                             */
-                            ClassLoader cl = AxisHook.class.getClassLoader();
-                            Class<SerializerFactory> sfClass =
-                                    (Class<SerializerFactory>)
-                                    
cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory");
-                            Class<DeserializerFactory> dsfClass =
-                                    (Class<DeserializerFactory>)
-                                    
cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory");
-                            Constructor<SerializerFactory> sfCon =
-                                    sfClass.getConstructor(Class.class,
-                                            QName.class);
-                            Constructor<DeserializerFactory> dsfCon =
-                                    dsfClass.getConstructor(Class.class,
-                                            QName.class);
-                            SerializerFactory sf = sfCon.newInstance(type, q);
-                            DeserializerFactory dsf = dsfCon.newInstance(type, 
q);
-                            tm.register(type, q, sf, dsf);
-                        }
-                        catch (Exception e)
-                        {
                             /*
                              * FIXME [EMAIL PROTECTED] 2004-Oct-08 -- 
                              * log this properly
                              */
                             e.printStackTrace();
-                        }
-                    } else if (!Remote.class.isAssignableFrom(type) 
-                            /*
-                             * NOTE [EMAIL PROTECTED] 2004-Dec-01 -- 
-                             * java.rmi.Remote is prohibited
-                             * by the jax-rpc spec 
-                             *
-                             * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
-                             * restricting against File, since it doesn't make
-                             * sense to serialize as a bean.  
-                             * It causes an infinite loop as it keeps returning
-                             * itself from the getAbsoluteFile and
-                             * getCanonicalFile calls
-                             */
-                               && !File.class.isAssignableFrom(type)) {
-                        TypeDesc td = TypeDesc.getTypeDescForClass(type);
-                        TypeDesc superTd = null;
-                        BeanPropertyDescriptor[] superPd = null;
-                        if (null == td)
+                    }
+                } else if (!Remote.class.isAssignableFrom(type) 
+                           /*
+                            * NOTE [EMAIL PROTECTED] 2004-Dec-01 -- 
+                            * java.rmi.Remote is prohibited
+                            * by the jax-rpc spec 
+                            *
+                            * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
+                            * restricting against File, since it doesn't make
+                            * sense to serialize as a bean.  
+                            * It causes an infinite loop as it keeps returning
+                            * itself from the getAbsoluteFile and
+                            * getCanonicalFile calls
+                            */
+                           && !File.class.isAssignableFrom(type)) {
+                    TypeDesc td = TypeDesc.getTypeDescForClass(type);
+                    TypeDesc superTd = null;
+                    BeanPropertyDescriptor[] superPd = null;
+                    if (null == td)
+                    {
+                        td = new TypeDesc(type);
+                        Class supa = type.getSuperclass();
+                        if ((supa != null)
+                            && (supa != java.lang.Object.class)
+                            && (supa != java.lang.Exception.class)
+                            && (supa != java.lang.Throwable.class)
+                            && (supa != java.rmi.RemoteException.class)
+                            && (supa != org.apache.axis.AxisFault.class))
                         {
-                            td = new TypeDesc(type);
-                            Class supa = type.getSuperclass();
-                            if ((supa != null)
-                                && (supa != java.lang.Object.class)
-                                && (supa != java.lang.Exception.class)
-                                && (supa != java.lang.Throwable.class)
-                                && (supa != java.rmi.RemoteException.class)
-                                && (supa != org.apache.axis.AxisFault.class))
-                            {
-                                configureTypeMapping(desc, supa, 
defaultNameSpace);
-                            }
-                            superTd = TypeDesc.getTypeDescForClass(supa);
-                            if (superTd != null)
-                            {
-                                superPd = superTd.getPropertyDescriptors();
-                            }
-                            td.setXmlType(q);
-                            TypeDesc.registerTypeDescForClass(type, td);
+                            configureTypeMapping(desc, supa, defaultNameSpace);
                         }
-                        else
+                        superTd = TypeDesc.getTypeDescForClass(supa);
+                        if (superTd != null)
                         {
-                            td = null;
+                            superPd = superTd.getPropertyDescriptors();
                         }
-                        tm.register(
-                            type,
-                            q,
-                            new BeanSerializerFactory(type, q),
-                            /*
-                             * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
-                             * should check that the type to deserialize
-                             * has a default contructor but with this 
-                             * setup there is no way to know if it is
-                             * used only in serialization.
-                             */
-                            new BeanDeserializerFactory(type, q)
-                        );
-                        Map serProps =
-                            BeanDeserializerFactory.getProperties(type, null);
-                        for (BeanPropertyDescriptor beanProps : 
(Collection<BeanPropertyDescriptor>) serProps.values())
+                        td.setXmlType(q);
+                        TypeDesc.registerTypeDescForClass(type, td);
+                    }
+                    else
+                    {
+                        td = null;
+                    }
+                    tm.register(type,
+                                q,
+                                new BeanSerializerFactory(type, q),
+                                /*
+                                 * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
+                                 * should check that the type to deserialize
+                                 * has a default contructor but with this 
+                                 * setup there is no way to know if it is
+                                 * used only in serialization.
+                                 */
+                                new BeanDeserializerFactory(type, q));
+                    Map serProps =
+                        BeanDeserializerFactory.getProperties(type, null);
+                    for (BeanPropertyDescriptor beanProps : 
(Collection<BeanPropertyDescriptor>) serProps.values())
+                    {
+                        Class subType = beanProps.getType();
+                        if (! (subType.isPrimitive()
+                               || subType.getName().startsWith("java.")
+                               || subType.getName().startsWith("javax.")))
                         {
-                            Class subType = beanProps.getType();
-                            if (! (subType.isPrimitive()
-                                    || subType.getName().startsWith("java.")
-                                    || subType.getName().startsWith("javax.")))
-                            {
-                                configureTypeMapping(desc, subType, 
defaultNameSpace);
-                            }
-                            if (td != null) {
-                                String ns = q.getNamespaceURI();
-                                if (superTd != null && superPd != null) {
-                                    for (int j = 0; j < superPd.length; j++) {
-                                        if (beanProps.getName()
-                                                .equals(superPd[j]
+                            configureTypeMapping(desc,
+                                                 subType,
+                                                 defaultNameSpace);
+                        }
+
+                        if (td != null) {
+                            String ns = q.getNamespaceURI();
+                            if (superTd != null && superPd != null) {
+                                for (int j = 0; j < superPd.length; j++) {
+                                    if (beanProps.getName()
+                                        .equals(superPd[j]
                                                 .getName())) {
-                                            ns = superTd.getXmlType()
-                                                    .getNamespaceURI();
-                                            break;
-                                        }
+                                        ns = superTd.getXmlType()
+                                            .getNamespaceURI();
+                                        break;
                                     }
                                 }
-                                FieldDesc fd = new ElementDesc();
-                                fd.setJavaType(subType);
-                                fd.setFieldName(beanProps.getName());
-                                fd.setXmlName(new QName(ns,
-                                        beanProps.getName()));
-                                // NOTE [EMAIL PROTECTED] 2004-Oct-28 -- might 
need
-                                // to do more to ensure a useful type QName.
-                                fd.setXmlType(tm.getTypeQName(subType));
-                                td.addFieldDesc(fd);
                             }
+                            FieldDesc fd = new ElementDesc();
+                            fd.setJavaType(subType);
+                            fd.setFieldName(beanProps.getName());
+                            fd.setXmlName(new QName(ns,
+                                                    beanProps.getName()));
+                            // NOTE [EMAIL PROTECTED] 2004-Oct-28 -- might need
+                            // to do more to ensure a useful type QName.
+                            fd.setXmlType(tm.getTypeQName(subType));
+                            td.addFieldDesc(fd);
                         }
                     }
-                    else
-                    {
-                        throw new InvalidTypeMappingException(
-                            "failed to register " + type.getName()
-                            + " as a valid web service datatype,"
-                            + " consider using a custom type mapping"
-                        );
-                    }
+                }
+                else
+                {
+                    throw new InvalidTypeMappingException
+                        ("failed to register " + type.getName()
+                         + " as a valid web service datatype,"
+                         + " consider using a custom type mapping");
                 }
             }
             return q;
         }
     }
+
 
     private static QName generateQName(Class type, ServiceDesc desc) {
         String namespace = Namespaces.makeNamespace(type.getName());

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java?view=diff&rev=124831&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java&r1=124830&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java&r2=124831
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/AxisTypeMappingUtil.java
   Mon Jan 10 13:30:43 2005
@@ -62,7 +62,6 @@
 import org.apache.axis.wsdl.fromJava.Namespaces;
 import org.apache.axis.wsdl.fromJava.Types;
 
-import org.apache.beehive.wsm.axis.util.encoding.CollectionSerializerFactory;
 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanDeserializerFactory;
 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
 import org.apache.beehive.wsm.jsr181.util.InvalidTypeMappingException;
@@ -100,23 +99,6 @@
         
         if (Void.TYPE.equals(cls)) {
             q = null;
-        }
-        else if (Collection.class.isAssignableFrom(cls)) {
-            /*
-             * NOTE [EMAIL PROTECTED] 2004-Oct-11 -- 
-             * overriding the default Axis conversion of all Collections
-             * to {http://schemas.xmlsoap.org/soap/encoding/}Array
-             * since the namespace prefix is left hanging with literal use
-             */
-            if (expectedType == null) {
-                q = generateQName(cls, "http://no.namespace.specified";);
-            }
-            else {
-                q = expectedType;
-            }
-            mTypeMapping.register(cls, q,
-                        new CollectionSerializerFactory(cls, q),
-                        new VectorDeserializerFactory(cls, q));
         }
         else {
             

Deleted: 
/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializer.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializer.java?view=auto&rev=124830
==============================================================================

Deleted: 
/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializerFactory.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/util/encoding/CollectionSerializerFactory.java?view=auto&rev=124830
==============================================================================

Reply via email to