WSDLEditor.PropertySheetCustomizers

WSDL Editor Tree View shows attributes of a node in the Property Sheet. In case of extensibility elements, the wsdl editor does not have a way to know in advance what sort of property customizers to is to be shown.

Following are the salient points of the design:
1. Ability to provide grouping of properties.
For example: jms:message has following groups

JMS Message
  messageType
  textPart
JMS Message Headers
  correlationIdPart
  deliveryModePart
Encoding
  use
  encodingStyle

2. Ability to specify order of groups.

3. Ability to specify order of individual attributes in respective groups.

4. Specify customizers for each attribute:
Customizer are of three types:

  1. SchemaCustomizer : Which is what currently is provided. This generates a drop down for attributes with enumeration/boolean and for all other types generates the default String customizer.
  2. BuiltInCustomizer : These are out of the box customizer that we thought may be usefule for most of the use cases and pertain to abstract WSDL components. Currently we have MessageChooser, PartChooser, PartsChooser and PortTypeChooser.
  3. NewCustomizer : Lets you create your own customizer, if your requirements are not met by any of the builtin customizer.

5. Ability to create GroupedProperty Here some of the attributes that are related and are mutually exclusive can be combined by a single chooser, so as to restrict mistakes from user. For example: bpel property has two attributes "element" and "type". Both are mutually exclusive. So the user can either specify element or type but not both. So "element" and "type" is a GroupedProperty. One customizer can be provided on the property sheet, which depending on the customizer populates either "element" or "type". The localized name and description can be provided in the Bundle.properties with keys as LBL_${displayName} and DESC_$(displayName).

  1. BuiltInCustomizer: Current out of the box, we have two choosers: ElementOrTypeChooser and ElementOrTypeOrMessagePartChooser
  2. NewCustomizer: Lets you create your own grouped customizer. (details follow)


How to implement this?

So the new design involves following steps from the BC developers to show customizers (either builtin or custom).

1. Create a xml snippet based on nb_all\xml.wsdlui\src\org\netbeans\modules\xml\wsdl\ui\property\model\propertyCustomization.xsd (See Notes below)
2. Add this snippet into the element(whose attributes are customized in this xml snippet). The snippet should be added under:

<xsd:annotation>
    <xsd:appinfo>
        <prop:ElementProperties xmlns:prop="http://xml.netbeans.org/schema/wsdlui/property">
          .
          .
          .
        </prop:ElementProperties>
    </xsd:appinfo>
</xsd:annotation>

3. For BuiltinCustomizers, the documentation can be found in appropriate sections of propertyCustomization.xsd and most of the names are self-explanatory.

4. In case of NewCustomizer, a SPI needs to be implemented (create the class and add in META-INF\services etc)

org.netbeans.modules.xml.wsdl.ui.spi.WSDLLookupProvider

public interface WSDLLookupProvider {
    
    Lookup.Provider getProvider(String namespace);
    
}

This is unique per namespace (or schema). So each BC will have one implementation of WSDLLookupProvider.
org.netbeans.modules.xml.wsdl.ui.spi.NewCustomizerProvider

public interface NewCustomizerProvider {
    
   Node.Property getProperty(ExtensibilityElement element, 
                             QName elementQName, 
                             QName attributeQName);
    
}

This provides the custom chooser in the form of Node.Property instance. Single instance of NewCustomizerProvider, acts like a factory to create different NewCustomizer(s) based on the elementQName and attributeQName.

When NewCustomizer is specified, the wsdl editor will first try to get the WSDLLookupProvider for the namespace and then ask for a instance of NewCustomizer.class from the lookup. And call getProperty on the NewCustomizer, which should provide the Node.Property (which will have the customizer implemented)

Also note that only implementation of WSDLLookupProvider needs to go into META-INF\services folder.

Example for WSDLLookupProvider and NewCustomizerProvider can be found at WSDLExtLookupProvider in wsdlui for showing bpel property name attribute.

Note:

Creating XML Schema constrained XML document for code completion and validation of xml snippets.
In order to create a valid xml snippet, its better to use the Netbeans XML Editor. It will provide code completion based on the schema.

  1. New File/Folder
  2. Choose XML category.
  3. Choose XML Document
  4. Next, Next
  5. Choose XML Schema-constrained Document.
  6. Choose the propertyCustomization.xsd from the nb_all\entpack\xml\wsdlui\src\org\netbeans\modules\xml\wsdl\ui\property\model\propertyCustomization.xsd
  7. Finish, now the schema file is created.

Validate your schema after your changes using Netbeans schema editor or better if you use it to edit it too
Also open your BC schema file in Schema editor, select the element that you want to customize. Select\Add annotation and add appinfo under annotation.

Open WSDL Editor and create the node which represents the element that you want to customize. Open the property sheet.

Looking at the attributes in the property sheet, you can edit the XML file in netbeans editor. Once you are done configuring the element, copy the xml snippet from the root node "ElementProperties" and paste it in the appinfo element in your schema. Make sure that you delete the xmlns:xsi and xsi:schemaLocation attributes from the ElementProperties in your schema file.

Examples can be found:
in wsdlExtension: jms-ext.xsd
in wsdlextui : soap.xsd
in wsdlui: ws-bpel_varprop.xsd

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo