This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 512492887de49c4d6f8c706c7397df66a071eea0 Author: Nikita Timofeev <[email protected]> AuthorDate: Fri Jul 8 18:17:49 2022 +0300 CAY-2747 Update project XML version to 11 - new upgrade handler for v11 - schemas update - partially update test projects --- .../src/test/resources/cayenne-crypto.xml | 6 +- cayenne-crypto/src/test/resources/datamap.map.xml | 6 +- .../compatibility/ProjectCompatibilityModule.java | 4 +- .../compatibility/CompatibilityTestModule.java | 4 +- .../java/org/apache/cayenne/project/Project.java | 2 +- .../org/apache/cayenne/project/ProjectModule.java | 4 +- .../upgrade/handlers/UpgradeHandler_V11.java | 110 +++++++ .../upgrade/handlers/UpgradeHandler_V11Test.java | 80 +++++ .../upgrade/handlers/cayenne-project-v10.xml | 18 +- .../project/upgrade/handlers/test-map-v10.map.xml | 16 + .../configuration/DataChannelDescriptor.java | 4 +- .../xml/XMLDataChannelDescriptorLoader.java | 2 +- .../main/java/org/apache/cayenne/map/DataMap.java | 4 +- .../org/apache/cayenne/schema/11/cgen.xsd | 51 +++ .../org/apache/cayenne/schema/11/dbimport.xsd | 113 +++++++ .../org/apache/cayenne/schema/11/domain.xsd | 130 ++++++++ .../org/apache/cayenne/schema/11/graph.xsd | 55 ++++ .../org/apache/cayenne/schema/11/info.xsd | 29 ++ .../org/apache/cayenne/schema/11/modelMap.xsd | 364 +++++++++++++++++++++ .../src/test/resources/cayenne-testmap.xml | 6 +- cayenne-server/src/test/resources/testmap.map.xml | 19 +- .../src/test/resources/cayenne-client.xml | 4 +- .../src/test/resources/embeddable.map.xml | 6 +- .../src/test/resources/testmap.map.xml | 6 +- 24 files changed, 999 insertions(+), 44 deletions(-) diff --git a/cayenne-crypto/src/test/resources/cayenne-crypto.xml b/cayenne-crypto/src/test/resources/cayenne-crypto.xml index dea206b0a..ba4eacc67 100644 --- a/cayenne-crypto/src/test/resources/cayenne-crypto.xml +++ b/cayenne-crypto/src/test/resources/cayenne-crypto.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<domain xmlns="http://cayenne.apache.org/schema/10/domain" +<domain xmlns="http://cayenne.apache.org/schema/11/domain" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/domain https://cayenne.apache.org/schema/10/domain.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/domain https://cayenne.apache.org/schema/11/domain.xsd" + project-version="11"> <map name="datamap"/> <node name="datanode" factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory" diff --git a/cayenne-crypto/src/test/resources/datamap.map.xml b/cayenne-crypto/src/test/resources/datamap.map.xml index 7ce81dd94..42a29fd41 100644 --- a/cayenne-crypto/src/test/resources/datamap.map.xml +++ b/cayenne-crypto/src/test/resources/datamap.map.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" +<data-map xmlns="http://cayenne.apache.org/schema/11/modelMap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap https://cayenne.apache.org/schema/10/modelMap.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/modelMap https://cayenne.apache.org/schema/11/modelMap.xsd" + project-version="11"> <property name="defaultPackage" value="org.apache.cayenne.crypto.db"/> <db-entity name="TABLE1"> <db-attribute name="CRYPTO_INT" type="BLOB"/> diff --git a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/ProjectCompatibilityModule.java b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/ProjectCompatibilityModule.java index 82f1b9599..82e704e1f 100644 --- a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/ProjectCompatibilityModule.java +++ b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/ProjectCompatibilityModule.java @@ -28,6 +28,7 @@ import org.apache.cayenne.di.Module; import org.apache.cayenne.project.ProjectModule; import org.apache.cayenne.project.upgrade.UpgradeService; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V10; +import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V11; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V7; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V8; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V9; @@ -49,6 +50,7 @@ public class ProjectCompatibilityModule implements Module { .add(UpgradeHandler_V7.class) .add(UpgradeHandler_V8.class) .add(UpgradeHandler_V9.class) - .add(UpgradeHandler_V10.class); + .add(UpgradeHandler_V10.class) + .add(UpgradeHandler_V11.class); } } diff --git a/cayenne-project-compatibility/src/test/java/org/apache/cayenne/project/compatibility/CompatibilityTestModule.java b/cayenne-project-compatibility/src/test/java/org/apache/cayenne/project/compatibility/CompatibilityTestModule.java index 5e1b94f7d..2e38b56ac 100644 --- a/cayenne-project-compatibility/src/test/java/org/apache/cayenne/project/compatibility/CompatibilityTestModule.java +++ b/cayenne-project-compatibility/src/test/java/org/apache/cayenne/project/compatibility/CompatibilityTestModule.java @@ -34,6 +34,7 @@ import org.apache.cayenne.project.ProjectSaver; import org.apache.cayenne.project.upgrade.UpgradeService; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V10; +import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V11; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V7; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V8; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V9; @@ -59,7 +60,8 @@ public class CompatibilityTestModule implements Module { .add(UpgradeHandler_V7.class) .add(UpgradeHandler_V8.class) .add(UpgradeHandler_V9.class) - .add(UpgradeHandler_V10.class); + .add(UpgradeHandler_V10.class) + .add(UpgradeHandler_V11.class); binder.bind(ProjectSaver.class).toInstance(mock(ProjectSaver.class)); binder.bind(DataChannelDescriptorLoader.class).toInstance(mock(DataChannelDescriptorLoader.class)); diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/Project.java b/cayenne-project/src/main/java/org/apache/cayenne/project/Project.java index 15de00cea..4cd6c3242 100644 --- a/cayenne-project/src/main/java/org/apache/cayenne/project/Project.java +++ b/cayenne-project/src/main/java/org/apache/cayenne/project/Project.java @@ -42,7 +42,7 @@ public class Project { * * @since 4.1 */ - static public final int VERSION = 10; + static public final int VERSION = 11; protected boolean modified; diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/ProjectModule.java b/cayenne-project/src/main/java/org/apache/cayenne/project/ProjectModule.java index ce6e005e2..670d8b1a5 100644 --- a/cayenne-project/src/main/java/org/apache/cayenne/project/ProjectModule.java +++ b/cayenne-project/src/main/java/org/apache/cayenne/project/ProjectModule.java @@ -26,6 +26,7 @@ import org.apache.cayenne.project.upgrade.DefaultUpgradeService; import org.apache.cayenne.project.upgrade.UpgradeService; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V10; +import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V11; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V7; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V8; import org.apache.cayenne.project.upgrade.handlers.UpgradeHandler_V9; @@ -66,7 +67,8 @@ public class ProjectModule implements Module { .add(UpgradeHandler_V7.class) .add(UpgradeHandler_V8.class) .add(UpgradeHandler_V9.class) - .add(UpgradeHandler_V10.class); + .add(UpgradeHandler_V10.class) + .add(UpgradeHandler_V11.class); contributeExtensions(binder); } diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11.java b/cayenne-project/src/main/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11.java new file mode 100644 index 000000000..1fadc7425 --- /dev/null +++ b/cayenne-project/src/main/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11.java @@ -0,0 +1,110 @@ +/***************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ****************************************************************/ + +package org.apache.cayenne.project.upgrade.handlers; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathFactory; + +import org.apache.cayenne.project.upgrade.UpgradeUnit; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +/** + * Upgrade handler for the project version "11" introduced by 4.3.M1 release. + * Changes highlight: + * - ROP removal + * + * @since 4.3 + */ +public class UpgradeHandler_V11 implements UpgradeHandler { + + @Override + public String getVersion() { + return "11"; + } + + @Override + public void processProjectDom(UpgradeUnit upgradeUnit) { + Element domain = upgradeUnit.getDocument().getDocumentElement(); + // introduce xml namespace and schema for domain + domain.setAttribute("xmlns","http://cayenne.apache.org/schema/11/domain"); + domain.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"); + domain.setAttribute("xsi:schemaLocation", "http://cayenne.apache.org/schema/11/domain " + + "https://cayenne.apache.org/schema/11/domain.xsd"); + // update version + domain.setAttribute("project-version", getVersion()); + } + + @Override + public void processDataMapDom(UpgradeUnit upgradeUnit) { + Element dataMap = upgradeUnit.getDocument().getDocumentElement(); + // update schema + dataMap.setAttribute("xmlns","http://cayenne.apache.org/schema/11/modelMap"); + dataMap.setAttribute("xsi:schemaLocation", "http://cayenne.apache.org/schema/11/modelMap " + + "https://cayenne.apache.org/schema/11/modelMap.xsd"); + // update version + dataMap.setAttribute("project-version", getVersion()); + + dropRopProperties(upgradeUnit); + cleanupObjEntityClientInfo(upgradeUnit); + } + + private void dropRopProperties(UpgradeUnit upgradeUnit) { + Element dataMap = upgradeUnit.getDocument().getDocumentElement(); + NodeList propertyNodes; + try { + XPath xpath = XPathFactory.newInstance().newXPath(); + propertyNodes = (NodeList) xpath.evaluate("/data-map/property", upgradeUnit.getDocument(), XPathConstants.NODESET); + } catch (Exception ex) { + return; + } + + for (int j = 0; j < propertyNodes.getLength(); j++) { + Element propertyElement = (Element) propertyNodes.item(j); + String name = propertyElement.getAttribute("name"); + + switch (name) { + case "clientSupported": + case "defaultClientPackage": + case "defaultClientSuperclass": + dataMap.removeChild(propertyElement); + break; + } + } + } + + private void cleanupObjEntityClientInfo(UpgradeUnit upgradeUnit) { + NodeList objEntityNodes; + try { + XPath xpath = XPathFactory.newInstance().newXPath(); + objEntityNodes = (NodeList) xpath.evaluate("/data-map/obj-entity", upgradeUnit.getDocument(), XPathConstants.NODESET); + } catch (Exception ex) { + return; + } + + for (int j = 0; j < objEntityNodes.getLength(); j++) { + Element objEntityElement = (Element) objEntityNodes.item(j); + objEntityElement.removeAttribute("serverOnly"); + objEntityElement.removeAttribute("clientClassName"); + objEntityElement.removeAttribute("clientSuperClassName"); + } + } +} diff --git a/cayenne-project/src/test/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11Test.java b/cayenne-project/src/test/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11Test.java new file mode 100644 index 000000000..23f37a9ec --- /dev/null +++ b/cayenne-project/src/test/java/org/apache/cayenne/project/upgrade/handlers/UpgradeHandler_V11Test.java @@ -0,0 +1,80 @@ +/***************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ****************************************************************/ + +package org.apache.cayenne.project.upgrade.handlers; + +import org.apache.cayenne.configuration.DataChannelDescriptor; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyZeroInteractions; + +/** + * @since 4.3 + */ +public class UpgradeHandler_V11Test extends BaseUpgradeHandlerTest{ + + UpgradeHandler newHandler() { + return new UpgradeHandler_V11(); + } + + @Test + public void testProjectDomUpgrade() throws Exception { + Document document = processProjectDom("cayenne-project-v10.xml"); + + Element root = document.getDocumentElement(); + assertEquals("11", root.getAttribute("project-version")); + assertEquals("http://cayenne.apache.org/schema/11/domain", root.getAttribute("xmlns")); + assertEquals(2, root.getElementsByTagName("map").getLength()); + } + + @Test + public void testDataMapDomUpgrade() throws Exception { + Document document = processDataMapDom("test-map-v10.map.xml"); + + Element root = document.getDocumentElement(); + assertEquals("11", root.getAttribute("project-version")); + assertEquals("http://cayenne.apache.org/schema/11/modelMap", root.getAttribute("xmlns")); + + NodeList properties = root.getElementsByTagName("property"); + assertEquals(1, properties.getLength()); + assertEquals("defaultPackage", properties.item(0).getAttributes().getNamedItem("name").getNodeValue()); + + NodeList objEntities = root.getElementsByTagName("obj-entity"); + assertEquals(1, objEntities.getLength()); + NamedNodeMap attributes = objEntities.item(0).getAttributes(); + assertEquals(2, attributes.getLength()); + assertEquals("Artist", attributes.getNamedItem("name").getNodeValue()); + assertEquals("Artist", attributes.getNamedItem("dbEntityName").getNodeValue()); + + assertEquals(2, root.getElementsByTagName("db-attribute").getLength()); + } + + @Test + public void testModelUpgrade() throws Exception { + DataChannelDescriptor descriptor = mock(DataChannelDescriptor.class); + handler.processModel(descriptor); + verifyZeroInteractions(descriptor); + } +} \ No newline at end of file diff --git a/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/cayenne-project-v10.xml b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/cayenne-project-v10.xml index c3f068124..b81eb7516 100644 --- a/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/cayenne-project-v10.xml +++ b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/cayenne-project-v10.xml @@ -1,3 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Fake version to test DefaultUpgradeService --> -<domain project-version="10"/> \ No newline at end of file +<domain xmlns="http://cayenne.apache.org/schema/10/domain" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://cayenne.apache.org/schema/10/domain https://cayenne.apache.org/schema/10/domain.xsd" + project-version="10" > + + <map name="testProjectMap1_1" /> + <map name="testProjectMap1_2" /> + + <node name="testProjectNode1" + adapter="org.example.test.Adapter" factory="org.example.test.DataSourceFactory"> + <data-source> + <connectionPool min="1" max="1" /> + <login /> + </data-source> + </node> +</domain> diff --git a/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/test-map-v10.map.xml b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/test-map-v10.map.xml new file mode 100644 index 000000000..813087fc9 --- /dev/null +++ b/cayenne-project/src/test/resources/org/apache/cayenne/project/upgrade/handlers/test-map-v10.map.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd" + project-version="10"> + <property name="defaultPackage" value=""/> + <property name="clientSupported" value="true"/> + <property name="defaultClientPackage" value="tmp"/> + <property name="defaultClientSuperclass" value="tmp.ClientSuperClass"/> + <db-entity name="Artist"> + <db-attribute name="untitledAttr" type="CHAR" isPrimaryKey="true" isMandatory="true" length="10"/> + <db-attribute name="untitledAttr1" type="DATE"/> + </db-entity> + <obj-entity name="Artist" dbEntityName="Artist" clientClassName="tmp.Artist" clientSuperClassName="tmp.ClientSuperClass" serverOnly="false"> + </obj-entity> +</data-map> diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java index 88b74b590..54386801a 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/DataChannelDescriptor.java @@ -43,8 +43,8 @@ public class DataChannelDescriptor implements ConfigurationNode, Serializable, X /** * The namespace in which the data map XML file will be created. */ - public static final String SCHEMA_XSD = "http://cayenne.apache.org/schema/10/domain"; - public static final String SCHEMA_XSD_LOCATION = "https://cayenne.apache.org/schema/10/domain.xsd"; + public static final String SCHEMA_XSD = "http://cayenne.apache.org/schema/11/domain"; + public static final String SCHEMA_XSD_LOCATION = "https://cayenne.apache.org/schema/11/domain.xsd"; protected String name; protected Map<String, String> properties; diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoader.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoader.java index 3455b22cf..fbb56ce41 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoader.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoader.java @@ -53,7 +53,7 @@ public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoad /** * Versions of project XML files that this loader can read. */ - static final String[] SUPPORTED_PROJECT_VERSIONS = {"10"}; + static final String[] SUPPORTED_PROJECT_VERSIONS = {"11"}; static { Arrays.sort(SUPPORTED_PROJECT_VERSIONS); } diff --git a/cayenne-server/src/main/java/org/apache/cayenne/map/DataMap.java b/cayenne-server/src/main/java/org/apache/cayenne/map/DataMap.java index add212596..94c6d5988 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/map/DataMap.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/map/DataMap.java @@ -96,8 +96,8 @@ public class DataMap implements Serializable, ConfigurationNode, XMLSerializable * The namespace in which the data map XML file will be created. This is * also the URI to locate a copy of the schema document. */ - public static final String SCHEMA_XSD = "http://cayenne.apache.org/schema/10/modelMap"; - public static final String SCHEMA_XSD_LOCATION = "https://cayenne.apache.org/schema/10/modelMap.xsd"; + public static final String SCHEMA_XSD = "http://cayenne.apache.org/schema/11/modelMap"; + public static final String SCHEMA_XSD_LOCATION = "https://cayenne.apache.org/schema/11/modelMap.xsd"; protected String name; protected String location; diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/cgen.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/cgen.xsd new file mode 100644 index 000000000..2fe707089 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/cgen.xsd @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/cgen" + elementFormDefault="qualified" version="11" + xmlns:cay="http://cayenne.apache.org/schema/11/cgen" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="cgen"> + <xs:complexType> + <xs:sequence> + <xs:element name="excludeEntities" minOccurs="0" type="xs:string"/> + <xs:element name="excludeEmbeddables" minOccurs="0" type="xs:string"/> + <xs:element name="destDir" minOccurs="0" type="xs:string"/> + <xs:element name="mode" minOccurs="0" type="xs:string"/> + <xs:element name="template" minOccurs="0" type="xs:string"/> + <xs:element name="superTemplate" minOccurs="0" type="xs:string"/> + <xs:element name="embeddableTemplate" minOccurs="0" type="xs:string"/> + <xs:element name="embeddableSuperTemplate" minOccurs="0" type="xs:string"/> + <xs:element name="queryTemplate" minOccurs="0" type="xs:string"/> + <xs:element name="querySuperTemplate" minOccurs="0" type="xs:string"/> + <xs:element name="outputPattern" minOccurs="0" type="xs:string"/> + <xs:element name="makePairs" minOccurs="0" type="xs:boolean"/> + <xs:element name="skipRelationshipsLoading" minOccurs="0" type="xs:boolean"/> + <xs:element name="usePkgPath" minOccurs="0" type="xs:boolean"/> + <xs:element name="overwrite" minOccurs="0" type="xs:boolean"/> + <xs:element name="createPropertyNames" minOccurs="0" type="xs:boolean"/> + <xs:element name="superPkg" minOccurs="0" type="xs:string"/> + <xs:element name="createPKProperties" minOccurs="0" type="xs:boolean"/> + </xs:sequence> + </xs:complexType> + </xs:element> + +</xs:schema> \ No newline at end of file diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/dbimport.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/dbimport.xsd new file mode 100644 index 000000000..2ba23dfb5 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/dbimport.xsd @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/dbimport" + xmlns:dbi="http://cayenne.apache.org/schema/11/dbimport" + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="11"> + + <xs:element name="dbImport" substitutionGroup="dbi:config"/> + <xs:element name="config"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="dbi:container"> + <xs:sequence> + <xs:element name="catalog" minOccurs="0" maxOccurs="unbounded" type="dbi:catalog"/> + <xs:element name="schema" minOccurs="0" maxOccurs="unbounded" type="dbi:schema"/> + <xs:element name="tableTypes" minOccurs="0" type="dbi:tableTypes"/> + + <xs:element name="defaultPackage" minOccurs="0" type="xs:string"/> + <xs:element name="forceDataMapCatalog" minOccurs="0" type="xs:boolean"/> + <xs:element name="forceDataMapSchema" minOccurs="0" type="xs:boolean"/> + <xs:element name="meaningfulPkTables" minOccurs="0" type="xs:string"/> + <xs:element name="namingStrategy" minOccurs="0" type="xs:string"/> + <xs:element name="skipPrimaryKeyLoading" minOccurs="0" type="xs:boolean"/> + <xs:element name="skipRelationshipsLoading" minOccurs="0" type="xs:boolean"/> + <xs:element name="stripFromTableNames" minOccurs="0" type="xs:string"/> + <xs:element name="useJava7Types" minOccurs="0" type="xs:boolean"/> + <xs:element name="usePrimitives" minOccurs="0" type="xs:boolean"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:simpleType name="db-type"> + <xs:restriction base="xs:string"> + <xs:pattern value="[0-9a-zA-Z$_.]+"/> + </xs:restriction> + </xs:simpleType> + + <xs:complexType name="tableTypes"> + <xs:sequence> + <xs:element name="tableType" type="dbi:db-type" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="includeTable" mixed="true"> + <xs:sequence> + <xs:element name="name" minOccurs="0" type="xs:string"/> + <xs:element name="includeColumn" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="excludeColumn" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="container" abstract="true"> + <xs:sequence> + <xs:element name="includeTable" type="dbi:includeTable" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="excludeTable" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="includeColumn" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="excludeColumn" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="includeProcedure" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="excludeProcedure" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="schema"> + <xs:complexContent> + <xs:extension base="dbi:container"> + <xs:sequence> + <xs:element name="name" type="dbi:db-type"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="catalog"> + <xs:complexContent> + <xs:extension base="dbi:container"> + <xs:sequence> + <xs:element name="name" type="dbi:db-type"/> + <xs:element name="schema" type="dbi:schema" minOccurs="0" maxOccurs="unbounded"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + +</xs:schema> \ No newline at end of file diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/domain.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/domain.xsd new file mode 100644 index 000000000..ebee58ba7 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/domain.xsd @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/domain" + elementFormDefault="qualified" version="11" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:cay="http://cayenne.apache.org/schema/11/domain"> + + <xs:element name="domain"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:property"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:map"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:node"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="project-version" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="property"> + <xs:annotation> + <xs:documentation>A generic property used by other elements.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="value" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="map"> + <xs:annotation> + <xs:documentation>Link to an external file with data map.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="node"> + <xs:annotation> + <xs:documentation>Data node description.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:map-ref"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:data-source"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="factory" use="required" type="xs:string"/> + <xs:attribute name="adapter" type="xs:string"/> + <xs:attribute name="schema-update-strategy" type="xs:string"/> + <xs:attribute name="parameters" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="map-ref"> + <xs:annotation> + <xs:documentation>A reference to a map.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="data-source"> + <xs:annotation> + <xs:documentation>Data source configuration.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="1" ref="cay:driver"/> + <xs:element minOccurs="0" maxOccurs="1" ref="cay:url"/> + <xs:element minOccurs="0" maxOccurs="1" ref="cay:connectionPool"/> + <xs:element minOccurs="0" maxOccurs="1" ref="cay:login"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="driver"> + <xs:complexType> + <xs:attribute name="value" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="url"> + <xs:complexType> + <xs:attribute name="value" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="connectionPool"> + <xs:complexType> + <xs:attribute name="min" use="required" type="xs:int"/> + <xs:attribute name="max" use="required" type="xs:int"/> + </xs:complexType> + </xs:element> + + <xs:element name="login"> + <xs:complexType> + <xs:attribute name="userName" type="xs:string"/> + <xs:attribute name="password" type="xs:string"/> + <xs:attribute name="passwordLocation" type="xs:string"/> + <xs:attribute name="passwordSource" type="xs:string"/> + <xs:attribute name="encoderClass" type="xs:string"/> + <xs:attribute name="encoderKey" type="xs:string"/> + <xs:attribute name="encoderSalt" type="xs:string"/> + </xs:complexType> + </xs:element> + +</xs:schema> \ No newline at end of file diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/graph.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/graph.xsd new file mode 100644 index 000000000..f0332fa77 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/graph.xsd @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/graph" + elementFormDefault="qualified" version="11" + xmlns:cay="http://cayenne.apache.org/schema/11/graph" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="graphs"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:graph"/> + </xs:sequence> + <xs:attribute name="selected" type="xs:string" /> + </xs:complexType> + </xs:element> + + <xs:element name="graph"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:entity"/> + </xs:sequence> + <xs:attribute name="type" type="xs:string" /> + <xs:attribute name="scale" type="xs:double" /> + </xs:complexType> + </xs:element> + + <xs:element name="entity"> + <xs:complexType> + <xs:attribute name="name" type="xs:string" /> + <xs:attribute name="x" type="xs:double" /> + <xs:attribute name="y" type="xs:double" /> + <xs:attribute name="width" type="xs:double" /> + <xs:attribute name="height" type="xs:double" /> + </xs:complexType> + </xs:element> + +</xs:schema> \ No newline at end of file diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/info.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/info.xsd new file mode 100644 index 000000000..c2c103a44 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/info.xsd @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/info" + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="11"> + <xs:element name="property"> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="value" type="xs:string"/> + </xs:complexType> + </xs:element> +</xs:schema> \ No newline at end of file diff --git a/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/modelMap.xsd b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/modelMap.xsd new file mode 100644 index 000000000..014f419f2 --- /dev/null +++ b/cayenne-server/src/main/resources/org/apache/cayenne/schema/11/modelMap.xsd @@ -0,0 +1,364 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<!-- + Cayenne entity map schema + Defines format of Cayenne DataMap XML files (*.map.xml). DataMap files contain + the metadata needed for Cayenne object-relational features. Multiple DataMaps + are usually combined in one shared namespace, so the elements of the DataMap + may reference objects from other DataMaps. +--> +<xs:schema targetNamespace="http://cayenne.apache.org/schema/11/modelMap" + xmlns:cay="http://cayenne.apache.org/schema/11/modelMap" + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="11"> + <xs:element name="data-map"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:property"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:embeddable"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:procedure"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:db-entity"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:obj-entity"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:db-relationship"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:obj-relationship"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:query"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="project-version" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="db-entity"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="cay:db-attribute"/> + <xs:element minOccurs="0" ref="cay:db-key-generator"/> + + <!-- Qualifier for DB Entity --> + <xs:element minOccurs="0" ref="cay:qualifier"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="schema" type="xs:string"/> + <xs:attribute name="catalog" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="db-attribute"> + <xs:annotation> + <xs:documentation>A database column.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="isMandatory" type="xs:boolean"/> + <xs:attribute name="isPrimaryKey" type="xs:boolean"> + <xs:annotation> + <xs:documentation>If true, the value of attribute is unique and used as a primary key identifier.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="isGenerated" type="xs:boolean"/> + <xs:attribute name="length" type="xs:integer"/> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="scale" type="xs:integer"/> + <xs:attribute name="type" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="obj-entity"> + <xs:annotation> + <xs:documentation>A persistent Java class managed by Cayenne.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" ref="cay:qualifier"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:embedded-attribute"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:obj-attribute"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:attribute-override"/> + + <!-- Callbacks --> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:post-add"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:pre-persist"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:post-persist"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:pre-update"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:post-update"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:pre-remove"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:post-remove"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:post-load"/> + + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="className" type="xs:string"/> + <xs:attribute name="abstract" type="xs:boolean"/> + <xs:attribute name="readOnly" type="xs:boolean"/> + <xs:attribute name="dbEntityName" type="xs:string"/> + <xs:attribute name="lock-type" type="xs:string"/> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="superClassName" type="xs:string"/> + <xs:attribute name="superEntityName" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="qualifier" type="xs:string"/> + + <xs:element name="obj-attribute"> + <xs:complexType> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="db-attribute-path" type="xs:string"/> + <xs:attribute name="lock" type="xs:boolean"/> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="type" use="required" type="xs:string"/> + <xs:attribute name="lazy" type="xs:boolean"/> + </xs:complexType> + </xs:element> + + <xs:element name="attribute-override"> + <xs:complexType> + <xs:attribute name="db-attribute-path" type="xs:string"/> + <xs:attribute name="lock" type="xs:boolean"/> + <xs:attribute name="name" type="xs:string"/> + <xs:attribute name="type" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="db-relationship"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="1" maxOccurs="unbounded" ref="cay:db-attribute-pair"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="source" use="required" type="xs:string"/> + <xs:attribute name="target" use="required" type="xs:string"/> + <xs:attribute name="toDependentPK" type="xs:boolean"/> + <xs:attribute name="toMany" type="xs:boolean"/> + </xs:complexType> + </xs:element> + <xs:element name="db-attribute-pair"> + <xs:complexType> + <xs:attribute name="source" use="required" type="xs:string"/> + <xs:attribute name="target" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="obj-relationship"> + <xs:complexType> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="db-relationship-path" use="required" type="xs:string"/> + <xs:attribute name="deleteRule" type="xs:string"/> + <xs:attribute name="lock" type="xs:boolean"/> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="source" use="required" type="xs:string"/> + <xs:attribute name="target" use="required" type="xs:string"/> + <xs:attribute name="collection-type" type="xs:string"/> + <xs:attribute name="map-key" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="query"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:property"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:sql"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:ejbql"/> + <xs:element name="qualifier" minOccurs="0" maxOccurs="unbounded" type="xs:string"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:ordering"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="cay:prefetch"/> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="type" use="required" type="xs:string"/> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="root" type="xs:string"/> + <xs:attribute name="root-name" type="xs:string"/> + <xs:attribute name="result-entity" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="ordering"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="descending" type="xs:boolean"/> + <xs:attribute name="ignore-case" type="xs:boolean"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="prefetch"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="type" type="xs:string"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="sql"> + <xs:annotation> + <xs:documentation>Defines arbitrary SQL statement. Note that SQL statement can be customized for different SQL dialects per DbAdapter class. If no adapter-specific statement is found, the one with no adapter label is used by default.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="adapter-class" type="xs:string"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="ejbql" type="xs:string"/> + + <xs:element name="property"> + <xs:annotation> + <xs:documentation>A generic property used by other elements.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="value" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="embeddable"> + <xs:complexType> + <xs:sequence> + <xs:element name="embeddable-attribute" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="type" use="required" type="xs:string"/> + <xs:attribute name="db-attribute-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="className" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="embedded-attribute"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" + ref="cay:embeddable-attribute-override"/> + </xs:sequence> + <xs:attribute name="type" use="required" type="xs:string"/> + <xs:attribute name="name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="embeddable-attribute-override"> + <xs:complexType> + <xs:attribute name="db-attribute-path" use="required" type="xs:string"/> + <xs:attribute name="name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="procedure"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" name="procedure-parameter"> + <xs:complexType> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="type" use="required" type="xs:string"/> + <xs:attribute name="length" type="xs:integer"/> + <xs:attribute name="direction" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:string"/> + <xs:attribute name="schema" type="xs:string"/> + <xs:attribute name="catalog" type="xs:string"/> + <xs:attribute name="returningValue" type="xs:boolean"/> + </xs:complexType> + </xs:element> + <xs:element name="pre-update"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="post-persist"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="post-update"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="post-add"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="pre-persist"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="post-remove"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="post-load"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="pre-remove"> + <xs:complexType> + <xs:attribute name="method-name" use="required" type="xs:string"/> + </xs:complexType> + </xs:element> + + <xs:element name="db-key-generator"> + <xs:annotation> + <xs:documentation>Used to install the Automatic Sequence/Key Generation facility for db-entity. This feature is intended for use with simple (non-compound) integral primary keys.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="db-generator-type" type="xs:string"> + <xs:annotation> + <xs:documentation>Specifies the Key Generation Method that will be employed + 'ORACLE' - use Oracle's SEQUENCE + 'NAMED_SEQUENCE_TABLE' - use USER designated SEQUENCE TABLE. User specifies the name of a DBMS Table with the schema (sequence INT) which will be used to hold sequence values (not supported yet)</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="db-generator-name" type="xs:string"> + <xs:annotation> + <xs:documentation>For db-generator-type ORACLE this is the name of the ORACLE SEQUENCE to use. The SEQUENCE is assumed to already exist in the Database. +If this is db-generator-type NAMED_SEQUENCE_TABLE Key Generation, this specifies the name of the SEQUENCE TABLE to use. The NAMED_SEQUENCE_TABLE is assumed to already exist in the database.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element minOccurs="0" name="db-key-cache-size" type="xs:integer"> + <xs:annotation> + <xs:documentation>Size of key cache. For db-generator-type ORACLE , this value MUST match the Oracle SEQUENCE INCREMENT value. If there is a mismatch between this value and the Oracle SEQUENCE INCREMENT value, then there will likely be duplicate key problems. +For db-generator-type NAMED_SEQUENCE_TABLE , this tells how many keys the Container will fetch in a single DBMS call.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> diff --git a/cayenne-server/src/test/resources/cayenne-testmap.xml b/cayenne-server/src/test/resources/cayenne-testmap.xml index abbcfd445..cef48fe1e 100644 --- a/cayenne-server/src/test/resources/cayenne-testmap.xml +++ b/cayenne-server/src/test/resources/cayenne-testmap.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<domain xmlns="http://cayenne.apache.org/schema/10/domain" +<domain xmlns="http://cayenne.apache.org/schema/11/domain" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/domain https://cayenne.apache.org/schema/10/domain.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/domain https://cayenne.apache.org/schema/11/domain.xsd" + project-version="11"> <map name="testmap"/> </domain> diff --git a/cayenne-server/src/test/resources/testmap.map.xml b/cayenne-server/src/test/resources/testmap.map.xml index 6ce6dfafa..80ba5fb0a 100644 --- a/cayenne-server/src/test/resources/testmap.map.xml +++ b/cayenne-server/src/test/resources/testmap.map.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" +<data-map xmlns="http://cayenne.apache.org/schema/11/modelMap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap https://cayenne.apache.org/schema/10/modelMap.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/modelMap https://cayenne.apache.org/schema/11/modelMap.xsd" + project-version="11"> <property name="defaultPackage" value="org.apache.cayenne.testdo.testmap"/> <property name="defaultSuperclass" value="org.apache.cayenne.CayenneDataObject"/> <procedure name="cayenne_tst_out_proc"> @@ -84,7 +84,6 @@ <obj-entity name="Artist" className="org.apache.cayenne.testdo.testmap.Artist" dbEntityName="ARTIST"> <obj-attribute name="artistName" type="java.lang.String" db-attribute-path="ARTIST_NAME"/> <obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/> - <info:property xmlns:info="http://cayenne.apache.org/schema/10/info" name="comment" value="Example of a comment"/> </obj-entity> <obj-entity name="ArtistCallback" className="org.apache.cayenne.testdo.testmap.ArtistCallback" dbEntityName="ARTIST_CT"> <obj-attribute name="artistName" type="java.lang.String"/> @@ -294,16 +293,4 @@ VALUES (#bind($id), #bind($title), #bind($price))]]></sql> <property name="cayenne.GenericSelectQuery.fetchingDataRows" value="true"/> <sql><![CDATA[select * from ARTIST]]></sql> </query> - <cgen xmlns="http://cayenne.apache.org/schema/10/cgen"> - <destDir>../java</destDir> - <mode>entity</mode> - <template>templates/v4_1/subclass.vm</template> - <superTemplate>templates/v4_1/superclass.vm</superTemplate> - <outputPattern>*.java</outputPattern> - <makePairs>true</makePairs> - <usePkgPath>true</usePkgPath> - <overwrite>false</overwrite> - <createPropertyNames>false</createPropertyNames> - <createPKProperties>true</createPKProperties> - </cgen> </data-map> diff --git a/maven-plugins/cayenne-tools-itest/src/test/resources/cayenne-client.xml b/maven-plugins/cayenne-tools-itest/src/test/resources/cayenne-client.xml index 355ac28fb..32200f28d 100644 --- a/maven-plugins/cayenne-tools-itest/src/test/resources/cayenne-client.xml +++ b/maven-plugins/cayenne-tools-itest/src/test/resources/cayenne-client.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<domain xmlns="http://cayenne.apache.org/schema/10/domain" - project-version="10"> +<domain xmlns="http://cayenne.apache.org/schema/11/domain" + project-version="11"> <map name="testmap-client"/> </domain> diff --git a/maven-plugins/cayenne-tools-itest/src/test/resources/embeddable.map.xml b/maven-plugins/cayenne-tools-itest/src/test/resources/embeddable.map.xml index 10c4db62c..9cce86baa 100644 --- a/maven-plugins/cayenne-tools-itest/src/test/resources/embeddable.map.xml +++ b/maven-plugins/cayenne-tools-itest/src/test/resources/embeddable.map.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" +<data-map xmlns="http://cayenne.apache.org/schema/11/modelMap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/modelMap http://cayenne.apache.org/schema/11/modelMap.xsd" + project-version="11"> <property name="defaultPackage" value="org.apache.cayenne.testdo.embeddable"/> <embeddable className="org.apache.cayenne.testdo.embeddable.Embeddable1"> <embeddable-attribute name="embedded10" type="java.lang.String" db-attribute-name="EMBEDDED10"/> diff --git a/maven-plugins/cayenne-tools-itest/src/test/resources/testmap.map.xml b/maven-plugins/cayenne-tools-itest/src/test/resources/testmap.map.xml index 7b95e50e5..defca76f3 100644 --- a/maven-plugins/cayenne-tools-itest/src/test/resources/testmap.map.xml +++ b/maven-plugins/cayenne-tools-itest/src/test/resources/testmap.map.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap" +<data-map xmlns="http://cayenne.apache.org/schema/11/modelMap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd" - project-version="10"> + xsi:schemaLocation="http://cayenne.apache.org/schema/11/modelMap http://cayenne.apache.org/schema/11/modelMap.xsd" + project-version="11"> <property name="defaultPackage" value="org.apache.cayenne.testdo.testmap"/> <property name="defaultSuperclass" value="org.apache.cayenne.CayenneDataObject"/> <procedure name="cayenne_tst_out_proc">
