Application Metadata Adapter Overview - Integration - Update 44 - Customization & Programming - Hexagon

SmartPlant Integration Customization

Language
English
Product
Integration
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

If metadata originating from an application’s metadata store is to be used in conjunction with functionality supported by the Schema Editor/Schema Component, then a metadata adapter for that application must be written.

An application metadata adapter is a software class that implements the following interfaces:

  • IMetadataAdapter

  • IMetadataAdapterGUI

  • IInstructionsListener (required if transactional container, optional if non-transactional container that does not support disconnected mode, required if non-transactional container that supports disconnected mode)

  • ITransaction (required if transactional container, should not be realized for non-transactional container)

While there are a significant number of methods associated with these interfaces, most of them are either very simple or a standard implementation can be used for them.

Metadata adapters should enforce the rules of the application’s underlying data model. For example, if application users are not allowed to create or modify a particular type of object in the application’s metadata from inside the application, then the metadata adapter should restrict the creation or modification of that object type as well.

Basic Approach for Metadata Adapters

The basic approach used in conjunction with the metadata adapter is:

  • User identifies virtual directory for SmartPlant® Foundation. Schema Editor uses this information to come up with list of possible plants.

  • User selects plant to use. Schema Editor queries SmartPlant Foundation to get possible applications for plant and also to get schema file. Schema file is then parsed.

  • User identifies applications to be enabled (i.e., their metadata adapters are to be invoked) and whether those adapters are to be Connected or to work in disconnected mode. As part of this process the metadata adapter may be invoked and the SupportsDisconnectedMode property used to determine if the adapter supports working in a disconnected mode.

  • For each application identified as to be enabled, the SetToolParameters method is called and passed the parameters for that tool as well as the SmartPlant Foundation URL and the user-selected plant.

  • The SetActiveToolSchema method is called and passed the user-selected tool schema name. If no ToolSchema objects exist for this application in the schema, then the value passed will be "".

  • The AddMetaSchemaExtensions method is called and passed a container into which the metaschema extensions for the application should be added

  • The GetMapSchemaFile method is called to get the location of the map schema file. This file is then parsed and the container resulting from the parsing is passed to the metadata adapter via SetMapSchemaContainer.

  • The GetCompSchemaName method is called to get the component schema name corresponding to the map schema.

  • The SetTransactionManager method is called and passed the transaction manager used by the Schema Editor. The metadata adapter should register as a listener(s) from within this method. In addition any semantics for the metadata adapter should be added to the metaschema from within this method.

  • The Connect method on metadata adapter is called and passed a container into which the metadata adapter should create all the map schema objects based on the application’s metadata. This container will later be merged with the container housing the objects from the parsed map schema file.

  • Before synchronization is performed, GetSynchronizeOptions is called to get the default options to apply to the synchronization process.

  • The synchronization process is performed. The result of the synchronization process is two sets of instructions. One set includes the instructions to apply to the application metadata. The other set includes the instructions to apply to the parsed map schema. Each set of instructions is sent to the appropriate instructions listeners. An important note is that after synchronization is performed, all modifications will be made to objects in the container for the parsed map schema file and not to objects in the container for the generated (during Connect) map schema container

  • Once synchronization is completed, the user is free to make modifications as desired using the Schema Editor. Whenever a new map schema object is created, the GetUIDAndToolOIDForNewMapObject method for the appropriate metadata adaptor will be called.

  • When the session is completed, the Disconnect method will be called for every metadata adapter for which a previous Connect method was called.

  • For every metadata adapter invoked, the Terminate method will be called to allow that adapter to do whatever cleanup is required.