KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > model > extensions > soap > impl > SOAPBindingImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.modules.xml.wsdl.model.extensions.soap.impl;
22
23 import org.netbeans.modules.xml.wsdl.model.Binding;
24 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
25 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBinding;
26 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBinding.Style;
27 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPComponent;
28 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPQName;
29 import org.netbeans.modules.xml.xam.Component;
30 import org.w3c.dom.Element JavaDoc;
31
32 /**
33  *
34  * @author rico
35  */

36 public class SOAPBindingImpl extends SOAPComponentImpl implements SOAPBinding{
37     
38     /** Creates a new instance of SOAPBindingImpl */
39     public SOAPBindingImpl(WSDLModel model, Element JavaDoc e) {
40         super(model, e);
41     }
42     
43     public SOAPBindingImpl(WSDLModel model){
44         this(model, createPrefixedElement(SOAPQName.BINDING.getQName(), model));
45     }
46     
47     public void accept(SOAPComponent.Visitor visitor) {
48         visitor.visit(this);
49     }
50     
51     public void setTransportURI(String JavaDoc transportURI) {
52         setAttribute(TRANSPORT_URI_PROPERTY, SOAPAttribute.TRANSPORT_URI, transportURI);
53     }
54     
55     public String JavaDoc getTransportURI() {
56         return getAttribute(SOAPAttribute.TRANSPORT_URI);
57     }
58     
59     public void setStyle(Style style) {
60         setAttribute(STYLE_PROPERTY, SOAPAttribute.STYLE, style);
61     }
62     
63     public Style getStyle() {
64         String JavaDoc s = getAttribute(SOAPAttribute.STYLE);
65         return s == null ? null : Style.valueOf(s.toUpperCase());
66     }
67
68     private Style getStyleValueOf(String JavaDoc s) {
69         return s == null ? null : Style.valueOf(s.toUpperCase());
70     }
71     
72     protected Object JavaDoc getAttributeValueOf(SOAPAttribute attr, String JavaDoc s) {
73         if (attr == SOAPAttribute.STYLE) {
74             return getStyleValueOf(s);
75         } else {
76             return super.getAttributeValueOf(attr, s);
77         }
78     }
79
80
81     @Override JavaDoc
82     public boolean canBeAddedTo(Component target) {
83         if (target instanceof Binding) {
84             return true;
85         }
86         return false;
87     }
88 }
89
Popular Tags