Creating a New StreamBase Interface

An Interface is a defined set of input streams, output streams, and Query Tables, all based on named schemas and table schemas, that application modules can implement. StreamBase Interfaces are described in StreamBase Interfaces.

Create a New, Empty Interface File

To create a new, empty application in an existing project:

  1. Open the New StreamBase EventFlow Interface wizard using one of the following methods:

    • Select FileNewStreamBase Interface.

    • Click the drop-down arrow next to the New toolbar button (), and select StreamBase Interface from the drop-down menu:

    • Right-click anywhere in the Project Explorer, and select NewStreamBase Interface from the context menu.

    • With the cursor in any Studio view, press Ctrl+N to open the New dialog. Select EventFlow Application (or StreamSQL Application) and click Next.

    • With the cursor in any Studio view, press Alt+Shift+N to open the FileNew menu at the cursor location. Select StreamBase Interface and press Enter.

  2. In the New StreamBase EventFlow Interface wizard, select the top-level project folder in which you want to add the Interface.

  3. Type a name for the Interface file, including the .sbint extension.

  4. Click Finish. This opens the Interface Editor, ready to define your new Interface file.

Create an Interface from an Interface

To create a new Interface that extends an existing StreamBase Interface:

  1. Follow the steps in Create a New, Empty Interface File.

  2. After step 3, select the Extend existing interfaces check box and click Next.

  3. This opens the Choose Interfaces panel. Click Add to select from a list all the StreamBase Interfaces file (.sbint files) in the selected project's module search path.

  4. Select one or more Interface files and click OK.

  5. Click Finish.

Create an Interface from the Current Module

You can create an interface from the currently open EventFlow module if it has the following characteristics:

  • One or more input streams whose schema is fined with a named schema.

  • One or more output streams with a declared schema.

  • One or more shared or placeholder Query Tables defined with a table schema.

If at least one of these features is not found in the current module, running the RefactorExtract Interface command results in an information dialog.

If the currently open module meets the qualifications, follow these steps to create a new interface using the current module's stream and table schema definitions:

  1. Right-click the canvas background and select RefactorExtract Interface from the context menu.

  2. This opens the Extract Interface dialog, in which the streams and Query Tables that meet the criteria above are shown. (Non-matching streams and Query Tables are omitted from the dialog.) Select the streams and Query Tables that you want to be encapsulated in the new interface.

  3. Optional. Click Preview to open a second dialog in which you can view a side-by-side comparison of the underlying XML source for the current module, before and after the refactoring.

  4. Click OK to create the new interface file, and to refactor the current module as an implementation of that interface. The schema definitions extracted from the module are now defined in the Definitions tab of the module.

Create an Interface by Linking

Advanced. For advanced use cases, it is possible to create a new StreamBase Interface file in the selected project in your Studio workspace by linking to an existing file anywhere in the file system.

Note

Do not use this linked file mechanism if your only goal is to share an Interface between projects. Studio provides a simple way to reuse Interfaces defined anywhere in the Studio workspace. It is always better to import an external file into Studio than to link to an external file.

This feature establishes a true link, not a copy, of the specified file. When you link to a file that is outside the Studio workspace, any edits to the file in Studio affect the external file. Similarly, if you edit the original file outside of Studio, you are also editing the linked copy in the Studio workspace, possibly rendering the Interface invalid.

For the rare, advanced cases where it is appropriate to create a StreamBase Interface by linking to an existing file, proceed as follows:

  1. Follow the steps in Create a New, Empty Interface File.

  2. Before you click Finish, click Advanced. This opens a new line in the dialog.

  3. Select the Link to file in the file system check box, and use the Browse button to navigate to the existing StreamBase Interface file of interest.

    Click Variables to insert path variables in the path to the linked file to avoid hard-coding an absolute path name. The path variables feature is provided by Eclipse, and is not part of StreamBase Studio. For guidance, see the Help topic Path Variables in the Eclipse Workbench User Guide.

  4. Click Finish.

Caution

In very advanced cases, it is possible to use both the Extend existing interfaces and Link to file options at the same time. In this case, the linked-to Interface file must have already been implemented using the same Interface you select in the Choose Interfaces dialog. On creation of such a linked file, Studio typechecking reports any failures to conform to the selected Interfaces.