castor mapping file schema (for mappings in resources dir) - this is put in for devel...
authorjprocter <Jim Procter>
Mon, 28 May 2007 09:57:21 +0000 (09:57 +0000)
committerjprocter <Jim Procter>
Mon, 28 May 2007 09:57:21 +0000 (09:57 +0000)
schemas/castor-mapping.xsd [new file with mode: 0644]

diff --git a/schemas/castor-mapping.xsd b/schemas/castor-mapping.xsd
new file mode 100644 (file)
index 0000000..0955245
--- /dev/null
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"\r
+    "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->\r
+    <!--\r
+        Castor Object Mapping XML Schema\r
+        \r
+        Namespace: http://castor.exolab.org/\r
+        System:    http://castor.exolab.org/mapping.xsd\r
+        Public:    -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN\r
+        \r
+        *Note*: This schema is under evolution and subject to change.\r
+        \r
+    -->\r
+    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
+        targetNamespace="http://castor.exolab.org/"\r
+        xmlns="http://castor.exolab.org/"\r
+        version="0.9.4">\r
+        \r
+        <xsd:element name="mapping">\r
+            <xsd:complexType>\r
+                <xsd:sequence>\r
+                    <xsd:element name="description"   type="xsd:string" minOccurs="0" maxOccurs="1" />\r
+                    <xsd:element ref="include"        minOccurs="0" maxOccurs="unbounded" />\r
+                    <xsd:element ref="class"          minOccurs="0" maxOccurs="unbounded" />\r
+                    <xsd:element ref="key-generator"  minOccurs="0" maxOccurs="unbounded" />\r
+                </xsd:sequence>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="include">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="href" type="xsd:string" use="required"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="class">\r
+            <xsd:complexType>\r
+                <xsd:sequence>\r
+                    <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
+                    <xsd:element ref="cache-type"   minOccurs="0" maxOccurs="1" />\r
+                    <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />\r
+                    <xsd:choice minOccurs="1">\r
+                        <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>\r
+                        <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>\r
+                    </xsd:choice>\r
+                </xsd:sequence>\r
+                <xsd:attribute name="name"     type="xsd:ID"         use="required"/>\r
+                <xsd:attribute name="extends"  type="xsd:IDREF"      use="optional"/>\r
+                <xsd:attribute name="depends"  type="xsd:IDREF"      use="optional"/>\r
+                <xsd:attribute name="identity" type="xsd:NMTOKENS"   use="optional"/>\r
+                <xsd:attribute name="access"   default="shared"    use="optional">\r
+                    <xsd:simpleType>\r
+                        <xsd:restriction base="xsd:string">\r
+                            <xsd:enumeration value="read-only"/>\r
+                            <xsd:enumeration value="shared"/>\r
+                            <xsd:enumeration value="exclusive"/>\r
+                            <xsd:enumeration value="db-locked"/>\r
+                        </xsd:restriction>\r
+                    </xsd:simpleType>\r
+                </xsd:attribute>\r
+                <xsd:attribute name="key-generator" type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="auto-complete" type="xsd:boolean"  use="optional" default="false"/>\r
+                <xsd:attribute name="verify-constructable" type="xsd:boolean"  use="optional" default="true"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="map-to">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="table"     type="xsd:NMTOKEN"  use="optional"/>\r
+                <xsd:attribute name="xml"       type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="ns-uri"    type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN"  use="optional"/>\r
+                <xsd:attribute name="ldap-dn"   type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="ldap-oc"   type="xsd:string"   use="optional"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="field">\r
+            <xsd:complexType>\r
+                <xsd:sequence>\r
+                    <xsd:element name="description"   type="xsd:string" minOccurs="0" maxOccurs="1" />\r
+                    <xsd:element ref="sql"            minOccurs="0" maxOccurs="1"/>\r
+                    <xsd:element ref="bind-xml"       minOccurs="0" maxOccurs="1"/>\r
+                    <xsd:element ref="ldap"           minOccurs="0" maxOccurs="1"/>\r
+                </xsd:sequence>\r
+                \r
+                <xsd:attribute name="name"          type="xsd:string" use="required"/>\r
+                <xsd:attribute name="type"          type="xsd:string" use="optional"/>\r
+                <xsd:attribute name="required"      type="xsd:boolean"  use="optional"   default="false"/>\r
+                <xsd:attribute name="transient"     type="xsd:boolean"  use="optional"   default="false"/>\r
+                <xsd:attribute name="direct"        type="xsd:boolean"  use="optional"   default="false"/>\r
+                <xsd:attribute name="lazy"          type="xsd:boolean"  use="optional"   default="false"/>\r
+                <xsd:attribute name="container"     type="xsd:boolean"  use="optional"/>\r
+                <xsd:attribute name="get-method"    type="xsd:string"  use="optional"/>\r
+                <xsd:attribute name="has-method"    type="xsd:string"  use="optional"/>\r
+                <xsd:attribute name="set-method"    type="xsd:string"  use="optional"/>\r
+                <xsd:attribute name="create-method" type="xsd:string"  use="optional"/>\r
+                <xsd:attribute name="handler"       type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="collection"    use="optional">\r
+                    <xsd:simpleType>\r
+                        <xsd:restriction base="xsd:string">\r
+                            <xsd:enumeration value="array"/>\r
+                            <xsd:enumeration value="vector"/>\r
+                            <xsd:enumeration value="arraylist"/>\r
+                            <xsd:enumeration value="hashtable"/>\r
+                            <xsd:enumeration value="collection"/>\r
+                            <xsd:enumeration value="set"/>\r
+                            <xsd:enumeration value="map"/>\r
+                            <xsd:enumeration value="enumerate"/>\r
+                        </xsd:restriction>\r
+                    </xsd:simpleType>\r
+                </xsd:attribute>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="container">\r
+            <xsd:complexType>\r
+                <xsd:sequence>\r
+                    <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
+                    <xsd:element ref="field" minOccurs="1"/>\r
+                </xsd:sequence>\r
+                <xsd:attribute name="name"          type="xsd:NMTOKEN" use="required"/>\r
+                <xsd:attribute name="type"          type="xsd:NMTOKEN" use="optional"/>\r
+                <xsd:attribute name="required"      type="xsd:boolean" use="optional"  default="false"/>\r
+                <xsd:attribute name="direct"        type="xsd:boolean" use="optional"  default="false"/>\r
+                <xsd:attribute name="get-method"    type="xsd:NMTOKEN" use="optional"/>\r
+                <xsd:attribute name="set-method"    type="xsd:NMTOKEN" use="optional"/>\r
+                <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="sql">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="name"       type="xsd:NMTOKENS"   use="optional"/>\r
+                <xsd:attribute name="type"       type="xsd:string"   use="optional"/>\r
+                <xsd:attribute name="many-table" type="xsd:NMTOKEN"    use="optional"/>\r
+                <xsd:attribute name="many-key"   type="xsd:NMTOKENS"   use="optional"/>\r
+                <xsd:attribute name="read-only"  type="xsd:boolean"    use="optional" default="false"/>\r
+                \r
+                <!-- signals that this field is transient for database mapping (ie should be ignored) -->\r
+                <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
+                \r
+                \r
+                <xsd:attribute name="dirty"  default="check"  use="optional">\r
+                    <xsd:simpleType>\r
+                        <xsd:restriction base="xsd:string">\r
+                            <xsd:enumeration value="check"/>\r
+                            <xsd:enumeration value="ignore"/>\r
+                        </xsd:restriction>\r
+                    </xsd:simpleType>\r
+                </xsd:attribute>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <!--\r
+            The 'bind-xml' element is used for specifying XML specific databinding\r
+            properties and behavior for a specific field. 'bind-xml' may only appear\r
+            as a child of a 'field' element.\r
+        -->\r
+        <xsd:element name="bind-xml">\r
+            <xsd:annotation>\r
+                <xsd:documentation>\r
+                    The 'bind-xml' element is used for specifying XML specific databinding\r
+                    properties and behavior for a specific field. 'bind-xml' may only appear\r
+                    as a child of a 'field' element.\r
+                </xsd:documentation>\r
+            </xsd:annotation>\r
+            <xsd:complexType>\r
+                \r
+                <xsd:sequence>\r
+                    <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>\r
+                    <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>\r
+                </xsd:sequence>\r
+                \r
+                <!--\r
+                    An optional attribute used for specifying the XML name for the\r
+                    field associated with the 'bind-xml' element.\r
+                -->\r
+                <xsd:attribute name="name" type="xsd:QName"  use="optional">\r
+                    <xsd:annotation>\r
+                        <xsd:documentation>\r
+                            An optional attribute used for specifying the XML name for the\r
+                            field associated with the 'bind-xml' element.\r
+                        </xsd:documentation>\r
+                    </xsd:annotation>\r
+                </xsd:attribute>\r
+                \r
+                <xsd:attribute name="type" type="xsd:NMTOKEN"  use="optional"/>\r
+                \r
+                <!--\r
+                    Allows specifying how Castor should automatically determines\r
+                    the XML name of this field when no name has been specified.\r
+                -->\r
+                <xsd:attribute name="auto-naming" use="optional">\r
+                    <xsd:annotation>\r
+                        <xsd:documentation>\r
+                            Allows specifying how Castor should automatically determines\r
+                            the XML name of this field when no name has been specified.\r
+                            In most cases the XML name is determined by using the field name,\r
+                            but in some cases the user may want to use the Class name of\r
+                            the field type. This attribute allows choosing between the\r
+                            two approaches. If this attribute is not specified, the field\r
+                            name is used as the XML name.\r
+                        </xsd:documentation>\r
+                    </xsd:annotation>\r
+                    <xsd:simpleType>\r
+                        <xsd:restriction base="xsd:string">\r
+                            <xsd:enumeration value="deriveByClass"/>\r
+                            <xsd:enumeration value="deriveByField"/>\r
+                        </xsd:restriction>\r
+                    </xsd:simpleType>\r
+                </xsd:attribute>\r
+                \r
+                <!--\r
+                    Allows specifying a nested location path for this field,\r
+                    the value should just be a simplified XPath like value\r
+                    where names are separated by "/".\r
+                -->\r
+                <xsd:attribute name="location" type="xsd:string" use="optional">\r
+                    <xsd:annotation>\r
+                        <xsd:documentation>\r
+                            Allows specifying a nested location path for this field,\r
+                            the value should just be a simplified XPath like value\r
+                            where names are separated by "/".\r
+                        </xsd:documentation>\r
+                    </xsd:annotation>\r
+                </xsd:attribute>\r
+                \r
+                <!-- Allows overriding the matching rule -->\r
+                <xsd:attribute name="matches" type="xsd:string" use="optional"/>\r
+                \r
+                \r
+                <!-- Signal that this field should be marshalled as a reference -->\r
+                <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>\r
+                \r
+                <!-- NodeType for the XML node -->\r
+                <xsd:attribute name="node" use="optional">\r
+                    <xsd:simpleType>\r
+                        <xsd:restriction base="xsd:string">\r
+                            <xsd:enumeration value="attribute"/>\r
+                            <xsd:enumeration value="element"/>\r
+                            <xsd:enumeration value="namespace"/>\r
+                            <xsd:enumeration value="text"/>\r
+                        </xsd:restriction>\r
+                    </xsd:simpleType>\r
+                </xsd:attribute>\r
+                \r
+                <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>\r
+                \r
+                <!-- Signal that this field is transient for XML (ie should be ignored) -->\r
+                <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
+                \r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        \r
+        \r
+        <xsd:element name="ldap">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="key-generator">\r
+            <xsd:complexType>\r
+                <xsd:sequence>\r
+                    <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />\r
+                </xsd:sequence>\r
+                <xsd:attribute name="name"  type="xsd:ID"     use="required"/>\r
+                <xsd:attribute name="alias" type="xsd:string" use="optional"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="cache-type">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />\r
+                <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        <xsd:element name="param">\r
+            <xsd:complexType>\r
+                <xsd:attribute name="name"  type="xsd:string"  use="required"/>\r
+                <xsd:attribute name="value" type="xsd:string"  use="required"/>\r
+            </xsd:complexType>\r
+        </xsd:element>\r
+        \r
+        \r
+        <xsd:complexType name="propertyType">\r
+            <xsd:sequence>\r
+                <xsd:element name="name"  type="xsd:string"/>\r
+                <xsd:element name="value" type="xsd:string"/>\r
+            </xsd:sequence>\r
+        </xsd:complexType>\r
+        \r
+        \r
+    </xsd:schema>\r