Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • connector.xml -  Defines the connector name, package, and the different categories of operations that will be exposed for the connector. For example, the JIRA connector's connector.xml file looks like this:

    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <connector>
        <component name="jira" package="org.wso2.carbon.connectors">
            <dependency component="jira_config" />
            <dependency component="jira_dashboard"/>
            <dependency component="jira_filter"/>
            <dependency component="jira_group"/>
            <dependency component="jira_issue" />
            <dependency component="jira_project" />
            <dependency component="jira_search" />
            <dependency component="jira_user" />
            <description>JIRA 6.0 cloud connector</description>
        </component>
    </connector>

    For each of the categories you specify, you create a corresponding directory (as shown above in the directory tree), each of which contains a component.xml file.

  • component.xml - Contains information about the operations in this category. For example, in the jira_filter directory, the component.xml file looks like this:

    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <component name="jira_filter" type="synapse/template">
        <subComponents>
            <component name="createFilter">
                <file>createFilter.xml</file>
                <description>Creates a new filter, and returns newly 
    created filter. Currently sets permissions just using the users default 
    sharing permissions</description>
            </component>
            <component name="deleteFilter">
                <file>deleteFilter.xml</file>
                <description>Delete a filter.</description>
            </component>
            <component name="getFavouriteFilters">
                <file>getFavouriteFilters.xml</file>
                <description>Returns the favourite filters of the logged-in user.</description>
            </component>
            <component name="getFilterById">
                <file>getFilterById.xml</file>
                <description>Returns a filter given an id</description>
            </component>
            <component name="updateFilterById">
                <file>updateFilterById.xml</file>
                <description>Updates an existing filter, and returns its new value.</description>
            </component>
        </subComponents>
    </component>

    Each operation is specified as a separate sub-component of the operation group.

  • <operation-name>.xml - Contains the actual API calling configuration. This file contains the steps necessary to call the API exposed by the service. For example, the createFilter operation defined above points to the file createFilter.xml, which uses templates to define the configuration:

    Code Block
    languagehtml/xml
    <template xmlns="http://ws.apache.org/ns/synapse" name="createFilter">
    <!-- actual configuration used to call the REST API -->
      <sequence>
        <property name="messageType" value="application/json" scope="axis2"/>
        <property name="Accept-Encoding" action="remove" scope="transport"/>
    <!-- calling the REST API through the call mediator -->
        <call>
          <endpoint>
            <http method="POST" uri-template="{uri.var.jira.url}/rest/api/2/filter"/>
          </endpoint>
        </call>
      </sequence>
    </template>

...