Packaging and deploying widgets

Packaging and deploying your widgets gets them ready for use by a runtime.

Before you package and deploy your widgets, you must have created them as described in Creating widgets.

Several steps are involved in packaging your widget. You first create an Enterprise Archive (EAR) file and then put a Web Application Archive (WAR) file into it. A key file that is necessary for your EAR file is the utilities file that is used by widgets for additional functions.

In packaging your widgets, look in your temporary directory, which contains the unzipped EAR file of the provided sample widgets, for guidance. The files and structure of this unzipped EAR file will be similar for your own widgets. Unzipping the sample widgets describes the process of unzipping the sample EAR file.

  1. Create an EAR file. We will use the development environment of WebSphere Integration Developer to list the high level steps to create an EAR file:
    1. Switch to the Java EE perspective.
    2. Select New > Enterprise Application Project.
    3. Add a project name, for example, MySampleEAR and click Finish.
  2. Create a WAR file. In our case, we will create a dynamic web project and specify the previous EAR:
    1. Select New > Dynamic Web Project.
    2. Add a project name, for example, MySampleWidgets. Select the previous EAR file as the container (that is, EAR Project Name) for your WAR file. Click Next.
    3. On the Web Module page you will see the name for the context root. The default context root name if using the user interface in WebSphere Integration Developer is the name of your WAR file. In our case, the name would be MySampleWidgets. This name is used by the registration file, so you want to note the context root name.
    4. Click Finish.
  3. Add your widgets to the WAR file:
    1. Create a file structure beneath the iWidget directory for each widget. If you were following our provided sample widgets, the structure would be as follows for the Selection widget:

      iWidget\widgets\samples\selectionSample

      The file structure for the Details widget would be as follows:

      iWidget\widgets\samples\detailsSample

    2. Import your widget into the appropriate directories. Each directory would include the XML file for your widget and the JavaScript file. For example, if using our provided sample widgets, the Selection widget code, selectionSample_iWidget.xml and selectionSample.js , would be imported into this file structure:

      iWidget\widgets\samples\selectionSample

  4. Deploying your EAR file to a runtime was shown earlier when you deployed the sample widgets. To deploy your own EAR file, follow the steps in Deploying the sample widgets.
You have packaged your widgets and deployed them to a runtime, now you need to register your widgets as shown in Registering widgets.