jbxb_1_0.xsd 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xs:schema version="1.0beta"
  3. attributeFormDefault="unqualified"
  4. elementFormDefault="qualified"
  5. xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
  6. xmlns:xs="http://www.w3.org/2001/XMLSchema">
  7. <xs:annotation>
  8. <xs:documentation>The JBossXB schema customization
  9. elements</xs:documentation>
  10. </xs:annotation>
  11. <xs:element name="schemaBindings">
  12. <xs:annotation>
  13. <xs:documentation>This element defines default bindings for the
  14. schema</xs:documentation>
  15. </xs:annotation>
  16. <xs:complexType>
  17. <!-- The child elements can be selected in any order. -->
  18. <xs:choice maxOccurs="unbounded" minOccurs="1">
  19. <xs:element maxOccurs="1" minOccurs="0" ref="jbxb:package"/>
  20. <xs:element name="ignoreUnresolvedFieldOrClass" type="xs:boolean" default="true"
  21. maxOccurs="1" minOccurs="0">
  22. <xs:annotation>
  23. <xs:documentation>The ignoreUnresolvedFieldOrClass specifies the behavior the parser chooses
  24. when a field is not found in the parent class for a child value, or when an element does not have
  25. any class assignement. If false, an exception will be thrown when either situation is encountered.
  26. If true, the missing mapping is ignored and the parse continues.
  27. </xs:documentation>
  28. </xs:annotation>
  29. </xs:element>
  30. <xs:element name="replacePropertyRefs" type="xs:boolean" default="true"
  31. maxOccurs="1" minOccurs="0">
  32. <xs:annotation>
  33. <xs:documentation>The replacePropertyRefs flag indicates whether the
  34. text content of values has ${x} system property references replaced
  35. during parsing. The default is true.
  36. </xs:documentation>
  37. </xs:annotation>
  38. </xs:element>
  39. </xs:choice>
  40. </xs:complexType>
  41. </xs:element>
  42. <xs:element name="package" type="xs:NCName">
  43. <xs:annotation>
  44. <xs:documentation> Defines the default package for the schema which
  45. is used for searching classes when unmarshalling elements of
  46. complex types. If jbxb:package is not present, schema's
  47. namespace URI will be used as the base to generate the default
  48. package name for the schema (the mapping is defined in JAXB2.0
  49. spec D.5.1 Mapping from a Namespace URI). Example: <![CDATA[
  50. <xsd:annotation>
  51. <xsd:appinfo>
  52. <jbxb:schema>
  53. <jbxb:package name="org.jboss.test.xml.pojoserver.metadata"/>
  54. </jbxb:schema>
  55. </xsd:appinfo>
  56. </xsd:annotation>
  57. ]]></xs:documentation>
  58. </xs:annotation>
  59. </xs:element>
  60. <xs:element name="characters">
  61. <xs:annotation>
  62. <xs:documentation> Binds text content of complex types. This element
  63. is just a container for jbxb:value, jbxb:property,
  64. jbxb:mapEntryKey, jbxb:mapEntryValue elements, all of them are
  65. optional. This element can only appear inside complex type
  66. definitions. Example: <![CDATA[
  67. <xsd:complexType name="namedValueType" mixed="true">
  68. <xsd:annotation>
  69. <xsd:appinfo>
  70. <jbxb:class impl="org.jboss.test.xml.pojoserver.metadata.AbstractPropertyMetaData"/>
  71. <jbxb:characters>
  72. <jbxb:property name="value"/>
  73. <jbxb:value unmarshalMethod="org.jboss.test.xml.pojoserver.metadata.DataTypeConverter.unmarshalStringValue"/>
  74. </jbxb:characters>
  75. </xsd:appinfo>
  76. </xsd:annotation>
  77. <xsd:complexContent>
  78. ...
  79. </xsd:complexContent>
  80. </xsd:complexType>
  81. ]]></xs:documentation>
  82. </xs:annotation>
  83. <xs:complexType>
  84. <xs:choice>
  85. <xs:element ref="jbxb:property"/>
  86. <xs:element ref="jbxb:value"/>
  87. <xs:element ref="jbxb:mapEntryKey"/>
  88. <xs:element ref="jbxb:mapEntryValue"/>
  89. </xs:choice>
  90. </xs:complexType>
  91. </xs:element>
  92. <xs:element name="class" type="xs:NCName">
  93. <xs:annotation>
  94. <xs:documentation> Binds XML element or complex type to a Java class
  95. which is specified as a value of attribute 'impl'. If jbxb:class
  96. is used inside complex type definition, all elements of this
  97. complex type will be unmarshalled into the specified Java type
  98. unless there is overriding jbxb:class in an element declaration.
  99. Example: <![CDATA[
  100. <xsd:complexType name="deploymentType">
  101. <xsd:annotation>
  102. <xsd:appinfo>
  103. <jbxb:class impl="org.jboss.test.xml.pojoserver.deployment.AbstractKernelDeployment"/>
  104. </xsd:appinfo>
  105. </xsd:annotation>
  106. <xsd:sequence>
  107. ...
  108. </xsd:sequence>
  109. </xsd:complexType>
  110. <xsd:element name="list" type="listType">
  111. <xsd:annotation>
  112. <xsd:appinfo>
  113. <jbxb:class impl="org.jboss.test.xml.pojoserver.metadata.AbstractListMetaData"/>
  114. </xsd:appinfo>
  115. </xsd:annotation>
  116. </xsd:element>
  117. ]]></xs:documentation>
  118. </xs:annotation>
  119. <xs:complexType>
  120. <xs:attribute name="impl" type="xs:NCName" use="required"/>
  121. </xs:complexType>
  122. </xs:element>
  123. <xs:element name="property">
  124. <xs:annotation>
  125. <xs:documentation> Binds an element to property/field in a class.
  126. This element can appear inside an element definition or inside
  127. jbxb:characters. If jbxb:property is not specified for an
  128. element, the property name is resolved based on the element's
  129. name using "D.2 The Name to Identifier Mapping Algorithm"
  130. defined in JAXB2.0 spec. Example: <![CDATA[
  131. <xsd:element name="list" type="listType">
  132. <xsd:annotation>
  133. <xsd:appinfo>
  134. <jbxb:property name="value"/>
  135. <jbxb:class impl="org.jboss.test.xml.pojoserver.metadata.AbstractListMetaData"/>
  136. </xsd:appinfo>
  137. </xsd:annotation>
  138. </xsd:element>
  139. ]]></xs:documentation>
  140. </xs:annotation>
  141. <xs:complexType>
  142. <xs:attribute name="name" type="xs:NCName" use="required"/>
  143. </xs:complexType>
  144. </xs:element>
  145. <xs:element name="value">
  146. <xs:annotation>
  147. <xs:documentation> Binds text value (attribute value or text
  148. content) to a Java value. There are two attributes:
  149. unmarshalMethod which specfies a public static method that is
  150. used to unmarshal text values and marshalMethod which also a
  151. public static method that is used to marshal Java values. Both
  152. methods are defined as concatenation of fully-qualified class
  153. name, '.' and the method name. unmarshalMethod must have two
  154. parameters: the first one of type java.lang.String and the
  155. second one is of type javax.xml.namespace.NamespaceContext.
  156. marshalMethod must also have two parameters: the first one is of
  157. type java.lang.Object and the second one is of type
  158. javax.xml.namespace.NamespaceContext. jbxb:value can appear
  159. inside simple type definitions, attribute declarations and
  160. jbxb:characters. If jbxb:value is not used, text values are
  161. unmarshalled using default simple types to Java bindings
  162. defained in JAXB2.0 spec. If simple type is a user-defined, by
  163. default it is not unmarshalled and passed as a string. Example: <![CDATA[
  164. <xsd:simpleType name="kernelControllerState">
  165. <xsd:annotation>
  166. <xsd:appinfo>
  167. <jbxb:value unmarshalMethod="org.jboss.test.xml.pojoserver.metadata.KernelControllerStateDatatypeConverter.unmarshal"/>
  168. </xsd:appinfo>
  169. </xsd:annotation>
  170. <xsd:restriction base="xsd:string">
  171. <xsd:enumeration value="Not Installed" />
  172. <xsd:enumeration value="Described" />
  173. <xsd:enumeration value="Instantiated" />
  174. <xsd:enumeration value="Configured" />
  175. <xsd:enumeration value="Lifecycle" />
  176. <xsd:enumeration value="Started" />
  177. <xsd:enumeration value="Installed" />
  178. </xsd:restriction>
  179. </xsd:simpleType>
  180. public class KernelControllerStateDatatypeConverter
  181. {
  182. public static KernelControllerState unmarshal(String text, NamespaceContext nsCtx)
  183. {
  184. KernelControllerState state;
  185. if(KernelControllerState.NOT_INSTALLED.getStateString().equals(text))
  186. {
  187. state = KernelControllerState.NOT_INSTALLED;
  188. }
  189. else
  190. ...
  191. ]]></xs:documentation>
  192. </xs:annotation>
  193. </xs:element>
  194. <xs:element name="addMethod">
  195. <xs:annotation>
  196. <xs:documentation> Specified on an element that should be added to
  197. its parent not with a setter (is not a property) and not with a
  198. field but with a custom method. The attributes are: * name - the
  199. name of the method. There is not default value for this
  200. attribute. It must be set. * valueType - the type of the
  201. argument. If not present, the default is java.lang.Object. And
  202. there is a special value 'child' which means the type of the
  203. child should be used as the argument's type. Example: <![CDATA[
  204. <xs:element name="user">
  205. <xsd:annotation>
  206. <xsd:appinfo>
  207. <jbxb:class impl="org.jboss.test.xml.mbeanserver.Users$User"/>
  208. <jbxb:addMethod name="addUser" valueType="child"/>
  209. </xsd:appinfo>
  210. </xsd:annotation>
  211. <xs:complexType>
  212. <xs:sequence>
  213. <xs:element minOccurs="0" maxOccurs="unbounded" ref="ur:role"/>
  214. </xs:sequence>
  215. <xs:attribute name="name" use="required" type="xs:NCName"/>
  216. <xs:attribute name="password" use="required" type="xs:NCName"/>
  217. </xs:complexType>
  218. </xs:element>
  219. ]]></xs:documentation>
  220. </xs:annotation>
  221. <xs:complexType>
  222. <xs:attribute name="name" type="xs:NCName" use="required">
  223. <xs:annotation>
  224. <xs:documentation>This required attribute specifies the name
  225. of the add method</xs:documentation>
  226. </xs:annotation>
  227. </xs:attribute>
  228. <xs:attribute default="java.lang.Object" name="valueType"
  229. type="xs:NCName" use="optional">
  230. <xs:annotation>
  231. <xs:documentation> the type of the add method argument. If
  232. not present, the default is java.lang.Object. And there
  233. is a special value 'child' which means the type of the
  234. child should be used as the argument's type.
  235. </xs:documentation>
  236. </xs:annotation>
  237. </xs:attribute>
  238. </xs:complexType>
  239. </xs:element>
  240. <xs:element name="putMethod">
  241. <xs:annotation>
  242. <xs:documentation/>
  243. </xs:annotation>
  244. <xs:complexType>
  245. <xs:attribute default="put" name="name" type="xs:NCName"
  246. use="optional">
  247. <xs:annotation>
  248. <xs:documentation> the method name in the parent object's
  249. class that adds child to to its parent object. If not
  250. present, the default is 'put'. </xs:documentation>
  251. </xs:annotation>
  252. </xs:attribute>
  253. <xs:attribute default="java.lang.Object" name="keyType"
  254. type="xs:NCName" use="optional">
  255. <xs:annotation>
  256. <xs:documentation> fully qualified type name of the
  257. key-parameter to the put-method. If not present, the
  258. default is java.lang.Object. </xs:documentation>
  259. </xs:annotation>
  260. </xs:attribute>
  261. <xs:attribute default="java.lang.Object" name="valueType"
  262. type="xs:NCName" use="optional">
  263. <xs:annotation>
  264. <xs:documentation>fully qualified type name of the
  265. value-parameter to the put-method. If not present, the
  266. default is java.lang.Object. </xs:documentation>
  267. </xs:annotation>
  268. </xs:attribute>
  269. </xs:complexType>
  270. </xs:element>
  271. <xs:element name="mapEntry">
  272. <xs:annotation>
  273. <xs:documentation> Specified on an element or a complex type
  274. definition that is bound to a map entry. jbxb:class and
  275. jbxb:mapEntry are mutually exclusive, meanning an element or a
  276. complex type cannot be annotated with both jbxb:class and
  277. jbxb:mapEntry at the same time. Otherwise, it will result in an
  278. exception during binding. </xs:documentation>
  279. </xs:annotation>
  280. <xs:complexType>
  281. <xs:attribute name="impl" type="xs:NCName" use="optional">
  282. <xs:annotation>
  283. <xs:documentation>an optional element that specifies a fully
  284. qualified name of the class that will represent map
  285. entry. If absent, a special class will be used by the
  286. framework internally.</xs:documentation>
  287. </xs:annotation>
  288. </xs:attribute>
  289. <xs:attribute default="getKey" name="getKeyMethod" type="xs:NCName"
  290. use="optional">
  291. <xs:annotation>
  292. <xs:documentation>an optional attribute that specifies the
  293. name of the method that is used to get the key out of
  294. the object that represents a map
  295. entry.</xs:documentation>
  296. </xs:annotation>
  297. </xs:attribute>
  298. <xs:attribute default="setKey" name="setKeyMethod" type="xs:NCName"
  299. use="optional">
  300. <xs:annotation>
  301. <xs:documentation>an optional attribute that specifies the
  302. name of the method that is used to set the key value on
  303. the object that represents a map
  304. entry.</xs:documentation>
  305. </xs:annotation>
  306. </xs:attribute>
  307. <xs:attribute default="getValue" name="getValueMethod"
  308. type="xs:NCName" use="optional">
  309. <xs:annotation>
  310. <xs:documentation>an optional element that specifies the
  311. name of the method that is used to get the value out of
  312. the object that represents a map entry. If absent and
  313. impl attribute is absent too, the default value is
  314. "getValue". If absent and impl attribute is present, the
  315. value will be the object that reprents the map entry
  316. itself.</xs:documentation>
  317. </xs:annotation>
  318. </xs:attribute>
  319. <xs:attribute default="setValue" name="setValueMethod"
  320. type="xs:NCName" use="optional">
  321. <xs:annotation>
  322. <xs:documentation>an optional element that specifies the
  323. name of the method that is used to set the value on the
  324. object that represents a map entry.</xs:documentation>
  325. </xs:annotation>
  326. </xs:attribute>
  327. <xs:attribute name="valueType" type="xs:NCName" use="optional">
  328. <xs:annotation>
  329. <xs:documentation>an optional attribute that specifies the
  330. type of the map entry value. Used when map entry value
  331. should be a parent for element/type's
  332. content.</xs:documentation>
  333. </xs:annotation>
  334. </xs:attribute>
  335. <xs:attribute default="false" name="nonNullValue" type="xs:boolean"
  336. use="optional">
  337. <xs:annotation>
  338. <xs:documentation>If true, when a map entry is created, a
  339. non-null map entry value will also be created and set on
  340. the map entry. Otherwise, a map entry object is created
  341. with null value and the value will be created and set
  342. later when it is actually parsed. This attribute is used
  343. in combination with valueType.</xs:documentation>
  344. </xs:annotation>
  345. </xs:attribute>
  346. </xs:complexType>
  347. </xs:element>
  348. <xs:element name="mapEntryKey">
  349. <xs:annotation>
  350. <xs:documentation>This element is a marker element that has no
  351. attributes. It is specified on an element, attribute or inside
  352. jbxb:characters to specify that the element, attribute or
  353. characters should be used as the key in map
  354. entry.</xs:documentation>
  355. </xs:annotation>
  356. </xs:element>
  357. <xs:element name="mapEntryValue">
  358. <xs:annotation>
  359. <xs:documentation>This element is a marker element that has no
  360. attributes. It is specified on an element, attribute or inside
  361. jbxb:characters to specify that the element, attribute or
  362. characters should be used as the value in map entry. Example:<![CDATA[
  363. <xsd:element name="entry1">
  364. <xsd:annotation>
  365. <xsd:appinfo>
  366. <putMethod/>
  367. </xsd:appinfo>
  368. </xsd:annotation>
  369. <xsd:complexType>
  370. <xsd:annotation>
  371. <xsd:appinfo>
  372. <jbxb:mapEntry/>
  373. </xsd:appinfo>
  374. </xsd:annotation>
  375. <xsd:sequence>
  376. <xsd:element name="key1" type="xsd:string">
  377. <xsd:annotation>
  378. <xsd:appinfo>
  379. <jbxb:mapEntryKey/>
  380. </xsd:appinfo>
  381. </xsd:annotation>
  382. </xsd:element>
  383. <xsd:element name="value1" type="xsd:string">
  384. <xsd:annotation>
  385. <xsd:appinfo>
  386. <jbxb:mapEntryValue/>
  387. </xsd:appinfo>
  388. </xsd:annotation>
  389. </xsd:element>
  390. </xsd:sequence>
  391. </xsd:complexType>
  392. </xsd:element>
  393. ]]></xs:documentation>
  394. </xs:annotation>
  395. </xs:element>
  396. <xs:element name="skip">
  397. <xs:annotation>
  398. <xs:documentation>This element can be used on an element declaration
  399. or a complex type definition. Unmarshaller will not try to
  400. create new objects for elements (or elements of complex types)
  401. that are annotated with jbxb:skip. Instead, the object that was
  402. created for the parent of such elements will be propagated and
  403. values of attributes, character contents and child elements of
  404. such elements will be set on their parent's
  405. object. Example:<![CDATA[
  406. <xs:element name="authentication">
  407. <xsd:annotation>
  408. <xsd:appinfo>
  409. <jbxb:skip/>
  410. </xsd:appinfo>
  411. </xsd:annotation>
  412. <xs:complexType>
  413. <xs:sequence>
  414. <xs:element ref="jaas:login-module"/>
  415. </xs:sequence>
  416. </xs:complexType>
  417. </xs:element>
  418. ]]>In the example above, login-modules will be added to the parent of authentication element.</xs:documentation>
  419. </xs:annotation>
  420. </xs:element>
  421. </xs:schema>