|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| package net.sf.crispy.impl.jaxrpc; |
|
5 |
| |
|
6 |
| import javax.xml.namespace.QName; |
|
7 |
| import javax.xml.rpc.encoding.DeserializerFactory; |
|
8 |
| import javax.xml.rpc.encoding.SerializerFactory; |
|
9 |
| |
|
10 |
| import net.sf.crispy.InvocationException; |
|
11 |
| import net.sf.crispy.util.Util; |
|
12 |
| |
|
13 |
| import org.apache.axis.encoding.ser.ArrayDeserializerFactory; |
|
14 |
| import org.apache.axis.encoding.ser.ArraySerializerFactory; |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| public class ArrayTypeMappingFactory implements TypeMappingFactory { |
|
23 |
| |
|
24 |
| private Class clazz = null; |
|
25 |
| private QName qName = null; |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
10
| public Class getJavaType() { return clazz; }
|
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
13
| public QName getXmlType() { return qName; }
|
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
3
| public SerializerFactory getSerializerFactory() { return new ArraySerializerFactory(getJavaType(), getXmlType()); }
|
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
3
| public DeserializerFactory getDeserializerFactory() { return new ArrayDeserializerFactory(getXmlType()); }
|
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
6
| public void setParameter(String[] pvParams) {
|
|
51 |
| |
|
52 |
6
| if (pvParams == null) {
|
|
53 |
1
| throw new IllegalArgumentException ("The class name is null (in ArrayTypeMappingFactory)!");
|
|
54 |
| } |
|
55 |
| |
|
56 |
5
| String lvClassName = pvParams[1];
|
|
57 |
| |
|
58 |
5
| try {
|
|
59 |
5
| clazz = Class.forName(lvClassName);
|
|
60 |
4
| qName = Util.createQNameByClass(clazz);
|
|
61 |
| } catch (Exception e) { |
|
62 |
1
| throw new InvocationException("Can't create class (in ArrayTypeMappingFactory) from string: " + lvClassName, e);
|
|
63 |
| } |
|
64 |
| |
|
65 |
| } |
|
66 |
| |
|
67 |
1
| public String toString() {
|
|
68 |
1
| return getJavaType() + " " + getXmlType();
|
|
69 |
| } |
|
70 |
| } |