tech.novosoft-us.com NS MDF                    
 
Novosoft MetaData Framework developer's guide

NSMDF contents

NSMDF consists from following components:

nsmdf.jar

This jar contans base classes for repository. To build it run ant with nsmdf_jar goal. Sources are in the nsmdf/src directory. This jar also contains an implementation of mof 1.4 metamodel using nsmdf classes. This library is mostly generated. Sources are in the nsmdf/mof directory and consits form MOF 1.3 model in XML form property file for generator and utility class.

nsmdf_gen.jar

This jar contains generator for nsmdf. It used nsmdf.jar and nsmof.jar that are in nsmdf/lib/mof. NSMDF uses latest relatively stable release nsmdf.jar and nsmof.jar. Before release this libraries are relpaced to latest ones. To build it run ant with nsmdf_gen_jar goal.

How to use nsmdf for custom metamodels in your projects.

An example project could be nsuml1_4. Its sources consist from metamodel and utility class. To build nsuml1_4.jar you will need to generate source code, compile it and utility class, then to build jar. Running build in nsuml1_4 project will do just these operations. You could use that project as template for your metadata projects.

How to create MOF model

There are several options for producing MOF models for you metadata. One of them to wirte mof models manually. XML is pretty high level, so while it is a bit tedious, it is still possible.

Other variant is to use Unisys XMI Bridge for Rational Rose 2000e, which is available as free download from rational.com (you will need rational rose installed). Please note that Unisys bridge uses other namspace for MOF, so you will need to fix namespace in saved MOF for XMI 1.1 and change it to xmlns:Model="omg.org/mof.Model/1.3".

Property file for generator

Before generation you will need to create property file that govern generation. Below is annotated property file for MOF.

#this option specfiy if interfaces need to be generated
interfaces.generate=true

#this options specify tagId used to get prefix for package
interfaces.package.tagId=org.omg.mof.idl_prefix

# this option should be repeated for each package and
# specify mapping from IDL name of package to java
# name in the generated code
interfaces.package.map.org.omg.mof.Model=ru.novosoft.mdf.mof.model

# this option specify prefix for generated interface names
interfaces.prefix=M
# this option sepcify suffix for generated interface names
interfaces.suffix=

#this option specfiy if implementation need to be generated
impl.generate=true

#this options specify tagId used to get prefix for package
impl.package.tagId=org.omg.mof.idl_prefix

# this option should be repeated for each package and
# specify mapping from IDL name of package to java
# name in the generated code
# it is recomended to specify package different form
# interface packages
impl.package.map.org.omg.mof.Model=ru.novosoft.mdf.mof.impl.model

# this option specify prefix for generated impl names
impl.prefix=MOF

# this option sepcify suffix for generated impl names
impl.suffix=Impl

# package where repository will be generated
impl.repository.package=ru.novosoft.mdf.mof.impl
# name of repository implmentation class
impl.repository.name=MOFRepositoryImpl
# mapping of prefix to real namespace URI that will be used
# in XMI 1.1 Readers/Writers
impl.xmi.namespace.map.Model=omg.org/mof.Model/1.3

Currently prefixes and suffixes are specified for for all generated classes. Later we plan more tuning options like prefix of suffixeds pecific to packages.

Working with XMI in NSMDF

Currently NSMDF support only XMI 1.1 in some limited form. Unit of saving to XMI and loading from XMI is the repository. Saving method correspond to saving by package extent. Simple program that load repository from xmi from stdin and saves it on stdout could be written as following:

  public static void main( String args[] )
  {
    try
    {
      Class c = Class.forName( args[0] );
      MDFOutermostPackage r = ( MDFOutermostPackage ) c.newInstance();
      r.getXMIReader("1.1").read( r, System.in );
      r.getXMIWriter("1.1").write( r, System.out );
    }
    catch ( Exception ex )
    {
      ex.printStackTrace();
    }
  }
Loading xmi to repository do not clean the repository before loading, all object that existed in the repository will continue to exists in it.

This document describe basics of working with repositories:

  Repository basics (4 K)

Feedback
 

 
Business utilities Backup to CD Handy Password manager Backup Office Documents RTF TO HTML, PDF, XML Web Site load, stress and perfomance testing