XAM AutoGen Update
Thanks for all your feedback. A newer version (v0.2) of the XAM AutoGen Tool is now available. (You can find the original post here.)
This updated version contains the following enhancements and bug fixes:
-
Extension domain support is added. Now you can define one or more extension domains in your data model file, where each domain corresponds to
a different namespace. For each extension domain, you can define elements, enum types and attributes just like the base domain. You can specify a different output directory for each extension domain if you want.
- Support elements with text content.
- Support attributes/elements/enumTypes with characters like "-".
-
Support 1:n mapping between element and domain component classes.
- Better JavaDoc, import organization, etc.
- Fixed ChildComponentUpdateVisitor. This should fix the multi-view synchronization issue.
- Fixed ElementFactory META-INF registration
Here is a list of changes in the meta schema:
- The "virtual" attribute for the "Element" element has been renamed to "abstract" to avoid confusion.
- The string type "multiplicity" attribute for the "ChildElement" element has been changed to a boolean type attribute called "multiple".
The default value has been changed to "false" now.
- A new "hasText" attribute is added to the "Element" element to indicate whether the element has text content. The default value is "false".
- A new "elementName" attribute is added to the "Element" element. By default, "elementName" has the same value as "name". You only need to specify a different "elementName" value when one element corresponds to multiple types. This is not common. See here for an example.
Here is a list of changes in the config file:
- The output directory is now specified in the config file ("outputDir") instead of from the command line.
- A new optional property "extensionDomainModelNames" is added to define a comma-separated list of extension domains.
- For each extension domain XXX, its corresponding "namespaceURI.XXX", "modelPackage.XXX" and "outputDir.XXX" needs to be defined.
The packaged demo domain has been updated to reflect those changes. The following shows the updated config file for the demo domain: (The changes are highlighted.)
# XML file describing the domain data model. This is basically a simplified
# schema for the model.
domainDataModelFile=DemoDataModel.xml
# Name of the domain model, such as "WSDL", "Schema", "SCA", etc.
domainModelName=Foo
# Names of the extension domains (delimited by ";")
extensionDomainModelNames=Bar
# Namespace URI for the base domain
namespaceURI=http://www.yourorg.org/xmlns/foo/1.0
# Namespace URIs for the extension domains
namespaceURI.Bar=http://www.yourorg.org/xmlns/bar/1.0
# Package name for the base model classes
modelPackage=org.yourorg.foo.model
# Package name for the extension domain model classes
modelPackage.Bar=org.yourorg.bar.model
# Output directory for the base domain
outputDir=C:/opt/MyTools/XAMGeneratorDemoOutput/src
# Output directory for the extension domain
outputDir.Bar=C:/opt/MyTools/XAMGeneratorDemoOutput/src
# Header file (relative to the config directory) to be included in all the
# generated Java files. You could put your license here.
headerFile=Header.txt
author=jqian
The following is the new version of the demo domain description file showing the extension domain usages:
<?xml version="1.0" encoding="UTF-8"?>
<Content xmlns="http://xml.netbeans.org/schema/xamgen"
targetNamespace="http://www.yourorg.org/xmlns/foo/1.0"
xmlns:bar="http://www.yourorg.org/xmlns/bar/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xml.netbeans.org/schema/xamgen xamgen.xsd">
...
<Element name="interface" abstract="true"/>
<Element name="bar:interface.wsdl" className="InterfaceWSDL" base="interface">
<Attribute name="location" type="URI"/>
<Attribute name="bar:anAttributeInTheBarNamespace" type="String"/>
</Element>
<Element name="bar:anotherElementInTheBarNamespace" base="bar:interface.wsdl">
</Element>
<EnumType name="bar:SomeEnumType">
<Enumeration value="yes"/>
<Enumeration value="no"/>
</EnumType>
</Content>
The following shows the classes generated for the extension domain "
http://www.yourorg.org/xmlns/bar/1.0".

Posted at
01:53AM Sep 15, 2008
by Jun Qian in NetBeans |