001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.axis.client; 018 019 import javax.xml.namespace.QName; 020 import javax.xml.rpc.encoding.TypeMapping; 021 import javax.xml.rpc.encoding.SerializerFactory; 022 import javax.xml.rpc.encoding.DeserializerFactory; 023 024 import org.apache.axis.description.FieldDesc; 025 import org.apache.axis.encoding.ser.BaseSerializerFactory; 026 import org.apache.axis.encoding.ser.BaseDeserializerFactory; 027 import org.apache.axis.encoding.ser.ArraySerializerFactory; 028 import org.apache.axis.encoding.ser.ArrayDeserializerFactory; 029 030 /** 031 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ 032 */ 033 public class ArrayTypeInfo extends TypeInfo { 034 035 private final QName componentType; 036 private final QName componentQName; 037 038 public ArrayTypeInfo(Class clazz, 039 QName qName, 040 Class serializerClass, 041 Class deserializerClass, 042 boolean canSearchParents, 043 FieldDesc[] fields, 044 QName componentType, 045 QName componentQName) { 046 super(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields); 047 this.componentType = componentType; 048 this.componentQName = componentQName; 049 } 050 051 public void register(TypeMapping typeMapping) { 052 // SerializerFactory ser = BaseSerializerFactory.createFactory(getSerFactoryClass(), getClazz(), getqName()); 053 // ((ArraySerializerFactory)ser).setComponentType(componentType); 054 // ((ArraySerializerFactory)ser).setComponentQName(componentQName); 055 // DeserializerFactory deser = BaseDeserializerFactory.createFactory(getDeserFactoryClass(), getClazz(), getqName()); 056 // ((ArrayDeserializerFactory)deser).setComponentType(componentType); 057 058 ArraySerializerFactory ser = new ArraySerializerFactory(componentType, componentQName); 059 ArrayDeserializerFactory deser = new ArrayDeserializerFactory(); 060 061 typeMapping.register(getClazz(), getqName(), ser, deser); 062 } 063 064 public static class UpdatableArrayTypeInfo extends TypeInfo.UpdatableTypeInfo { 065 private QName componentType; 066 private QName componentQName; 067 068 public TypeInfo buildTypeInfo() { 069 if (null == clazz) { 070 throw new IllegalStateException("clazz is null"); 071 } else if (null == qName) { 072 throw new IllegalStateException("qName is null"); 073 } else if (null == serializerClass) { 074 throw new IllegalStateException("serializerClass is null"); 075 } else if (null == deserializerClass) { 076 throw new IllegalStateException("deserializerClass is null"); 077 } else if (null == fields) { 078 throw new IllegalStateException("fields is null"); 079 } 080 return new ArrayTypeInfo(clazz, qName, serializerClass, deserializerClass, canSearchParents, fields, componentType, componentQName); 081 } 082 083 084 public QName getComponentType() { 085 return componentType; 086 } 087 088 public QName getComponentQName() { 089 return componentQName; 090 } 091 092 public void setComponentType(QName componentType) { 093 this.componentType = componentType; 094 } 095 096 public void setComponentQName(QName componentQName) { 097 this.componentQName = componentQName; 098 } 099 100 } 101 102 103 }