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