|
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.BeanDeserializerFactory; |
|
14 |
| import org.apache.axis.encoding.ser.BeanSerializerFactory; |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| public class BeanTypeMappingFactory implements TypeMappingFactory { |
|
24 |
| |
|
25 |
| private Class clazz = null; |
|
26 |
| private QName qName = null; |
|
27 |
| |
|
28 |
33
| public BeanTypeMappingFactory() { }
|
|
29 |
| |
|
30 |
34
| public void setParameter (String pvParams[]) {
|
|
31 |
34
| if (pvParams == null) {
|
|
32 |
1
| throw new IllegalArgumentException ("The class name is null (in BeanTypeMappingFactory)!");
|
|
33 |
| } |
|
34 |
| |
|
35 |
33
| String lvClassName = pvParams[1];
|
|
36 |
33
| try {
|
|
37 |
33
| clazz = Class.forName(lvClassName);
|
|
38 |
32
| qName = Util.createQNameByClass(clazz);
|
|
39 |
| } catch (Exception e) { |
|
40 |
1
| throw new InvocationException("Can't create class (in BeanTypeMappingFactory) from string: " + lvClassName, e);
|
|
41 |
| } |
|
42 |
| } |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
38
| public Class getJavaType() { return clazz; }
|
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
50
| public QName getXmlType() { return qName; }
|
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
6
| public SerializerFactory getSerializerFactory() { return new BeanSerializerFactory(clazz, getXmlType()); }
|
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
6
| public DeserializerFactory getDeserializerFactory() { return new BeanDeserializerFactory(clazz, getXmlType()); }
|
|
62 |
| |
|
63 |
| } |