You can import the following resources from another module into the current module:
The module imports feature allows you to re-use in the current module the constants and schemas defined in another module. In a large application, you can define commonly used schemas and constants in a central interface or module, and then import them as needed into other modules. This ensures that you define the schemas for streams and operators in the same way in all modules. If you edit the definition of a schema or if a constant changes in the central interface, those changes are automatically propagated into all modules that import that schema or constant.
The interface or module from which you can import schemas and constants must be in the current module's module search path. Thus, to be able to import schemas or constants from an interface or another module, use these steps to prepare the current module, A, to import from interface or module B:
-
If interface or module B is in a different Studio project, establish a project reference from project A to project B.
-
If interface or module B is in the same project but in a different folder than module A, make sure that folder is on module A's module search path.
-
Import the schemas or constants of interest into module A.
You import schemas and constants into a module in the same place you define them for
a module, which is the Definitions tab of the EventFlow Editor, or the Imports tab of
the Interface Editor. The following illustration shows the Definitions tab of a
module that imports resources from another module named SharedSchemas.sbapp
. The schemas imported from that module are
shown in the <Named Schemas> section of the upper
tree, in the Imported Schemas node.
Hover the mouse over an imported application or interface's name to show the path of the originating Studio project, rooted at the Studio workspace.
Note
If you import from a module and also include it as a reference site in a project, parameters at the reference site have no impact on the module at import time. That is, the imported module's parameters default to the parent's parameters.
In the Definitions tab of the EventFlow Editor, click the
button to launch the Edit Module Import dialog. To see the same dialog, you can also:-
Select an existing module name and click
. -
Click anywhere in the Manage Module Imports table, right-click, and select Add from the context menu.
-
Select an existing module name, right-click and select
from the context menu.
In the From drop-down list, select the module whose resources you want to import. If the drop-down list is empty, you must configure the module search path for the current module.
You can also use the Choose button to show you all modules in the module search path. Select a module and click OK.
When you have specified a module name, look through the importable items table. Make sure the module you specified actually contains the schemas or constants of interest.
Select the All importable items check box to import all
named schemas, table schemas, and constants from the selected module to the current
module. In the following example, the dialog is configured to import all importable
resources from SharedSchemas.sbapp
.
To specify a subset of the available resources, select the Selected importable items check box, then select one or more
schemas or constants in the table. In the following example, the dialog is configured
to import only four named schemas from SharedSchemas.sbapp
.
The Alias column shows the name that each imported schema or constant will have in the current module. The Alias column normally shows the same name for each item as in the Name column. Click to edit the default name in the Alias column, to specify another name for a schema or constant for use in the current module.
You can also choose to add a prefix or suffix to the incoming name, to help
distinguish imported schemas and constants from those natively defined in the current
module. If you specify a prefix, suffix, or both, those strings are added to the
names of all imported schemas and constants. You cannot specify a prefix or suffix
for a subset of imported items. For example, you can specify Shared_
in the Prefix field. In this
case, if StreamBase finds a named schema named NYSE_Feed
in the specified module, that schema is renamed as Shared_NYSE_Feed
in the current module.