ArchStudio xArch/xADL Tools:
Apigen

Apigen

Apigen is an XML schema-to-Java data binding generator for xArch schemas that automatically generates data binding libraries for XML schema. It supports a large subset of the XML schema language.

Apigen has been incorporated into ArchStudio and is used to generate the data binding libraries (DBLs) for the core xADL schema. Below are instructions for using Apigen on your own xADL schema.

1. Install ArchStudio

Apigen is a part of the default ArchStudio installation. Thus, the first step is to install ArchStudio using the instructions on the ArchStudio site.

2. Create an Eclipse Plug-in

In ArchStudio, schema are housed in individual Eclipse plug-ins. Apigen automatically generates data binding libraries for the schema housed in these plugins. The following steps create an Eclipse plug-in:

  1. Go to File | New | Other ...
  2. Select "Plug-in Project"
  3. Click Next
  4. Enter a name for your project
  5. Click Next
  6. Under Options, unselect "Generate an activator, ..."
  7. Under Options, unselect "This plug-in will make contributions to the UI"
  8. Click Finish
  9. If an "Open Associated Perspective" dialog box appears, click Yes

The result will be a new plug-in of the specified name in your Eclipse workspace.

3. Enable the Generation of xADL Data Binding Libraries

We now need to inform ArchStudio that it should generate xADL data binding libraries for the schema in your project. To do so:

  1. Right click on the project you just created, select ArchStudio, and check "Generate xADL 3 Schema DBLs".
  2. When the warning message appears, click OK

After doing this, a "model" folder will appear in your project. Place your xADL schema in this folder. This folder will be scanned for XML schema files and those files will be automatically converted to a data binding library in the project's src folder.

4. Create your Schema

A tutorial on creating individual schema is beyond the scope of this document, but there are many resources available to help you. In particular, you may wish to browse the core xADL projects for schema examples. All ArchStudio projects with "xadl3" in their name have schema in their "model" folder that can serve as an example. For instance, take a look at the core structure schema project in the source repository.

If ArchStudio is unable to convert the schema to a data binding library due to an error in the schema, it will create an entry in the Eclipse Problems view with details of th error. This view can be accessed through the Window | Show View... menu.

When the schema are successfully transformed, the resulting data binding library will be in the src folder of your plug-in.

4a. Schema Tips

Official xADL schema adhere to the following guidelines (with examples shown from the structure-3.0.xsd schema):
  • They import the ECore schema:
     xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
  • The major and minor version numbers are included in the name:
     xmlns="http://www.archstudio.org/xadl3/schemas/structure-3.0.xsd"
  • ... and in the package declaration:
     ecore:package="org.archstudio.xadl3.structure_3_0"
  • ... and in the namespace prefix:
     ecore:nsPrefix="structure_3_0"
  • Elements include the core extension point:
     <xs:element name="ext" type="core:Extension" minOccurs="0" maxOccurs="unbounded"/>
  • Links indicate the expected destination type:
     <xs:element name="innerStructureLink" type="xs:IDREF" ecore:reference="Structure"/>

For an example of a schema that includes all of these features, see the structure-3.0 schema.

Common Problems

If the schema translates into a data binding library, but the data binding library does not compile correctly, make sure that:

  • any dependent schema are imported into your schema using a standard <xs:import ...> tag, and
  • your plug-in must depend on the plug-ins that hold the dependent schema

For example, the structure-3.0 schema imports the xadlcore-3.0 schema and its plug-in depends on the org.archstudio.xadl3.xadlcore plug-in, which contains the xadlcore-3.0 schema.

Contact Us

If you have questions not answered by this website, please feel free to contact the software architectures group at UC Irvine through the ArchStudio developer's (mailman protected) email list at: archstudio-dev [@] uci [.] edu.

Portions of this site Copyright © The Regents of the University of California. All Rights Reserved Worldwide. The development of ArchStudio was initially funded by the DARPA DASADA (Dynamic Assembly for Systems Adaptability, Dependability, and Assurance) program. The site now includes results from projects supported in part by National Science Foundation grants IIS-0205724 and CCF-0430066, The Boeing Company, and IBM.