![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
The SDK metadata classes form the basis for model-driven computing with an adapter. Metadata is, by definition, data about data. Metadata isolates the data description from the application data itself.In regards to the SDK, metadata is data describing the data the custom adapter deals with. For example, for a custom adapter that extracts data from a database and publishes it to TIBCO Rendezvous, the metadata would describe the database data to be extracted.
If several applications handle the same data, a specification document must exist that defines exactly how the data is implemented. Each time the specification document changes, all applications dependent on it must change as well.Instead of a specification document, developers can use metadata to describe the application data. The metadata is used in a similar fashion to a hardcopy document, however, applications can access metadata automatically and don’t have to manually update data descriptions.Well-designed metadata makes it possible to have an adapter with the same behavior under different circumstances. If data definitions in the source or target application change, you change the metadata that describes the data instead of changing the custom adapter code and recompiling. In addition, standardizing on metadata provides interoperability among TIBCO ActiveEnterprise components.Custom adapter developers specify the metadata hierarchy in TIBCO Designer and save them as part of the project repository. Metadata is useful in several ways:
• Metadata describe the data model (schema) for the custom adapter. When the data model of the source or target application changes, you do not have to rewrite the adapter. Instead, you change the metadata objects.
• By changing the metadata you can change which data the custom adapter publishes or subscribes to. It is therefore possible to use the same adapter code with different sets of metadata residing in different directories in different project repositories.
• Metadata encapsulates the data themselves as classes and the relationships between classes as associations. Much of the information in the source data can therefore be preserved.Custom adapters create instances of the MInstance class based on metadata information. The SDK serializes the MInstance objects when they are send out so they become instances of MTree. On the wire, data is always in MTree format.Figure 15 Metadata Creation and Usage Overview
• Defining Metadata Classes. At design-time, metadata is either defined using TIBCO Designer or by extracting information about the data the adapter works with from the target application. For data extraction, you need to write a schema tool that extracts the data from the source application and places it in the repository. Developers can also edit an AEXML file.
• Creating Classes Based on Metadata Objects. The SDK creates instances of subclasses of MModeledClassDescription to describe the metadata and stores it with MClassRegistry. By default, this happens when the custom adapter starts.
• Creating Runtime Data. At runtime, the adapter creates instances (MInstance) as defined by the metadata and populates the MInstance attributes with actual object data from the target application for publishing or responding to request-response invocations. On the receiving side, a subscriber adapter converts the incoming message back to an instance through deserialization, which also validates the message against metadata definition.Figure 16 Metadata Runtime ImplementationTIBCO Adapter SDK provides the following two types of MInstance implementations in C++ SDK:
• MInstanceMapImpl: This implementation is the same as the MInstanceImpl in previous releases. It adopts hash tables to improve the access performance, but consumes more memory. MInstanceMapImpl is the default implementation.
• MInstanceListImpl: This implementation consumes less memory, however, the access performance degrades slightly compared with the MInstanceMapImpl implementation.The MInstanceListImpl implementation is suitable for the following scenarios:
• The total number of attributes in MInstance is less than 50.
• For a Request-Response Service, the adapter can use the method void setInstanceImpl(MInstanceImplSelector impl), provided in MRpcServer, to choose an MInstance implementation.For a Request-Response Invocation Service, the adapter can assign an instance implementation to the constructors of class MOperationRequest.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |