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