0955245a5b9f2ce8e79cac85f8ce131201d43aef
[jalview.git] / schemas / castor-mapping.xsd
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"\r
3     "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->\r
4     <!--\r
5         Castor Object Mapping XML Schema\r
6         \r
7         Namespace: http://castor.exolab.org/\r
8         System:    http://castor.exolab.org/mapping.xsd\r
9         Public:    -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN\r
10         \r
11         *Note*: This schema is under evolution and subject to change.\r
12         \r
13     -->\r
14     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
15         targetNamespace="http://castor.exolab.org/"\r
16         xmlns="http://castor.exolab.org/"\r
17         version="0.9.4">\r
18         \r
19         <xsd:element name="mapping">\r
20             <xsd:complexType>\r
21                 <xsd:sequence>\r
22                     <xsd:element name="description"   type="xsd:string" minOccurs="0" maxOccurs="1" />\r
23                     <xsd:element ref="include"        minOccurs="0" maxOccurs="unbounded" />\r
24                     <xsd:element ref="class"          minOccurs="0" maxOccurs="unbounded" />\r
25                     <xsd:element ref="key-generator"  minOccurs="0" maxOccurs="unbounded" />\r
26                 </xsd:sequence>\r
27             </xsd:complexType>\r
28         </xsd:element>\r
29         \r
30         <xsd:element name="include">\r
31             <xsd:complexType>\r
32                 <xsd:attribute name="href" type="xsd:string" use="required"/>\r
33             </xsd:complexType>\r
34         </xsd:element>\r
35         \r
36         <xsd:element name="class">\r
37             <xsd:complexType>\r
38                 <xsd:sequence>\r
39                     <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
40                     <xsd:element ref="cache-type"   minOccurs="0" maxOccurs="1" />\r
41                     <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />\r
42                     <xsd:choice minOccurs="1">\r
43                         <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>\r
44                         <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>\r
45                     </xsd:choice>\r
46                 </xsd:sequence>\r
47                 <xsd:attribute name="name"     type="xsd:ID"         use="required"/>\r
48                 <xsd:attribute name="extends"  type="xsd:IDREF"      use="optional"/>\r
49                 <xsd:attribute name="depends"  type="xsd:IDREF"      use="optional"/>\r
50                 <xsd:attribute name="identity" type="xsd:NMTOKENS"   use="optional"/>\r
51                 <xsd:attribute name="access"   default="shared"    use="optional">\r
52                     <xsd:simpleType>\r
53                         <xsd:restriction base="xsd:string">\r
54                             <xsd:enumeration value="read-only"/>\r
55                             <xsd:enumeration value="shared"/>\r
56                             <xsd:enumeration value="exclusive"/>\r
57                             <xsd:enumeration value="db-locked"/>\r
58                         </xsd:restriction>\r
59                     </xsd:simpleType>\r
60                 </xsd:attribute>\r
61                 <xsd:attribute name="key-generator" type="xsd:string"   use="optional"/>\r
62                 <xsd:attribute name="auto-complete" type="xsd:boolean"  use="optional" default="false"/>\r
63                 <xsd:attribute name="verify-constructable" type="xsd:boolean"  use="optional" default="true"/>\r
64             </xsd:complexType>\r
65         </xsd:element>\r
66         \r
67         <xsd:element name="map-to">\r
68             <xsd:complexType>\r
69                 <xsd:attribute name="table"     type="xsd:NMTOKEN"  use="optional"/>\r
70                 <xsd:attribute name="xml"       type="xsd:string"   use="optional"/>\r
71                 <xsd:attribute name="ns-uri"    type="xsd:string"   use="optional"/>\r
72                 <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN"  use="optional"/>\r
73                 <xsd:attribute name="ldap-dn"   type="xsd:string"   use="optional"/>\r
74                 <xsd:attribute name="ldap-oc"   type="xsd:string"   use="optional"/>\r
75             </xsd:complexType>\r
76         </xsd:element>\r
77         \r
78         <xsd:element name="field">\r
79             <xsd:complexType>\r
80                 <xsd:sequence>\r
81                     <xsd:element name="description"   type="xsd:string" minOccurs="0" maxOccurs="1" />\r
82                     <xsd:element ref="sql"            minOccurs="0" maxOccurs="1"/>\r
83                     <xsd:element ref="bind-xml"       minOccurs="0" maxOccurs="1"/>\r
84                     <xsd:element ref="ldap"           minOccurs="0" maxOccurs="1"/>\r
85                 </xsd:sequence>\r
86                 \r
87                 <xsd:attribute name="name"          type="xsd:string" use="required"/>\r
88                 <xsd:attribute name="type"          type="xsd:string" use="optional"/>\r
89                 <xsd:attribute name="required"      type="xsd:boolean"  use="optional"   default="false"/>\r
90                 <xsd:attribute name="transient"     type="xsd:boolean"  use="optional"   default="false"/>\r
91                 <xsd:attribute name="direct"        type="xsd:boolean"  use="optional"   default="false"/>\r
92                 <xsd:attribute name="lazy"          type="xsd:boolean"  use="optional"   default="false"/>\r
93                 <xsd:attribute name="container"     type="xsd:boolean"  use="optional"/>\r
94                 <xsd:attribute name="get-method"    type="xsd:string"  use="optional"/>\r
95                 <xsd:attribute name="has-method"    type="xsd:string"  use="optional"/>\r
96                 <xsd:attribute name="set-method"    type="xsd:string"  use="optional"/>\r
97                 <xsd:attribute name="create-method" type="xsd:string"  use="optional"/>\r
98                 <xsd:attribute name="handler"       type="xsd:string"   use="optional"/>\r
99                 <xsd:attribute name="collection"    use="optional">\r
100                     <xsd:simpleType>\r
101                         <xsd:restriction base="xsd:string">\r
102                             <xsd:enumeration value="array"/>\r
103                             <xsd:enumeration value="vector"/>\r
104                             <xsd:enumeration value="arraylist"/>\r
105                             <xsd:enumeration value="hashtable"/>\r
106                             <xsd:enumeration value="collection"/>\r
107                             <xsd:enumeration value="set"/>\r
108                             <xsd:enumeration value="map"/>\r
109                             <xsd:enumeration value="enumerate"/>\r
110                         </xsd:restriction>\r
111                     </xsd:simpleType>\r
112                 </xsd:attribute>\r
113             </xsd:complexType>\r
114         </xsd:element>\r
115         \r
116         <xsd:element name="container">\r
117             <xsd:complexType>\r
118                 <xsd:sequence>\r
119                     <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
120                     <xsd:element ref="field" minOccurs="1"/>\r
121                 </xsd:sequence>\r
122                 <xsd:attribute name="name"          type="xsd:NMTOKEN" use="required"/>\r
123                 <xsd:attribute name="type"          type="xsd:NMTOKEN" use="optional"/>\r
124                 <xsd:attribute name="required"      type="xsd:boolean" use="optional"  default="false"/>\r
125                 <xsd:attribute name="direct"        type="xsd:boolean" use="optional"  default="false"/>\r
126                 <xsd:attribute name="get-method"    type="xsd:NMTOKEN" use="optional"/>\r
127                 <xsd:attribute name="set-method"    type="xsd:NMTOKEN" use="optional"/>\r
128                 <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>\r
129             </xsd:complexType>\r
130         </xsd:element>\r
131         \r
132         <xsd:element name="sql">\r
133             <xsd:complexType>\r
134                 <xsd:attribute name="name"       type="xsd:NMTOKENS"   use="optional"/>\r
135                 <xsd:attribute name="type"       type="xsd:string"   use="optional"/>\r
136                 <xsd:attribute name="many-table" type="xsd:NMTOKEN"    use="optional"/>\r
137                 <xsd:attribute name="many-key"   type="xsd:NMTOKENS"   use="optional"/>\r
138                 <xsd:attribute name="read-only"  type="xsd:boolean"    use="optional" default="false"/>\r
139                 \r
140                 <!-- signals that this field is transient for database mapping (ie should be ignored) -->\r
141                 <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
142                 \r
143                 \r
144                 <xsd:attribute name="dirty"  default="check"  use="optional">\r
145                     <xsd:simpleType>\r
146                         <xsd:restriction base="xsd:string">\r
147                             <xsd:enumeration value="check"/>\r
148                             <xsd:enumeration value="ignore"/>\r
149                         </xsd:restriction>\r
150                     </xsd:simpleType>\r
151                 </xsd:attribute>\r
152             </xsd:complexType>\r
153         </xsd:element>\r
154         \r
155         <!--\r
156             The 'bind-xml' element is used for specifying XML specific databinding\r
157             properties and behavior for a specific field. 'bind-xml' may only appear\r
158             as a child of a 'field' element.\r
159         -->\r
160         <xsd:element name="bind-xml">\r
161             <xsd:annotation>\r
162                 <xsd:documentation>\r
163                     The 'bind-xml' element is used for specifying XML specific databinding\r
164                     properties and behavior for a specific field. 'bind-xml' may only appear\r
165                     as a child of a 'field' element.\r
166                 </xsd:documentation>\r
167             </xsd:annotation>\r
168             <xsd:complexType>\r
169                 \r
170                 <xsd:sequence>\r
171                     <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>\r
172                     <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>\r
173                 </xsd:sequence>\r
174                 \r
175                 <!--\r
176                     An optional attribute used for specifying the XML name for the\r
177                     field associated with the 'bind-xml' element.\r
178                 -->\r
179                 <xsd:attribute name="name" type="xsd:QName"  use="optional">\r
180                     <xsd:annotation>\r
181                         <xsd:documentation>\r
182                             An optional attribute used for specifying the XML name for the\r
183                             field associated with the 'bind-xml' element.\r
184                         </xsd:documentation>\r
185                     </xsd:annotation>\r
186                 </xsd:attribute>\r
187                 \r
188                 <xsd:attribute name="type" type="xsd:NMTOKEN"  use="optional"/>\r
189                 \r
190                 <!--\r
191                     Allows specifying how Castor should automatically determines\r
192                     the XML name of this field when no name has been specified.\r
193                 -->\r
194                 <xsd:attribute name="auto-naming" use="optional">\r
195                     <xsd:annotation>\r
196                         <xsd:documentation>\r
197                             Allows specifying how Castor should automatically determines\r
198                             the XML name of this field when no name has been specified.\r
199                             In most cases the XML name is determined by using the field name,\r
200                             but in some cases the user may want to use the Class name of\r
201                             the field type. This attribute allows choosing between the\r
202                             two approaches. If this attribute is not specified, the field\r
203                             name is used as the XML name.\r
204                         </xsd:documentation>\r
205                     </xsd:annotation>\r
206                     <xsd:simpleType>\r
207                         <xsd:restriction base="xsd:string">\r
208                             <xsd:enumeration value="deriveByClass"/>\r
209                             <xsd:enumeration value="deriveByField"/>\r
210                         </xsd:restriction>\r
211                     </xsd:simpleType>\r
212                 </xsd:attribute>\r
213                 \r
214                 <!--\r
215                     Allows specifying a nested location path for this field,\r
216                     the value should just be a simplified XPath like value\r
217                     where names are separated by "/".\r
218                 -->\r
219                 <xsd:attribute name="location" type="xsd:string" use="optional">\r
220                     <xsd:annotation>\r
221                         <xsd:documentation>\r
222                             Allows specifying a nested location path for this field,\r
223                             the value should just be a simplified XPath like value\r
224                             where names are separated by "/".\r
225                         </xsd:documentation>\r
226                     </xsd:annotation>\r
227                 </xsd:attribute>\r
228                 \r
229                 <!-- Allows overriding the matching rule -->\r
230                 <xsd:attribute name="matches" type="xsd:string" use="optional"/>\r
231                 \r
232                 \r
233                 <!-- Signal that this field should be marshalled as a reference -->\r
234                 <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>\r
235                 \r
236                 <!-- NodeType for the XML node -->\r
237                 <xsd:attribute name="node" use="optional">\r
238                     <xsd:simpleType>\r
239                         <xsd:restriction base="xsd:string">\r
240                             <xsd:enumeration value="attribute"/>\r
241                             <xsd:enumeration value="element"/>\r
242                             <xsd:enumeration value="namespace"/>\r
243                             <xsd:enumeration value="text"/>\r
244                         </xsd:restriction>\r
245                     </xsd:simpleType>\r
246                 </xsd:attribute>\r
247                 \r
248                 <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>\r
249                 \r
250                 <!-- Signal that this field is transient for XML (ie should be ignored) -->\r
251                 <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
252                 \r
253             </xsd:complexType>\r
254         </xsd:element>\r
255         \r
256         \r
257         \r
258         <xsd:element name="ldap">\r
259             <xsd:complexType>\r
260                 <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>\r
261             </xsd:complexType>\r
262         </xsd:element>\r
263         \r
264         <xsd:element name="key-generator">\r
265             <xsd:complexType>\r
266                 <xsd:sequence>\r
267                     <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />\r
268                 </xsd:sequence>\r
269                 <xsd:attribute name="name"  type="xsd:ID"     use="required"/>\r
270                 <xsd:attribute name="alias" type="xsd:string" use="optional"/>\r
271             </xsd:complexType>\r
272         </xsd:element>\r
273         \r
274         <xsd:element name="cache-type">\r
275             <xsd:complexType>\r
276                 <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />\r
277                 <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>\r
278             </xsd:complexType>\r
279         </xsd:element>\r
280         \r
281         <xsd:element name="param">\r
282             <xsd:complexType>\r
283                 <xsd:attribute name="name"  type="xsd:string"  use="required"/>\r
284                 <xsd:attribute name="value" type="xsd:string"  use="required"/>\r
285             </xsd:complexType>\r
286         </xsd:element>\r
287         \r
288         \r
289         <xsd:complexType name="propertyType">\r
290             <xsd:sequence>\r
291                 <xsd:element name="name"  type="xsd:string"/>\r
292                 <xsd:element name="value" type="xsd:string"/>\r
293             </xsd:sequence>\r
294         </xsd:complexType>\r
295         \r
296         \r
297     </xsd:schema>\r