- Index

< Previous |  | Next >

# Creating a New EventFlow Interface

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

## Create a New, Empty Interface File

To create a new, empty EventFlow interface file in an existing project:

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

   - Select File → New → StreamBase EventFlow™ Interface.

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

   - Right-click anywhere in the Project Explorer, and select New → StreamBase EventFlow™ Interface from the context menu.

   - With the cursor in any Studio view, press Ctrl+N to open the New dialog. Select StreamBase EventFlow™ Interface and click Next.

   - With the cursor in any Studio view, press Alt+Shift+N to open the File → New menu at the cursor location. Select StreamBase EventFlow™ Interface and press Enter.

2. In the New StreamBase EventFlow™ Interface wizard, navigate to the package name folder of the project in which you want to add the interface.

   (If you fail to select an existing package name, the interface is created with the default package name. It is strongly discouraged to use the default package name.)

3. Type a name for the interface file. Studio adds the `.sbint` extension if you leave it off.

4. Click Finish. Studio creates the new file and opens it in the Interface Editor.

## 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. Select the check box for the Extend existing interfaces control to take the starting point for the interface you are creating from an existing interface in the current project. Click Add to select from a list all the EventFlow interface files in the current project.

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 defined 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 Refactor → Extract 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 Refactor → Extract 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 EventFlow interface file in the selected project in 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 EventFlow interface between projects. Studio provides a much simpler way to share and reuse interfaces, as described in Project References and Importing Resources from One Module to Another. 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 EventFlow 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 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.