Saved Schemas View

The Saved Schemas view is a repository of saved schemas that you can drag or copy into an EventFlow application or Properties view currently open in StreamBase Studio. The view is shared by all the projects in your workspace.

Any changes to your Saved Schemas view are saved in your workspace each time you exit StreamBase Studio. When you need to share schemas across workspaces, you can import and export schemas between a workspace and your file system.

The Saved Schemas view is available from the StreamBase Studio menu: click WindowShow ViewOtherSaved Schemas. The following example shows a Saved Schemas view that contains a list of saved schemas. The first schema in the list has been expanded to show its fields.

The top summary line for each schema gives the number of fields and approximate size. The size is approximate (indicated by the asterisk[1].)

Schema Management Actions

The Saved Schemas view offers a range of actions with which you can manage saved schemas:

  • Sort the schema list: click the view's menu button to sort the list:

    1. Alphabetically (by schema name).

    2. By field count (starting with the schema that has the fewest fields, and ending by the schema with the most fields).

  • Add a schema:

    1. Either click the Add button in the view's toolbar, or right-click in the view and choose Add.

    2. In the Edit saved schema dialog, enter a schema name.

    3. Define each the schema's fields by using the toolbar Add or Remove buttons. Alternatively, use the Copy Schema wizard to add an existing schema, as described in Using Saved Schemas.

    4. Click OK to save the schema.

  • Modify a saved schema:

    1. Select the schema you want to change.

    2. Click the Edit button in the view's toolbar, or right-click in the view and choose Edit.

    3. In the Edit saved schema dialog, you can optionally change the schema name.

    4. In the Fields area, you can modify, add, or remove fields.

    5. Click OK to save the schema.

  • Remove a saved schema:

    1. Select the schema you want to remove.

    2. Click the Remove button in the view's toolbar, or right-click in the view and choose Remove.

  • Export a saved schema to your file system:

    1. Either click the Menu button in the view's toolbar and select Export, or right-click in the view and choose Export.

    2. In the StreamBase Export dialog, select the schemas you want to export.

      Note that you can expand and collapse schemas in the list to see their fields.

    3. Enter the path of the file you want to create.

    4. Click Finish.

    The file that is exported contains definitions for all the schemas you selected. The following example shows the code for a schema file that defines two schemas:

    <?xml version="1.0" encoding="UTF-8"?>
    <schemas>
        <schema name="Nasdaq100InSchema">
            <field name="Name" type="string" size="30"/>
            <field name="Symbol" type="string" size="5"/>
            <field name="Price" type="double"/>
            <field name="Color" type="string" size="8"/>
            <field name="Description" type="string" size="1024"/>
        </schema>
        <schema name="testSchema1">
            <field name="Name" type="string" size="30"/>
            <field name="Symbol" type="string" size="5"/>
            <field name="Price" type="double"/>
            <field name="Color" type="string" size="8"/>
            <field name="Description" type="string" size="1024"/>
        </schema>
    </schemas>
    
  • Import a schema from your file system. The schema file might have been exported from StreamBase Studio earlier, or it could have been edited in your file system. See the preceding import example for the XML syntax of a schema file.

    1. Either click the Menu button in the view's toolbar and select Import, or right-click in the view and choose Import.

    2. In the StreamBase Import dialog, click the Select button. In the Specify Source XML File dialog, navigate your file system to find and select the schema file you want to import. Click OK.

    3. The StreamBase Import dialog displays all the schemas defined in the selected XML file. Check the schema or schemas that you want to import.

    4. Click Finish. The selected schemas are added to your Saved Schema view.

Dragging and Dropping Schemas

You can drag a schema from the Saved Schemas view to:

  • The EventFlow canvas. In this case, StreamBase creates an Input Stream icon with its schema populated from the dragged schema.

  • Any schema table in StreamBase Studio, including those in a Schema or Edit Schema tab of the Properties view of an operator, data construct, stream, or adapter. This is a fast way to populate the schema for newly added components. If you drag a saved schema onto an already populated Schema tab, StreamBase prompts to confirm that you want to replace the existing schema with the dragged one.

  • Any application outside of Studio that is enabled to receive dragged text. For a Windows example, you can drag a schema to Notepad, in which case the XML representation of the schema is pasted into Notepad. For a Linux example, you can drag a schema to a Terminal window or an OpenOffice document.



[1] The displayed schema size is approximate because it is not always possible to give an exact size. For example: blob data types do not have a configured length and are not included in the size. String sizes are computed based on their declared maximum length, not the number of bytes actually used in memory. And null field types of any data type do not occupy the bytes allocated for them (that is, an integer field whose value is null occupies 0 bytes, not 4 bytes).