Index Changes

The following section describes how a Binding Component can plug in its own wizard configuration panels. These binding wizard panel(s) can be integrated from CASA to provide concrete configurations of binding-specific parameters.

Brief summary of how the plugin works from CASA

In CASA, a Binding Component from the WSDL Binding palette is dragged onto the WSDL Ports area. Once the user creates a link between one of the WSDL Ports to one of the Service unit, the Binding Component is invoked to provide its implementation as a pluggable module with its corresponding wizard binding panel(s) for the configuration. An existing port's binding configuration can also be edited by clicking on the pencil icon.


If the Binding Component is registered as an ExtensibilityElementConfigurationEditorProvider, then its implementation of the ExtensibilityElementConfigurationEditorComponent's getEditorPanel to return its corresponding visual component to display is processed. Based on the direction of the link and the actual message operation defined by the Service, a dialog is launched containing this visual component returned by the BC's implementation. If there are more than one operation defined, user can select the appropriate operation to configure; otherwise, the panels are populated based on the default operation.

A sample of the File BC implementation of the Inbound (Request/Response) is as follows:


The following steps describes how a Binding Component can plug in its binding wizard panels. The snippet of code used is from the File BC implementation and is available in the soa-dev branch under the wsdlextension.file module to get a detailed sample of the implementation.

Step 1
Create a class that implements the editor provider interface:
org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementConfigurationEditorProvider

Here are the main interfaces to implement.

    /**
     * Provides component at current context using qname and/or wsdlcomponent.
     * Return an appropriate EditorComponent corresponding to the qname and/or wsdlcomponent.
     * @param qname QName of the element in the wsdl
     * @param component WSDLComponent in the wsdl.
     * @return
     */
    public abstract ExtensibilityElementConfigurationEditorComponent getComponent(QName qname, WSDLComponent component);

    /**
     * The next two methods are interlinked. It allows for binding configuration per operation.
     * This is the entry point from casa editor, the skeleton template is loaded from the template.xml at this point.
     * It is recommended that the port and the link direction is cached and reused when the getComponent(Operation operation) is called.
     *
     * @param component
     * @param linkDirection
     * @return
     */
    public void initOperationBasedEditingSupport(WSDLComponent component, String linkDirection) {
       
    }

    /**
     * Return the component for the operation. This can be called multiple times, so it is recommended to cache it.
     *
     * @param operation
     * @return
     */
    public ExtensibilityElementConfigurationEditorComponent getOperationBasedEditorComponent(Operation operation) {
        return null;
    }


    /**
     * Called when OK is pressed in the dialog, commit all the panels related to each operation in the operation list.
     *
     * @param operationList
     * @return true if successfully committed
     */
    public boolean commitOperationBasedEditor(ArrayList<Operation> operationList) {
        return false;
    }
   
    /**
     * Called when dialog is cancelled/closed, rollback all the panels related to each operation in the operation list.
     * Can be used to cleanup.
     * @param operationList
     */
    public void rollbackOperationBasedEditor(ArrayList<Operation> operationList) {
       
    }

Step 2
Register this provider class by creating a file in your META-INF\services directory where the content of the file should point to your implementation class in above step. The file should be named the following:
org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementConfigurationEditorProvider
Sample content for the File Binding contained the following:
    org.netbeans.modules.wsdlextensions.file.configeditor.FileConfigurationEditorProvider
Step 3
Create a class that implements the following configuration component interface and is the object that needs to be returned from the getComponent() implementation from Step 1 above.
org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementConfigurationEditorComponent
You would need to implement the following:
    // should return the main panel that contains the configuration panel(s)
    public JPanel getEditorPanel();  

    // title to show above your panel  
    public String getTitle();

    public HelpCtx getHelpCtx();    
    public ActionListener getActionListener();

    // based on the wsdl component model, need to implement the persisting
    // of the configured paramters from your binding configuration panels
    public boolean commit();

    public boolean rollback(); 

    // calls the validation of the wsdl component model based on calling the commit above   
    public boolean isValid();

NOTES: Based on the changes made to both File and JMS BC to support the new framework from CASA, the main key here was to update the panels based on the operation selected. Previously, the first operation defined is what we based the configuration with and the operation was not exposed to the user. Now, the operation is selected by the user and is passed in to the BC so this needs to be propagated to the appropriate panels to update accordingly. Also, depending on where/how the commit code is handled, might help minimize duplication of code if the same commit code be called from either plugin entry: WSDLWizardExtensionIterator from WSDL Wizard or the ExtensibilityElementConfigurationEditorProvider from CASA


The Binding Component developer is responsible for creating the visual components corresponding to its configuration parameters as well as the retrieval and persistence of these same parameters given the wsdl model. The above getEditorPanel() implementation should return the panel with the visual components already populated with the model.

To reuse the same visual panels implemented for the WSDL Wizard, you can return these same panels in your implementation of getEditorPanel(). If there are more than 1 wizard panels, return a visual component using a JTabbedPane that holds these panels.

public class FileInboundConfigurationEditorComponent
        implements ExtensibilityElementConfigurationEditorComponent {

    public FileInboundConfigurationEditorComponent(QName qName,
            WSDLComponent component) {

        if (editorPanel == null) {
            editorPanel = new InboundOutboundMessagePanel(component);
        } else {
            editorPanel.populateView(component);
        }

        ...
        ...
    }

    /**
     * Return the main panel
     * @return
     */
    public JPanel getEditorPanel() {

        return fileEditorPanel;
    }
     
    ...
    ...

The commit() implementation should persist the values from the visual components back to the wsdl model.

There should be validation per parameter (if applicable) to ensure validity of the value from the user. For example, if a parameter is of an integer value, visual components should not allow the persistence of non-numeric values. There is however the isValid() implementation that should use the existing binding component's validator code which gets called when 'OK' button is clicked on.

Bugs\Issues

  • In case of issues, file bugs under xml/wsdltools component in netbeans issue zilla or send mail to Jonelle/Kini

JSPWiki v2.4.100
« Home Index Changes Prefs
This page (revision-2) was last changed on 03-Dec-08 18:59 PM, -0800 by JonelleAlmero