001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer(s): Sauthier Guillaume
022: * --------------------------------------------------------------------------
023: * $Id: VcTypeMapping.java 5255 2004-08-11 16:09:45Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_ws.wsgen.generator.axis;
026:
027: import javax.xml.namespace.QName;
028:
029: /**
030: * Member of a VelocityContext. Contains information used to create a
031: * typeMapping WSDD tag.
032: *
033: * @author Guillaume SAUTHIER
034: */
035: public abstract class VcTypeMapping {
036:
037: /** classname */
038: private String classname;
039:
040: /** xml type QName */
041: private QName xmlType;
042:
043: /**
044: * SOAP Encoding Style
045: */
046: private static final String ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
047:
048: /**
049: * Create a VcTypeMapping holding typeMapping information.
050: *
051: * @param xml XML Qname of the type
052: * @param name Java name of the type
053: */
054: public VcTypeMapping(QName xml, String name) {
055: classname = name;
056: xmlType = xml;
057: }
058:
059: /**
060: * @return Returns the Java classname
061: */
062: public String getClassname() {
063: return classname;
064: }
065:
066: /**
067: * @return Returns the namespace of the QName
068: */
069: public String getNamespaceURI() {
070: return xmlType.getNamespaceURI();
071: }
072:
073: /**
074: * @return Returns the local-part of the QName
075: */
076: public String getLocalPart() {
077: return xmlType.getLocalPart();
078: }
079:
080: /**
081: * @return Returns the serializer factory for the mapping
082: */
083: protected abstract String getSerializerFactory();
084:
085: /**
086: * @return Returns the deserializer factory for the mapping
087: */
088: protected abstract String getDeserializerFactory();
089:
090: /**
091: * @return Returns the encoding style for the mapping
092: */
093: protected String getEncodingStyle() {
094: return ENCODING_STYLE;
095: }
096:
097: /**
098: * @return Returns a String representation of the typeMapping
099: */
100: public String toString() {
101: StringBuffer sb = new StringBuffer();
102: sb.append("<typeMapping xmlns:ns=\"" + getNamespaceURI()
103: + "\"\n");
104: sb.append(" qname=\"ns:" + getLocalPart() + "\"\n");
105: sb.append(" languageSpecificType=\"java:"
106: + getClassname() + "\"\n");
107: sb.append(" serializer=\"" + getSerializerFactory()
108: + "\"\n");
109: sb.append(" deserializer=\""
110: + getDeserializerFactory() + "\"\n");
111: sb.append(" encodingStyle=\"" + getEncodingStyle()
112: + "\" />");
113: return sb.toString();
114: }
115: }
|