3D PLM PPR Hub Open Gateway |
PDM Object Hub |
Building ComponentsHow to build an Express schema, user functions for Express-X mapping, and an Express-X mapping schema |
Use Case |
This task will introduce the various building components and you will learn how to build:
First of all, you have to create your file tree. A file Tree has several fixed levels of directories.
![]() |
At the first level of your workspace (MyWorkspace in our example) we find directories corresponding to components. These components are called frameworks. The example below shows a framework (MyFramework) containing the basic V5 architecture, i.e. the IdentityCard and ProtectedInterfaces directories. |
Even if the file tree shows a flat view of the frameworks, there are relationships between them. Different relationships exist but they have quite the same meaning, that is to say that a given framework uses the resources exported by one or more other frameworks. Those frameworks are called prerequisites.
Such relationships are expressed in a special file called the IdentityCard.h file. Any framework - whatever its type is (code, education, test) - must provide an IdentityCard file in which it defines its prerequisite frameworks. The IdentityCard file is the privileged (and unique) place where the relationships between a framework and its prerequisites are expressed: this is a convenient way for users and tools to have a knowledge of an application architecture.
A framework being a component, it is not supposed to expose all of its resources to its clients, but only the minimum. This contributes to maintain the system modular and understandable.
By the way, the file tree defines several directories whose purpose is to gather the public part of any component, resources are made public through an "interface". Several interfaces can be exposed by one framework.
The different directories we can found under a framework correspond to different scopes of resources:
Framework interfaces can be implemented in several types of files/languages:
[Top]
In our example, this schema will be called MySchema.
AddPrereqComponent("SDMRuntime", Protected); AddPrereqComponent("VPMServices", Protected);
mkInit
mkGetPreq
BUILT_OBJECT_TYPE=SHARED LIBRARY ############### OS = COMMON ############### PROGRAM_NAME = LOCAL_CKMFLAGS= -gLate
#include "CATSchemaMacro.h" LoadSchemaDico (MySchema);
Private
mkmk -au
[Top]
Mapping may use user functions. These functions must be defined as follows:
BUILT_OBJECT_TYPE = SHARED LIBRARY ############# OS = COMMON ############# LINK_WITH= KS0LATE KS0SMPL LOCAL_CKMFLAGS= -gLate
#ifndef My_UserFcts_H #define My_UserFcts_H #ifdef _WINDOWS_SOURCE #ifdef __My_UserFcts #define ExportedByMy_UserFcts __declspec(dllexport) #else #define ExportedByMy_UserFcts __declspec(dllimport) #endif #else #define ExportedByMy_UserFcts #endif ExportedByMy_UserFcts SdaiPrimitiveH Fct_1.cpp(const SdaiPrimitiveH& Param1, const SdaiPrimitiveH& Param2); ExportedByMy_UserFcts SdaiPrimitiveH Fct_2.cpp(const SdaiPrimitiveH& Param1); #endif
mkmk -au
[Top]
In our example, this schema will be called My_MAPPING.
AddPrereqComponent("SDMExpressX", Protected);
mkGetPreq -p path_directory where frameworks are stored
mkmk -au
The Express schemas that will be mapped using Express-X mapping must have been previously built (see above paragraph).
If you want to build a mapping schema called My_MAPPING that maps the My_SCHEMA_1 and My_SCHEMA_2 schemas, the architecture will be the following one:
BUILT_OBJECT_TYPE = SHARED LIBRARY ############# OS = COMMON LINK_WITH = KS0LATE KS0SIMPL KS0EXXMAP My_UserFcts LOCAL_CKMFLAGS= -gLate
mkmk -au
At this step, the mapping can be compiled but it will not be usable with the Import / Export / Migration platform. Because the tool calls the mapping dynamically, this mapping has to be seen as a Mapper. In other terms, it must adhere to the “VPMIExMapper” interface. Therefore an implementation of the interface has to be written to be able to use the mapping.
In this directory create a new file called ds_MyMapping.h and write the following lines inside (do not forget to change MyMapping with your real name):
#ifndef ds_MyMapping_H #define ds_MyMapping_H #include "CATBaseUnknown.h" #include "CATIContainer.h" #include "StdMapper.h" class ds_MyMapping : public StdMapper { CATDeclareClass; public: ds_MyMapping(); ~ds_MyMapping(); //-------------------------------- // Implementation for VPMIExMapper //-------------------------------- HRESULT Convert(const CATIContainer_var& fromContner, const CATIContainer_var& toContner); }; #endif
#include <iostream.h> #include "ds_MyMapping.h" CATImplementClass(ds_MyMapping, DataExtension, StdMapper, MyMapping); ds_MyMapping::ds_MyMapping() { } ds_MyMapping::ds_MyMapping() { } #include "TIE_VPMIExMapper.h" TIE_VPMIExMapper(ds_MyMapping); //============================================================== // Data Mapping //============================================================== HRESULT ds_MyMapping::Convert(const CATIContainer_var& fromContner, const CATIContainer_var& toContner) { HRESULT Stone = S_OK; CATUnicodeString TheMappingName((this->GetImpl())->IsA()); //------------- // Data mapping //------------- Stone = ((StdMapper*)this)->Convert(fromContner, toContner, TheMappingName); return Stone; }
To build this code, you need to add the following prerequisites:
LINK_WITH = GUIDVPMSTEPExchanges \ JS0GROUP \ ENOVSTEPTools
AddPrereqComponent("VPMDataMigration", Protected); AddPrereqComponent("VPMSTEPExchanges", Protected);
Now the module MyMapping.m can be built: mkmk –u under the module.
MyMapping is the late type given for this implementation. It will enable a dynamic loading of the mapping for the run-time.
MkGetPreq –p /thePath_where_the_frame_wokrs_are_stored
It has to be previously declared in the Dictionary:
MyMapping VPMIExMapper libMyMapping
In order to take MyFramework.dico into account, do not forget to export the variable in the runtime environment:
Export CATDictionaryPath=/…/MyWorkspace/MyFramework/CNext/code/dictionary:$CATDictionaryPath
A Unix shell is provided to generate the ds_MyMapping files: EV5_EXGener.sh
(–h
to display the parameters).
Copyright © 1994-2002, Dassault Systèmes. All rights reserved.