FeaturesPluginsDocs & SupportCommunityPartners

MDR XML Module

Content:

Introduction

MDR XML Module is a sample how to build module which uses Metadata Repository for storing and manipulation with metadata.

Building MDR XML Module

Before building MDR XML module you have to build naming and looks modules. To build naming run ant in the nb_all/core/naming directory. To build looks run ant in the nb_all/openidex/looks directory. When the naming ant looks are successfully built you can build MDR XML module itself by running ant in the nb_all/mdr/samples/xml directory. To build NBM run ant with argument nbm.

Downloading MDR XML Module

The MDR XML Module as well as modules on which it depends can be downloaded by standard NetBeans autoupdate mechanism from the NetBeans alpha autoupdate site..

Installing MDR XML Module

To use XML MDR module you have to install naming, looks and mdrexplorer modules, (see MDR Explorer).

Using MDR XML Module

The MDR XML module adds Fill MDRepository action into XML DataObject's Tools menu. This action parses the current XML file and stores its content into Metadata Repository. The content of the Metadata Repository can be viewed and modified using MDR Explorer (View/MDR Browser) by setting XML Model View on org.netbeans.xmlmodel packageproxy.

XML Model View

XML Model Look

The XML Look offers following types of nodes:

  1. Root Element Node represents a document root, with document name and element name properties. This nodes provides these actions:
    • Generate XML, creates XML document from model.
    • New, creates new Text, Attribute or Element Node.
    • Delete, deletes whole document.
  2. Element Node represents a XML element, with element name property and provides these actions:
    • Generate XML, creates XML document from current element.
    • New, creates new Text, Attribute or Element Node.
    • Delete, deletes current element and all its sub nodes.
  3. Text Node Represents a text element in the XML document and provides name property and delete action.
  4. Attribute NodeRepresents an attribute of XML element and provides name and value property. It also provides delete action, which removes this attribute from element node.

XML Metamodel

XML Metamodel

Structure of Module

The MDR XML module consist of the following main parts:
org/netbeans/modules/mdrxml/looks/* This package contains looks for each model element pictured on XML Metamodel Figure and XMLNamespaceLook (described bellow).
org/netbeans/modules/mdrxml/looks/actions/* This package contains actions provided by looks (Generate XML, Delete, New) and related GUI.
org/netbeans/modules/mdrxml/resources/mdrxml-layer.xml This XML document contains definition of looks and their association with data type of represented object. The new namespace look is registered in default namespace (Looks/Types/) for all MDRXML model elements, to avoid mixing of looks. Then in the newly created namespace (Looks/XMLModel) looks for each model element are registered.
org/netbeans/modules/mdrxml/util/* Contains implementation specific classes.
org/netbeans/modules/mdrxml/MDRXMLModule.java ModuleInstall of MDRXML module which installXML method creates MOF extent, loads into it XML metamodel and instantiates it.
org/netbeans/modules/mdrxml/FillRepositoryAction.java This file contains Action, which starts the XML Parser on selected XML file, as well as the parser implementation itself. The parser is responsible for creating MDRXML model elements for the corresponding XML file elements.

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Open ESB - The Open Enterprise Service Bus Powered by