WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:Dynamic Import
Description:Imports spaces specified in a configuration resource.
Id:layer1.DynamicImport
Category:accessor prototype

Dynamic Import is an accessor that must be instantiated from a prototype. You must instantiate the prototype in your module to create an accessor that can receive requests.

Parameters

The layer1.DynamicImport prototype has the following initialisation parameters:

NameRulesTypingDefaultDescription
configMandatoryIdentifier or XML(none)
Configuration resource specifies which spaces are imported.
privateOptionalBooleanfalse
If included this parameter will mark the endpoint as private and it will not be exposed outside module.

Here is an auto-generated example of how to instantiate an instance of Dynamic Import:

<accessor>
  <prototype>layer1.DynamicImport</prototype>
  <config>Configuration resource specifies which spaces are imported.</config>
</accessor>
Import Requirements

To use Dynamic Import accessor prototype you must import the module urn:org:netkernel:ext:layer1:

<import>
  <uri>urn:org:netkernel:ext:layer1</uri>
</import>

The Dynamic Import endpoint provides a dynamic mechanism for importing the functionality from other spaces. This contrasts with the static import of a single space using the import endpoint which is built in to standard modules.

The dynamic import takes a config parameter which is SOURCEd as an XML document

<space>
  <endpoint>
    <prototype>DynamicImport</prototype>
    <config>
      <space>
        <uri>urn:org:netkernel:some:module:space</uri>
        <version>1.0.0</version>
      </space>
    </config>
  </endpoint>
</space>

Many space definitions may be provided within the configuration document. The version tag is optional - if omitted the default is the most recent version.

Service Driven Import

A common pattern within dynamic applications is to have pluggable application layers; for example data layers of styling layers. By referencing the identifier of a service in the Dynamic Import declaration it is possible to SOURCE the configuration from a service which reads which space to import from a database.

<space>
  <endpoint>
    <prototype>DynamicImport</prototype>
    <config>active:dataLayerImport</config>
  </endpoint>
</space>

Import Discovery

It is common to use the SimpleImportDiscovery accessor to discover imports using a push pattern.

Classloader implications

Because the Dynamic Import can change the spaces that it imports at runtime it is not possible for the classloaders from imported spaces to be incorporated into the importing spaces classloader. This limitation is due way Java implements class loading. If the Java classes from an imported space are needed it is necessary to use the regular (static) import endpoint.