我正在研究 IBM RTC Advisors,基于http://jazz.net中提供的 Workshop 。
现在我正在尝试将他们的 OSGi 模块中提供的 xsd 文档移植到 annotations+jaxb。
这是 XSD 的一部分:
<xsd:element name="followup-action" substitutionGroup="process:followup-action"
type="buildOnStateChangeType"/>
<xsd:complexType name="buildOnStateChangeType">
<xsd:annotation>
<xsd:documentation>
This type defines the build on state change type. It is a
subtype of the abstract process:followupActionType. This
restriction, along with the substitutionGroup specification
above, makes it possible to add configuration of the participant
to a project or team area's process configuration. Note the
forward references to the trigger and build types defined below.
Take particular note of the id attribute. It is required and has
a fixed value that points to our operation participant extension.
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:restriction base="process:followupActionType">
<xsd:all>
<xsd:element name="trigger" type="triggerType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="build" type="buildType" minOccurs="1"
maxOccurs="1"/>
</xsd:all>
<xsd:attribute name="id" type="xsd:string" use="required"
fixed="net.jazz.rtcext.workitem.extensions.service.buildOnStateChange"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="triggerType">
<xsd:annotation>
<xsd:documentation>
This type defines the work item type to be monitored
and the work item state that should trigger the
operation participant.
</xsd:documentation>
</xsd:annotation>
<xsd:all>
<xsd:element name="changed-workitem-type" minOccurs="1"
maxOccurs="1">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"
use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="trigger-state" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"
use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="buildType">
<xsd:annotation>
<xsd:documentation>
This type defines the build to run. At this point, it just
includes the build definition id. In the future, it could
include more information, for example, a list of properties
to pass to the build.
</xsd:documentation>
</xsd:annotation>
<xsd:all>
<xsd:element name="build-definition" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"
use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
这是来自流程模板的 XML 的一部分:
<followup-action
xmlns="http://net.jazz.rtcext.workitem.extensions.service/server/buildOnStateChange"
description="When the specified work item type changes to the specified state, the
specified build will be requested."
id="net.jazz.rtcext.workitem.extensions.service.buildOnStateChange"
name="Build on State Change">
<trigger>
<changed-workitem-type id="com.ibm.team.apt.workItemType.story"/>
<trigger-state id="com.ibm.team.apt.story.tested"/>
</trigger>
<build>
<build-definition id="our.integration.build.bogus"/>
</build>
</followup-action>
我的问题是,将 XSD 移植到带有 JAXB 注释的 Java 类的最佳方法是什么?我尝试使用 Eclipse (Luna) JAXB 支持进行逆向工程。
来源:https ://jazz.net/library/article/1000
谢谢