Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » server » axis » client » [javadoc | source]
    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   package org.apache.openejb.server.axis.client;
   18   
   19   import org.apache.axis.description.FieldDesc;
   20   import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
   21   import org.apache.axis.encoding.ser.ArraySerializerFactory;
   22   
   23   import javax.xml.namespace.QName;
   24   import javax.xml.rpc.encoding.TypeMapping;
   25   
   26   public class ArrayTypeInfo extends TypeInfo {
   27   
   28       private final QName componentType;
   29       private final QName componentQName;
   30   
   31       public ArrayTypeInfo(Class clazz,
   32               QName qName,
   33               Class serializerClass,
   34               Class deserializerClass,
   35               boolean canSearchParents,
   36               FieldDesc[] fields,
   37               QName componentType,
   38               QName componentQName) {
   39           super(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields);
   40           this.componentType = componentType;
   41           this.componentQName = componentQName;
   42       }
   43   
   44       public void register(TypeMapping typeMapping) {
   45   //        SerializerFactory ser = BaseSerializerFactory.createFactory(getSerFactoryClass(), getClazz(), getqName());
   46   //        ((ArraySerializerFactory)ser).setComponentType(componentType);
   47   //        ((ArraySerializerFactory)ser).setComponentQName(componentQName);
   48   //        DeserializerFactory deser = BaseDeserializerFactory.createFactory(getDeserFactoryClass(), getClazz(), getqName());
   49   //        ((ArrayDeserializerFactory)deser).setComponentType(componentType);
   50   
   51           ArraySerializerFactory ser = new ArraySerializerFactory(componentType, componentQName);
   52           ArrayDeserializerFactory deser = new ArrayDeserializerFactory();
   53   
   54           typeMapping.register(getClazz(), getqName(), ser, deser);
   55       }
   56   
   57       public static class UpdatableArrayTypeInfo extends TypeInfo.UpdatableTypeInfo {
   58           private QName componentType;
   59           private QName componentQName;
   60   
   61           public TypeInfo buildTypeInfo() {
   62               if (null == clazz) {
   63                   throw new IllegalStateException("clazz is null");
   64               } else if (null == qName) {
   65                   throw new IllegalStateException("qName is null");
   66               } else if (null == serializerClass) {
   67                   throw new IllegalStateException("serializerClass is null");
   68               } else if (null == deserializerClass) {
   69                   throw new IllegalStateException("deserializerClass is null");
   70               } else if (null == fields) {
   71                   throw new IllegalStateException("fields is null");
   72               }
   73               return new ArrayTypeInfo(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields, componentType, componentQName);
   74           }
   75   
   76   
   77           public QName getComponentType() {
   78               return componentType;
   79           }
   80   
   81           public QName getComponentQName() {
   82               return componentQName;
   83           }
   84   
   85           public void setComponentType(QName componentType) {
   86               this.componentType = componentType;
   87           }
   88   
   89           public void setComponentQName(QName componentQName) {
   90               this.componentQName = componentQName;
   91           }
   92       }
   93   }

Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » server » axis » client » [javadoc | source]