View Javadoc

1   /**
2    * 
3    */
4   package net.sf.crispy.impl.jaxrpc;
5   
6   import java.util.Vector;
7   
8   import javax.xml.namespace.QName;
9   import javax.xml.rpc.encoding.DeserializerFactory;
10  import javax.xml.rpc.encoding.SerializerFactory;
11  
12  import net.sf.crispy.impl.ServiceManager;
13  import net.sf.crispy.util.Util;
14  
15  import org.apache.axis.Constants;
16  import org.apache.axis.encoding.ser.VectorDeserializerFactory;
17  import org.apache.axis.encoding.ser.VectorSerializerFactory;
18  
19  /**
20   * Factory to create a TypeMapping for transfer for <code>java.util.Vector</code>-object.
21   * 
22   * @author Linke
23   *
24   */
25  public class VectorTypeMappingFactory implements TypeMappingFactory {
26  	
27  	private Class javaType = Vector.class;
28  	private QName qName = Constants.SOAP_VECTOR;
29  
30  	public void setParameter (String pvParams[]) {
31  		if (pvParams != null && pvParams.length == 2) {
32  			try {
33  				Class lvJavaType = Class.forName(pvParams[1]);
34  				qName = Util.createQNameByClass(lvJavaType);
35  			} catch (Exception e) {
36  				if (ServiceManager.DEBUG_MODE_ON) {
37  					e.printStackTrace();
38  				}
39  			}
40  		}
41  	}
42  	
43  	/**
44  	 * @see net.sf.crispy.impl.jaxrpc.TypeMappingFactory#getJavaType()
45  	 */
46  	public Class getJavaType() { return javaType; }
47  
48  	/**
49  	 * @see net.sf.crispy.impl.jaxrpc.TypeMappingFactory#getXmlType()
50  	 */
51  	public QName getXmlType() { return qName; }
52  
53  	/**
54  	 * @see net.sf.crispy.impl.jaxrpc.TypeMappingFactory#getSerializerFactory()
55  	 */
56  	public SerializerFactory getSerializerFactory() { return new VectorSerializerFactory(javaType, qName); }
57  
58  	/**
59  	 * @see net.sf.crispy.impl.jaxrpc.TypeMappingFactory#getDeserializerFactory()
60  	 */
61  	public DeserializerFactory getDeserializerFactory() { return new VectorDeserializerFactory(javaType, qName); }
62  
63  }