IBM InfoSphere Streams Version 4.1.1

Setting up and using code templates

You can reuse code snippets by setting up and using code templates in Streams Studio. You can create code templates, edit existing code templates, export, or import code templates, or customize the default code templates that are included in Streams Studio.

Procedure

  1. From the menu, click Window > Preferences.
  2. In the Preferences window, expand InfoSphere Streams > SPL and click Templates to display the Templates window.
  3. To import an existing template:
    1. Click Import and browse to the directory that contains code templates that you want to import.
    2. Select the XML file that contains the code template definitions, and click OK.
  4. To export an existing template:
    1. In the Templates window, select the templates that you want to export, and click Export.
    2. Optional: In the Export Templates window, enter the file name to store the exported templates.
    3. Browse to the directory where you want to save the template, and click OK.
  5. To create a new template:
    1. In the Templates window, click New.
    2. In the Name field, enter a name for the template.
    3. From the Context list, select the context for the new template.
    4. Optional: In the Description field, enter a description for the template.
    5. In the Pattern field, enter the code snippet, and click OK.
  6. To edit an existing template:
    1. In the Templates window, select a code template that you want to modify, and click Edit.
    2. In the Edit Template window, you can change the name, context, or description of the template.
    3. In the Pattern field, you can modify the code snippet, and click OK.