KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tools > ant > wsdl > ComplexType


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.tools.ant.wsdl;
17
18 import org.apache.axis.encoding.TypeMapping;
19 import org.apache.axis.encoding.ser.BaseSerializerFactory;
20 import org.apache.axis.encoding.ser.BaseDeserializerFactory;
21 import javax.xml.rpc.encoding.SerializerFactory JavaDoc;
22 import javax.xml.rpc.encoding.DeserializerFactory JavaDoc;
23 import javax.xml.namespace.QName JavaDoc;
24
25 public class ComplexType {
26     private String JavaDoc className;
27     private String JavaDoc serializer =
28             "org.apache.axis.encoding.ser.BeanSerializerFactory";
29     private String JavaDoc deserializer =
30             "org.apache.axis.encoding.ser.BeanDeserializerFactory";
31     private String JavaDoc namespace;
32     
33     public ComplexType() {}
34     
35     public void setClassName(String JavaDoc className) {
36         this.className = className;
37     }
38     
39     public void setSerializer(String JavaDoc serializer) {
40         this.serializer = serializer;
41     }
42     
43     public void setDeserializer(String JavaDoc deserializer) {
44         this.deserializer = deserializer;
45     }
46     
47     public void setNameSpace(String JavaDoc namespace) {
48         this.namespace = namespace;
49     }
50     
51     public void register(TypeMapping tm) throws ClassNotFoundException JavaDoc {
52         Class JavaDoc cl = Class.forName(className);
53         String JavaDoc localName = className.substring((className.lastIndexOf(".") + 1));
54         QName JavaDoc qName = new QName JavaDoc(namespace,localName);
55         SerializerFactory sf = BaseSerializerFactory.createFactory(
56                                     Class.forName(serializer), cl, qName);
57         DeserializerFactory df = BaseDeserializerFactory.createFactory(
58                                     Class.forName(deserializer), cl, qName);
59         
60         tm.register(cl, qName, sf, df);
61     }
62 }
Popular Tags