Source code: org/apache/axis/deployment/wsdd/WSDDBeanMapping.java
1 /*
2 * Copyright 2001-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.deployment.wsdd;
17
18 import org.apache.axis.encoding.SerializationContext;
19 import org.w3c.dom.Element;
20 import org.xml.sax.helpers.AttributesImpl;
21
22 import javax.xml.namespace.QName;
23 import java.io.IOException;
24
25
26 /**
27 * A <code>WSDDBeanMapping</code> is simply a <code>WSDDTypeMapping</code>
28 * which has preset values for the serializer and deserializer attributes.
29 *
30 * This enables the following slightly simplified syntax when expressing
31 * a bean mapping:
32 *
33 * <beanMapping qname="prefix:local" languageSpecificType="java:class"/>
34 *
35 * @author Glen Daniels (gdaniels@apache.org)
36 */
37 public class WSDDBeanMapping
38 extends WSDDTypeMapping
39 {
40 /**
41 * Default constructor
42 *
43 */
44 public WSDDBeanMapping()
45 {
46 }
47
48 public WSDDBeanMapping(Element e)
49 throws WSDDException
50 {
51 super(e);
52
53 serializer = BEAN_SERIALIZER_FACTORY;
54 deserializer = BEAN_DESERIALIZER_FACTORY;
55 encodingStyle = null;
56 }
57
58 protected QName getElementName() {
59 return QNAME_BEANMAPPING;
60 }
61
62 public void writeToContext(SerializationContext context) throws IOException {
63 AttributesImpl attrs = new AttributesImpl();
64
65 String typeStr = context.qName2String(typeQName);
66 attrs.addAttribute("", ATTR_LANG_SPEC_TYPE,
67 ATTR_LANG_SPEC_TYPE, "CDATA", typeStr);
68
69 String qnameStr = context.qName2String(qname);
70 attrs.addAttribute("", ATTR_QNAME, ATTR_QNAME, "CDATA", qnameStr);
71
72 context.startElement(WSDDConstants.QNAME_BEANMAPPING, attrs);
73 context.endElement();
74 }
75 }
76
77
78