Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/axis/deployment/wsdd/WSDDHandler.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.apache.axis.utils.Messages;
20  import org.w3c.dom.Element;
21  import org.xml.sax.helpers.AttributesImpl;
22  
23  import javax.xml.namespace.QName;
24  import java.io.IOException;
25  
26  
27  /**
28   *
29   */
30  public class WSDDHandler
31      extends WSDDDeployableItem
32  {
33      /**
34       * Default constructor
35       */
36      public WSDDHandler()
37      {
38      }
39  
40      /**
41       *
42       * @param e (Element) XXX
43       * @throws WSDDException XXX
44       */
45      public WSDDHandler(Element e)
46          throws WSDDException
47      {
48          super(e);
49          if (type == null && (this.getClass() == WSDDHandler.class)) {
50              throw new WSDDException(Messages.getMessage("noTypeAttr00"));
51          }
52      }
53  
54      protected QName getElementName()
55      {
56          return QNAME_HANDLER;
57      }
58  
59      public void writeToContext(SerializationContext context)
60          throws IOException
61      {
62          AttributesImpl attrs = new AttributesImpl();
63          QName name = getQName();
64          if (name != null) {
65              attrs.addAttribute("", ATTR_NAME, ATTR_NAME,
66                                 "CDATA", context.qName2String(name));
67          }
68  
69          attrs.addAttribute("", ATTR_TYPE, ATTR_TYPE,
70                             "CDATA", context.qName2String(getType()));
71          context.startElement(WSDDConstants.QNAME_HANDLER, attrs);
72          writeParamsToContext(context);
73          context.endElement();
74      }
75  
76      public void deployToRegistry(WSDDDeployment deployment)
77      {
78          deployment.addHandler(this);
79      }
80  }