KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdlextui > property > SoapBindingConfigurator


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdlextui.property;
21
22
23 import java.util.Arrays JavaDoc;
24 import java.util.Collection JavaDoc;
25
26 import javax.xml.namespace.QName JavaDoc;
27
28 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
29 import org.netbeans.modules.xml.wsdl.ui.api.property.ExtensibilityElementPropertyAdapter;
30 import org.netbeans.modules.xml.wsdl.ui.api.property.StringAttributeProperty;
31 import org.netbeans.modules.xml.wsdl.ui.spi.ExtensibilityElementConfigurator;
32 import org.openide.ErrorManager;
33 import org.openide.nodes.Node;
34 import org.openide.util.NbBundle;
35
36 /**
37  *
38  * @author skini
39  */

40 public class SoapBindingConfigurator extends ExtensibilityElementConfigurator {
41     
42     
43     private static QName JavaDoc bindingQName = new QName JavaDoc("http://schemas.xmlsoap.org/wsdl/soap/", "binding");
44     private static QName JavaDoc operationQName = new QName JavaDoc("http://schemas.xmlsoap.org/wsdl/soap/", "operation");
45     
46     private static QName JavaDoc[] supportedQNames = {bindingQName, operationQName};
47     
48     private static String JavaDoc transport = "http://schemas.xmlsoap.org/soap/http";
49     
50     /** Creates a new instance of SoapHeaderConfigurator */
51     public SoapBindingConfigurator() {
52     }
53     
54     @Override JavaDoc
55     public Collection JavaDoc<QName JavaDoc> getSupportedQNames() {
56         return Arrays.asList(supportedQNames);
57     }
58     
59     @Override JavaDoc
60     public Node.Property getProperty(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName) {
61         Node.Property property = null;
62         if (bindingQName.equals(qname)) {
63             if ("transport".equals(attributeName)) {
64                 ExtensibilityElementPropertyAdapter adapter = new ExtensibilityElementPropertyAdapter(extensibilityElement, attributeName, transport);
65                 try {
66                     property = new StringAttributeProperty(adapter, String JavaDoc.class, "getValue", "setValue");
67                     property.setName(NbBundle.getMessage(SoapAddressConfigurator.class, "PROP_NAME_BINDING_TRANSPORT"));
68                 } catch (NoSuchMethodException JavaDoc e) {
69                     ErrorManager.getDefault().notify(e);
70                 }
71             }
72         }
73         return property;
74     }
75     
76     
77     
78     @Override JavaDoc
79     public String JavaDoc getDisplayAttributeName(ExtensibilityElement extensibilityElement, QName JavaDoc qname) {
80         return null;
81     }
82
83     @Override JavaDoc
84     public String JavaDoc getAttributeUniqueValuePrefix(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName) {
85         // TODO Auto-generated method stub
86
return null;
87     }
88
89     @Override JavaDoc
90     public String JavaDoc getDefaultValue(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName) {
91         if (qname.equals(bindingQName)) {
92             if ("transport".equals(attributeName)) {
93                 return transport;
94             }
95         }
96         return null;
97     }
98     
99     @Override JavaDoc
100     public String JavaDoc getTypeDisplayName(ExtensibilityElement extensibilityElement, QName JavaDoc qname) {
101         if (qname.equals(bindingQName))
102             return NbBundle.getMessage(SoapBindingConfigurator.class, "LBL_SoapBinding_TypeDisplayName");
103         else if (qname.equals(operationQName))
104             return NbBundle.getMessage(SoapBindingConfigurator.class, "LBL_SoapOperation_TypeDisplayName");
105         return null;
106     }
107     
108 }
109
110
Popular Tags