Registering widgets

You register widgets so that you and others may use it in the Business Space environment.

Before you register widgets, you must have built your widgets as described in Creating widgets and packaged and deployed your widgets as described in Packaging and deploying widgets.

Let's register our widgets. Registration means creating registration files for your widgets and then placing them in a directory where the runtime can view them. Widgets are not visible until registered. We will use two registration files.

The structure of the registration files includes the category for the widgets, which we have called Samples. In addition, there is a description for the widgets, tool tip help and, if wanted, the specification of a version. The tags in the registration file, which are shown in the following examples, are self-explanatory. There can also be national language support in the registration file though for simplicity we have only specified English.

You register your widgets at the file system level.

  1. You can create your own registration files or you can use the ones we have provided for the Selection and Details widgets.

    Both registration files can be found in the following path in your temporary directory:

    <temporary directory>\IBM_BSPACE_SAMPLES.ear\BSpaceWidgetsSamples.war\iWidget\endpoints

    The bspaceSamplesEndpoints.xml file specifies the endpoint where the widget application is deployed. In this case, it specifies the relative location: BSpaceWidgetsSamples. This endpoint is referenced by the widgets' registration file which is shown in the next step.

    The first registration file, bspaceSamplesEndpoints.xml, is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- START NON-TRANSLATABLE -->
    <tns:BusinessSpaceRegistry xmlns:tns="http://com.ibm.bspace/BusinessSpaceRegistry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://com.ibm.bspace/BusinessSpaceRegistry BusinessSpaceRegistry.xsd ">
      
      <tns:Endpoint>
        <tns:id>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:id>
        <tns:type>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:type>
        <tns:version>1.0.0.0</tns:version>
        <tns:url>BSpaceWidgetsSamples/</tns:url>
        <tns:description>Location of Business Space Sample Widgets</tns:description>
      </tns:Endpoint>
    
    </tns:BusinessSpaceRegistry>
    <!-- END NON-TRANSLATABLE -->
  2. The second registration file is called sampleWidgets.xml. This registration file registers all of the sample widgets including {com.ibm.bspace}modelsample and {com.ibm.bspace}kpisample, which we do not describe in this documentation. The widgets that are important are the ones we have used to demonstrate coding widgets, which are {com.ibm.bspace}selectionsample and {com.ibm.bspace}detailssample.

    Note that a widget registration id is just a string. The {com.ibm.bspace} namespace in front of the widget name is used to keep the widget name unique. This registration file describes the location of the widget and many other details beginning with a category definition.

    This registration file is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- START NON-TRANSLATABLE -->
    <tns:BusinessSpaceRegistry xmlns:tns="http://com.ibm.bspace/BusinessSpaceRegistry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://com.ibm.bspace/BusinessSpaceRegistry BusinessSpaceRegistry.xsd ">
    <!-- END NON-TRANSLATABLE -->
      
      <!-- START NON-TRANSLATABLE -->
      <tns:Category>
        <tns:id>{com.ibm.bspace}bspacesamplewidgets</tns:id>
        <tns:name>Samples</tns:name>
        <tns:description>Business Space Sample Widgets</tns:description>
        <tns:tooltip>Business Space Sample Widgets</tns:tooltip>
        <tns:localeInfo>
        <!-- END NON-TRANSLATABLE -->
          <tns:locale>en_US</tns:locale>
          <tns:name>Samples</tns:name>
          <tns:description>Business Space Sample Widgets</tns:description>
          <tns:tooltip>Business Space Sample Widgets</tns:tooltip>
        <!-- START NON-TRANSLATABLE -->
        </tns:localeInfo>
        <tns:order>5</tns:order>
      </tns:Category>
      <!-- END NON-TRANSLATABLE -->
      
      <!-- START NON-TRANSLATABLE -->
      <tns:Widget>
        <tns:id>{com.ibm.bspace}modelsample</tns:id>
        <tns:version>1.0.0.0</tns:version>
        <tns:name>Sample Model</tns:name>
        <tns:type>{com.ibm.bspace}iWidget</tns:type>
        <tns:description>Sample Model</tns:description>
        <tns:tooltip>Sample Model</tns:tooltip>
        <tns:categoryId>{com.ibm.bspace}bspacesamplewidgets</tns:categoryId>
        <tns:widgetEndpointId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:widgetEndpointId>
        <tns:url>iWidget/widgets/samples/modelsample/modelsample_iWidget.xml</tns:url>
        <tns:helpUrl>dash/help_htm.html</tns:helpUrl>
        <tns:iconUrl>iWidget/images/generic_iWidget.gif</tns:iconUrl>
        <tns:attachable/>
        <!-- <tns:previewUrl>TBD</tns:previewUrl> -->
        <tns:owner>IBM</tns:owner>
        <tns:email>TBD</tns:email>
        <tns:serviceEndpointRef>
          <tns:name>serviceUrlRoot</tns:name>
          <tns:refId>{com.ibm.wbimonitor}monitorServiceRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        <tns:serviceEndpointRef>
          <tns:name>monitorWidgetRoot</tns:name>
          <tns:refId>{com.ibm.wbimonitor}monitorWidgetRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        
        <tns:localeInfo>
        <!-- END NON-TRANSLATABLE -->
          <tns:locale>en_US</tns:locale>
          <tns:name>Sample Model</tns:name>
          <tns:description>Sample Model</tns:description>
          <tns:tooltip>Sample Model</tns:tooltip>
        <!-- START NON-TRANSLATABLE -->
        </tns:localeInfo>
      </tns:Widget>
      <!-- END NON-TRANSLATABLE -->
      
      <!-- START NON-TRANSLATABLE -->
      <tns:Widget>
        <tns:id>{com.ibm.bspace}kpisample</tns:id>
        <tns:version>1.0.0.0</tns:version>
        <tns:name>Sample KPI</tns:name>
        <tns:type>{com.ibm.bspace}iWidget</tns:type>
        <tns:description>Sample KPI</tns:description>
        <tns:tooltip>Sample KPI</tns:tooltip>
        <tns:categoryId>{com.ibm.bspace}bspacesamplewidgets</tns:categoryId>
        <tns:widgetEndpointId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:widgetEndpointId>
        <tns:url>iWidget/widgets/samples/kpisample/kpisample_iWidget.xml</tns:url>
        <tns:helpUrl>dash/help_htm.html</tns:helpUrl>
        <tns:iconUrl>iWidget/images/generic_iWidget.gif</tns:iconUrl>
        <!-- <tns:previewUrl>TBD</tns:previewUrl> -->
        <tns:owner>IBM</tns:owner>
        <tns:email>TBD</tns:email>
        <tns:serviceEndpointRef>
          <tns:name>serviceUrlRoot</tns:name>
          <tns:refId>{com.ibm.wbimonitor}monitorServiceRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        <tns:serviceEndpointRef>
          <tns:name>monitorWidgetRoot</tns:name>
          <tns:refId>{com.ibm.wbimonitor}monitorWidgetRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        <tns:localeInfo>
        <!-- END NON-TRANSLATABLE -->
          <tns:locale>en_US</tns:locale>
          <tns:name>Sample KPI</tns:name>
          <tns:description>Sample KPI</tns:description>
          <tns:tooltip>Sample KPI</tns:tooltip>
        <!-- START NON-TRANSLATABLE -->
        </tns:localeInfo>
      </tns:Widget>
      <!-- END NON-TRANSLATABLE -->
        
      <!-- START NON-TRANSLATABLE -->
      <tns:Widget>
        <tns:id>{com.ibm.bspace}selectionsample</tns:id>
        <tns:version>1.0.0.0</tns:version>
        <tns:name>Selection Sample</tns:name>
        <tns:type>{com.ibm.bspace}iWidget</tns:type>
        <tns:description>Selection Sample</tns:description>
        <tns:tooltip>Selection Sample</tns:tooltip>
        <tns:categoryId>{com.ibm.bspace}bspacesamplewidgets</tns:categoryId>
        <tns:widgetEndpointId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:widgetEndpointId>
        <tns:url>iWidget/widgets/samples/selectionSample/selectionSample_iWidget.xml</tns:url>
        <tns:helpUrl></tns:helpUrl>
        <tns:iconUrl>iWidget/images/generic_iWidget.gif</tns:iconUrl>
        <tns:previewUrl>iWidget/images/prev_pres.gif</tns:previewUrl>
        <tns:owner>IBM</tns:owner>
        <tns:email>TBD</tns:email>
        <tns:serviceEndpointRef required="false">
          <tns:name>serviceUrlRoot</tns:name>
          <tns:refId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        <tns:localeInfo>
        <!-- END NON-TRANSLATABLE -->
          <tns:locale>en_US</tns:locale>
          <tns:name>Selection Sample</tns:name>
          <tns:description>Selection Sample</tns:description>
          <tns:tooltip>Selection Sample</tns:tooltip>
        <!-- START NON-TRANSLATABLE -->
        </tns:localeInfo>
      </tns:Widget>
      <!-- END NON-TRANSLATABLE -->
    
    
      <!-- START NON-TRANSLATABLE -->
      <tns:Widget>
        <tns:id>{com.ibm.bspace}detailssample</tns:id>
        <tns:version>1.0.0.0</tns:version>
        <tns:name>Details Sample</tns:name>
        <tns:type>{com.ibm.bspace}iWidget</tns:type>
        <tns:description>Details Sample</tns:description>
        <tns:tooltip>Details Sample</tns:tooltip>
        <tns:categoryId>{com.ibm.bspace}bspacesamplewidgets</tns:categoryId>
        <tns:widgetEndpointId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:widgetEndpointId>
        <tns:url>iWidget/widgets/samples/detailsSample/detailsSample_iWidget.xml</tns:url>
        <tns:helpUrl></tns:helpUrl>
        <tns:iconUrl>iWidget/images/generic_iWidget.gif</tns:iconUrl>
        <tns:previewUrl>iWidget/images/prev_pres.gif</tns:previewUrl>
        <tns:owner>IBM</tns:owner>
        <tns:email>TBD</tns:email>
        <tns:serviceEndpointRef required="false">
          <tns:name>serviceUrlRoot</tns:name>
          <tns:refId>{com.ibm.bspace}bspaceSamplesWidgetRootId</tns:refId>
          <tns:refVersion>1.0.0.0</tns:refVersion>
        </tns:serviceEndpointRef>
        <tns:localeInfo>
        <!-- END NON-TRANSLATABLE -->
          <tns:locale>en_US</tns:locale>
          <tns:name>Details Sample</tns:name>
          <tns:description>Details Sample</tns:description>
          <tns:tooltip>Details Sample</tns:tooltip>
        <!-- START NON-TRANSLATABLE -->
        </tns:localeInfo>
      </tns:Widget>
      <!-- END NON-TRANSLATABLE -->
    
    
    
    <!-- START NON-TRANSLATABLE -->
    </tns:BusinessSpaceRegistry>
    <!-- END NON-TRANSLATABLE -->
  3. Copy bspaceSamplesEndpoints.xml and sampleWidgets.xml to the following path:

    <installdir>\profiles\<profilename>\BusinessSpace\registryData

  4. Close the file system and return to WebSphere Integration Developer. Restart your Business Space EAR.

Note that we are registering our widgets locally, which means for the purposes of our sample we assume you have a server supporting Business Space running on your own computer.

Although for learning purposes we are assuming you are working locally, eventually you would move your widgets to a production server. When you do so, you will need to explicitly register your endpoints so your widgets run on that specific server. To explicitly register your widgets, see Enabling Business Space widgets manually for remote endpoints.

You have registered your widgets, now you need to test them, which is discussed in Testing widgets.