MDAC management services

 

Presentation

MDACs are packaged in a directory.  We recommend using the "$OBJING_PATH/mdastore/<MDACName>" directory for a <MDACName> MDAC.

 

In this directory, there will be an MDAC externalization file, containing the necessary J instructions, stereotype definitions, command definitions, and so on.  In addition, there frequently exist additional scripts and resources, such as bitmaps, help files, binaries, ….

 

When an MDAC is deployed, configuration operations (used to prepare scripts or binaries, or to properly define an adapted directory structure) may be necessary.

 

A well packaged MDAC will carry out these operations, by writing predefined J methods defined hereafter.

 

These methods will be automatically triggered during the deployment and removal operations.

 

 

MDAC management services

boolean Object:select()

This service is called after an MDAC is deployed.  It is also called for its parent MDACs, even if these are masked by the child MDAC.

 

boolean Object:unselect()

This service is called after an MDAC is removed.

 

boolean Object:upgrade

(oldVersion : String,

listParameterValue : SetOfProperty)

This service is called either:

·         after an MDAC is deployed for the first time in Objecteering Modeler, if the same version of the MDAC is not already present in the database.

·         after an MDAC is upgraded, more precisely after a new version of an MDAC already present in the database is being selected for the first time.  Please note that the code of this operation should not assume that the MDAC has already been selected.

 

A default method exists, which takes the values of the parameters of the former MDAC and re-affects them to the parameters of the new MDAC.

 

boolean Object:uninstall()

This service is called after an MDAC is removed.  When an MDAC is removed, it is not uninstalled from the database. 

 

boolean Object:init()

This service is called after an MDAC is deployed on a site.

 

There is no equivalent "un-initialization" operation when a MDAC is deleted from a site.

 

boolean Object:start()

This service is called for each selected MDAC (and its parent MDACs) when a project is loaded.  It is not called when a new MDAC is deployed.

 

boolean Object:stop()

This service is called for each selected MDAC (and its parent MDACs) when a project is unloaded.  It is not called when a MDAC is removed.

 

Package Object:getTypesPackage

(String pPackageName);

This service is used to obtain the "pPackageName" types package.  This types package is first searched for in the current test project, before being searched for in the "_predefinedTypes" project, where necessary.

 

Void Object:deleteTypesPackage

(String pPackageName);

This service is used to delete the "pPackageName" types package from the "_predefinedTypes" project.

 

Void Object:internalizePackage(String pDir,

String pPackageName);

This service is used to internalize an externalized package file.  The file name which has the <pPackageName>.ext pDir form contains this file.

 

Void Object:internalizeTypesPackage

(String pPackageName);

This service is used to internalize a types package called "pPackageName" in the test project, or, by default, in the "_predefinedTypes" project.

 

 

Example

This quick example illustrates the installation of a MDAC.

 

boolean Object:default#external#Code#MyGen#install ()

{

  StdOut.write("Deployment of the MyGen MDAC", NL);

  return(true);

}

 

boolean Object:default#external#Code#MyGen#uninstall ()

{

  StdOut.write("Removal of the MyGen MDAC", NL);

  return(false);

}

 

 

Getting MDAC parameter values

Within an MDAC, parameter values are used for adapting MDAC behavior.  These values can be accessed from J.

boolean Object:getCurrentModuleParameterValue

               (in String name,

                in String profile,

                out String value)

 

boolean Object:getParameterValue

               (in String name,

                in String profile,

                in String module,

                out String value)

 

These two services return in "value" the value of the "name" parameter defined in the "profile" profile (of the current MDAC for the first service).

·         If the profile is incorrect in MDA Modeler mode, they return false, and a warning appears.

·         If the profile is incorrect in Objecteering Modeler mode, they return false.

·         If the parameter and the environment variable of the same name are non-existent, in MDA Modeler mode, they return true, and a warning appears.

·         If the parameter and the environment variable of the same name are non-existent, in Objecteering Modeler mode, they return true.

 

To quickly and easily retrieve the value of a given MDAC parameter, the following operation can be carried out:

 

String value = #MyMDAC#MyParameter;

 

where "MyParameter" is the parameter whose value is to be retrieved and "MyMDAC" is the MDAC to which the "MyParameter" parameter belongs.

 

boolean Object:moduleParameterExists

               (in String pParamName,

                in String pProfileName,

                in String pModuleName)

This returns false if the parameter does not exist for the given MDAC and profile.  Otherwise, it returns true.

 

boolean Object:currentModuleParameterExists

(in String pParamName, in String pProfileName)

This returns false if the parameter does not exist for the given profile.  Otherwise, it returns true.

 

 

Setting MDAC parameter values

Within an MDAC, parameter values are used for adapting MDAC behavior.  These values can be set from J.

 

To quickly and easily set the value of a given MDAC parameter, the following operation can be carried out:

 

#MyMDAC#setMyParameter (value);

 

where "MyParameter" is the parameter whose value is to be set and "MyMDAC" is the MDAC to which the "MyParameter" parameter belongs.

 

 

Retrieving the resources directory of the current MDAC

The following two services are used to retrieve the directory where the current MDAC's resources are located.  The current MDAC is the MDAC which has run the command.  This directory can be located either on a local machine in the case of a stand-alone or client directory, or on the server.

 

string getCurrentModuleDirectory()

This returns the MDAC's root directory.

 

Example:

String res = getCurrentModuleDirectory();

// res equals "C:\Program Files\Objecteering\mdastore\

               JavaDeveloper\4.0.a"

 

 

string getCurrentModuleSubDirectory

             (in string directory)

This returns the "directory" sub-directory.

 

Example:

String res = getCurrentModuleSubDirectory ("res");

// res equals "C:\Program Files\Objecteering\mdastore\

               JavaDeveloper\4.0.a \res"