KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ws > wsgen > generator > axis > VcTypeMapping


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Sauthier Guillaume
22  * --------------------------------------------------------------------------
23  * $Id: VcTypeMapping.java,v 1.5 2004/08/11 16:09:45 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_ws.wsgen.generator.axis;
28
29 import javax.xml.namespace.QName JavaDoc;
30
31 /**
32  * Member of a VelocityContext. Contains information used to create a
33  * typeMapping WSDD tag.
34  *
35  * @author Guillaume SAUTHIER
36  */

37 public abstract class VcTypeMapping {
38
39     /** classname */
40     private String JavaDoc classname;
41
42     /** xml type QName */
43     private QName JavaDoc xmlType;
44
45     /**
46      * SOAP Encoding Style
47      */

48     private static final String JavaDoc ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
49
50     /**
51      * Create a VcTypeMapping holding typeMapping information.
52      *
53      * @param xml XML Qname of the type
54      * @param name Java name of the type
55      */

56     public VcTypeMapping(QName JavaDoc xml, String JavaDoc name) {
57         classname = name;
58         xmlType = xml;
59     }
60
61     /**
62      * @return Returns the Java classname
63      */

64     public String JavaDoc getClassname() {
65         return classname;
66     }
67
68     /**
69      * @return Returns the namespace of the QName
70      */

71     public String JavaDoc getNamespaceURI() {
72         return xmlType.getNamespaceURI();
73     }
74
75     /**
76      * @return Returns the local-part of the QName
77      */

78     public String JavaDoc getLocalPart() {
79         return xmlType.getLocalPart();
80     }
81
82     /**
83      * @return Returns the serializer factory for the mapping
84      */

85     protected abstract String JavaDoc getSerializerFactory();
86
87     /**
88      * @return Returns the deserializer factory for the mapping
89      */

90     protected abstract String JavaDoc getDeserializerFactory();
91
92     /**
93      * @return Returns the encoding style for the mapping
94      */

95     protected String JavaDoc getEncodingStyle() {
96         return ENCODING_STYLE;
97     }
98
99     /**
100      * @return Returns a String representation of the typeMapping
101      */

102     public String JavaDoc toString() {
103         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
104         sb.append("<typeMapping xmlns:ns=\"" + getNamespaceURI() + "\"\n");
105         sb.append(" qname=\"ns:" + getLocalPart() + "\"\n");
106         sb.append(" languageSpecificType=\"java:" + getClassname() + "\"\n");
107         sb.append(" serializer=\"" + getSerializerFactory() + "\"\n");
108         sb.append(" deserializer=\"" + getDeserializerFactory() + "\"\n");
109         sb.append(" encodingStyle=\"" + getEncodingStyle() + "\" />");
110         return sb.toString();
111     }
112 }
Popular Tags