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:
- Go to File | New | Other ...
- Select "Plug-in Project"
- Click Next
- Enter a name for your project
- Click Next
- Under Options, unselect "Generate an activator, ..."
- Under Options, unselect "This plug-in will make contributions to the UI"
- Click Finish
- 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:
- Right click on the project you just created, select ArchStudio, and check "Generate xADL 3 Schema DBLs".
- 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 TipsOfficial xADL schema adhere to the following guidelines (with examples shown from the structure-3.0.xsd schema):
- They import the ECore schema:
- The major and minor version numbers are included in the name:
- ... and in the package declaration:
- ... and in the namespace prefix:
- 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.
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.
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