TUSCANY-3679: Apply changes to update sdo impl to use EMF v2.5. Thanks to Elio Damaggio and Florian Pinel for the work

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1002496 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2010-09-29 07:10:57 +00:00
parent 88f35f5e5a
commit 1f0de49cbd
482 changed files with 111629 additions and 0 deletions

View file

@ -0,0 +1,34 @@
Building the SDO Release from a Source Distribution
===================================================
Note, these instructions are for building the SDO binary release from
source, not for establishing a development environment. If you wish to
participate in sdo development, follow the instructions at
http://incubator.apache.org/tuscany/developing-sdo-java.html
Initial Setup
-------------
1) Install J2SE JDK 1.4.2 or above
2) Install Maven: Download Maven 2.0.7 (download from http://maven.apache.org/download.html) Follow the maven instructions for
configuring the JAVA_HOME environment variable, and ensuring that the "mvn" command is on your execution PATH.
Building
--------
1) If you have chosen to install a JDK at version 5 then all will be fine, but there is one value add component in the
Tuscany SDO implementation which relies on new JDK 5.0 features. If you do not wish to use JDK 5 for the following
build step, then you will need to do mvn -Pjava_1_4_maven, as this profile option excludes the JDK5 dependent features.
2) In a command window/shell, change to the top level directory of the Tuscany SDO Java source distribution.
3) Execute: mvn
This will install the sdo implementation and tools jars in your local maven repository
4) If you wish to rebuild the Tuscany SDO Java binary dstribution change directory to "distribution" and run mvn
This will create archives of the binary and source distributions in the target subdirectory of the distribution directory
Note: Depending on the load being experienced by remote Maven 2.0 repositories you may have to execute mvn several
times until required dependencies are all located in your local maven repository. After you have completed a
full successful build you can use "mvn -o" which builds without trying to access updated build dependencies (offline mode) and is much faster.

View file

@ -0,0 +1,280 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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
http://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.
===============================================================================================================
Apache Tuscany SDO for Java Subcomponents
=========================================:
The Tuscany SDO for Java release includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
These files being ...
commonj/sdo/ChangeSummary.java
commonj/sdo/DataGraph.java
commonj/sdo/DataObject.java
commonj/sdo/helper/CopyHelper.java
commonj/sdo/helper/DataFactory.java
commonj/sdo/helper/DataHelper.java
commonj/sdo/helper/EqualityHelper.java
commonj/sdo/helper/HelperContext.java
commonj/sdo/helper/TypeHelper.java
commonj/sdo/helper/XMLDocument.java
commonj/sdo/helper/XMLHelper.java
commonj/sdo/helper/XSDHelper.java
commonj/sdo/impl/ExternalizableDelegator.java
commonj/sdo/Property.java
commonj/sdo/Sequence.java
commonj/sdo/Type.java
xml/datagraph.xsd
xml/sdoJava.xml
xml/sdoJava.xsd
xml/sdoModel.xml
xml/sdoModel.xsd
xml/sdoXML.xml
xml/sdoXML.xsd
License for the Service Data Objects JavaDoc, Interface Definition files
and XSD files.
The Service Data Objects JavaDoc, Interface Definition files and XSD files
are being provided by the copyright holders under the following license.
By using and/or copying this work, you agree that you have read,
understood and will comply with the following terms and conditions:
Permission to copy, display, make derivative works of and distribute
the Service Data Objects JavaDoc, Interface Definition files and XSD files
(the "Artifacts") in any medium without fee or royalty is hereby granted,
provided that you include the following on ALL copies of the Artifacts,
or portions thereof, that you make:
1. A link or URL to the Artifacts at this location:
http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
2. The full text of this copyright notice as shown in the Artifacts.
THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
ARTIFACTS AND THE IMPLEMENTATION OF THEIR CONTENTS,
INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OR TITLE.
THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
USE OR DISTRIBUTION OF THE ARTIFACTS.
The name and trademarks of the Authors may NOT be used in any manner,
including advertising or publicity pertaining to the Service Data
Objects Specification or its contents without specific, written prior
permission. Title to copyright in the Service Data Objects
Specification will at all times remain with the Authors.
No other rights are granted by implication, estoppel or otherwise.
Revision level 1.11, last updated on 2007/12/21
=================================================================================================================

View file

@ -0,0 +1,11 @@
Apache Tuscany
Copyright (c) 2005 - 2008 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product also includes software developed by the Open Service Oriented Architecture organisation
(http://osoa.org).
Please see the LICENSE file present in the root directory of this
distribution.

View file

@ -0,0 +1,16 @@
Tuscany SDO for ${sdo.version} Source Distribution Readme File
See the LICENSE, DISCLAIMER and NOTICE files for legal information concerning this distribution.
See the RELEASE_NOTES file for a summary of what's new with this release.
See the BUILDING file for instructions on how to build Tuscany SDO Java from this source distribution.
Documentation
For general documentation about the Tuscany project and the SDO for Java, see the Tuscany website
http://incubator.apache.org/tuscany

View file

@ -0,0 +1,34 @@
Trunk version -- edit this as appropriate in the branch / tag of a release
What's New in SDO Java XXXX
Apache Tuscany's SDO Java Release *********** is
For previous revision history, take a look at
http://svn.apache.org/viewvc/tuscany/tags/java/sdo/*******/RELEASE_NOTES
SDO Java ************** is a superset of previous SDO xxxxxxxxxxxx release.
Anything in xxxxxxxxxxxxxxxxx is also in *********, but ********** contains
features and bugfixes not present in xxxxxxxxxxxx release.
Downloading
===========
Please visit http://tuscany.apache.org/sdo-java-releases.html
New Features and Fixes
======================
For more detail on these fixes and features please see ...
https://issues.apache.org/jira
New Feature
.....
Improvement
.....
Bug
.....
Wish
.....

View file

@ -0,0 +1,137 @@
<?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
*
* http://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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-sdo-distribution</artifactId>
<name>Apache Tuscany SDO Distribution</name>
<packaging>pom</packaging>
<properties>
<maven.test.skip>true</maven.test.skip>
<tuscany.version>${pom.version}</tuscany.version>
<sdo.previousversion>1.1.1</sdo.previousversion>
</properties>
<!-- in the sca build the bundle module is creating the merged jar which contains all the tuscany
jars in a single jar (similar as suggested for sdo), the manfest module is creating a jar with a
manifest classpath to make it easier to add tuscany-sca to a classpath
<modules>
<module>bundle</module>
<module>manifest</module>
</modules>
-->
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-lib</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-impl</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-tools</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>sample-sdo</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<!-- <version>${dependency.plugin.version}</version> -->
<executions>
<execution>
<id>unpack-javadoc</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-api-r${specVersion}</artifactId>
<classifier>javadoc</classifier>
<version>${pom.version}</version>
<outputDirectory>${project.build.directory}/javadoc/sdo</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-lib</artifactId>
<classifier>javadoc</classifier>
<version>${pom.version}</version>
<outputDirectory>${project.build.directory}/javadoc/tuscany-sdo</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>sample-sdo</artifactId>
<classifier>javadoc</classifier>
<version>${pom.version}</version>
<outputDirectory>${project.build.directory}/javadoc/sdo-samples</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>distribution-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
<finalName>apache-tuscany-sdo-${pom.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,124 @@
<?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
*
* http://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.
-->
<assembly>
<!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
<id></id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<fileSets>
<!-- Add the text files to the top-level directory -->
<fileSet>
<directory>src/main/release/bin</directory>
<outputDirectory>tuscany-sdo-${sdo.version}</outputDirectory>
<includes>
<include>INSTALL</include>
<include>NOTICE</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/release/bin/samples</directory>
<outputDirectory>tuscany-sdo-${sdo.version}/docs/javadoc/sdo-samples</outputDirectory>
<includes>
<include>sampleProgramContents.html</include>
</includes>
</fileSet>
<!-- Add javadoc to the doc directory -->
<fileSet>
<directory>target/javadoc</directory>
<outputDirectory>tuscany-sdo-${sdo.version}/docs/javadoc</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<!-- Add all the sample source to the binary distribution's samples directory -->
<fileSet>
<directory>../sample</directory>
<outputDirectory>tuscany-sdo-${sdo.version}/samples</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>pom.xml</exclude>
<exclude>*/.classpath</exclude>
<exclude>*/.project</exclude>
<exclude>*/target/classes</exclude>
<exclude>*/target/classes/**/*</exclude>
<exclude>*/target/test-classes</exclude>
<exclude>*/target/test-classes/**/*</exclude>
<exclude>*/target/surefire-reports</exclude>
<exclude>*/target/surefire-reports/**/*</exclude>
</excludes>
</fileSet>
</fileSets>
<files>
<file>
<source>../RELEASE_NOTES</source>
<outputDirectory>tuscany-sdo-${sdo.version}</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>src/main/release/bin/samples/runsamples.bat</source>
<outputDirectory>tuscany-sdo-${sdo.version}/samples</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>src/main/release/bin/samples/runsamples.sh</source>
<outputDirectory>tuscany-sdo-${sdo.version}/samples</outputDirectory>
<filtered>true</filtered>
<fileMode>0755</fileMode>
</file>
<file>
<source>src/main/release/bin/samples/README</source>
<outputDirectory>tuscany-sdo-${sdo.version}/samples</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>src/main/release/bin/LICENSE</source>
<outputDirectory>tuscany-sdo-${sdo.version}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>tuscany-sdo-${sdo.version}/lib</outputDirectory>
<includes>
<include>org.apache.tuscany.sdo:tuscany-sdo-api-r2.1</include>
<include>org.apache.tuscany.sdo:tuscany-sdo-lib</include>
<include>org.apache.tuscany.sdo:tuscany-sdo-impl</include>
<include>org.apache.tuscany.sdo:tuscany-sdo-tools</include>
<include>org.apache.tuscany.sdo:sample-sdo</include>
</includes>
<fileMode>0644</fileMode>
</dependencySet>
</dependencySets>
</assembly>

View file

@ -0,0 +1,80 @@
<?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
*
* http://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.
-->
<assembly>
<!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
<id>src</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>..</directory>
<outputDirectory>tuscany-sdo-${tuscany.version}-src</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/target</exclude>
<exclude>**/target/**/*</exclude>
<exclude>**/build</exclude>
<exclude>**/build/**/*</exclude>
<exclude>**/.settings</exclude>
<exclude>**/.classpath</exclude>
<exclude>**/.project</exclude>
<exclude>**/.wtpmodules</exclude>
<exclude>**/surefire*</exclude>
<exclude>**/cobertura.ser</exclude>
<exclude>bin</exclude>
<exclude>bin/*</exclude>
<exclude>**/var/journal</exclude>
<exclude>**/build.out*</exclude>
<exclude>impl/.felix</exclude>
<exclude>impl/.felix/**/*</exclude>
</excludes>
</fileSet>
</fileSets>
<files>
<file>
<source>../README</source>
<outputDirectory>tuscany-sdo-${sdo.version}-src</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>../LICENSE</source>
<outputDirectory>tuscany-sdo-${sdo.version}-src</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>../NOTICE</source>
<outputDirectory>tuscany-sdo-${sdo.version}-src</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>../RELEASE_NOTES</source>
<outputDirectory>tuscany-sdo-${sdo.version}-src</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

View file

@ -0,0 +1,4 @@
Tuscany Java SDO Installation
Unpack the binary archive into a location of your choice and add each of the jar files in the
lib directory to your CLASSPATH variable.

View file

@ -0,0 +1,420 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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
http://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.
===============================================================================================================
Apache Tuscany SDO for Java Subcomponents
=========================================:
The Tuscany SDO for Java release includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-${sdo.version}.jar)
These files being ...
commonj/sdo/ChangeSummary$Setting.class
commonj/sdo/ChangeSummary.class
commonj/sdo/DataGraph.class
commonj/sdo/DataObject.class
commonj/sdo/helper/CopyHelper.class
commonj/sdo/helper/DataFactory.class
commonj/sdo/helper/DataHelper.class
commonj/sdo/helper/EqualityHelper.class
commonj/sdo/helper/HelperContext.class
commonj/sdo/helper/TypeHelper.class
commonj/sdo/helper/XMLDocument.class
commonj/sdo/helper/XMLHelper.class
commonj/sdo/helper/XSDHelper.class
commonj/sdo/impl/ExternalizableDelegator$Resolvable.class
commonj/sdo/impl/ExternalizableDelegator.class
commonj/sdo/Property.class
commonj/sdo/Sequence.class
commonj/sdo/Type.class
xml/datagraph.xsd
xml/sdoJava.xml
xml/sdoJava.xsd
xml/sdoModel.xml
xml/sdoModel.xsd
xml/sdoXML.xml
xml/sdoXML.xsd
License for the Service Data Objects JavaDoc, Interface Definition files
and XSD files.
The Service Data Objects JavaDoc, Interface Definition files and XSD files
are being provided by the copyright holders under the following license.
By using and/or copying this work, you agree that you have read,
understood and will comply with the following terms and conditions:
Permission to copy, display, make derivative works of and distribute
the Service Data Objects JavaDoc, Interface Definition files and XSD files
(the "Artifacts") in any medium without fee or royalty is hereby granted,
provided that you include the following on ALL copies of the Artifacts,
or portions thereof, that you make:
1. A link or URL to the Artifacts at this location:
http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
2. The full text of this copyright notice as shown in the Artifacts.
THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
ARTIFACTS AND THE IMPLEMENTATION OF THEIR CONTENTS,
INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OR TITLE.
THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
USE OR DISTRIBUTION OF THE ARTIFACTS.
The name and trademarks of the Authors may NOT be used in any manner,
including advertising or publicity pertaining to the Service Data
Objects Specification or its contents without specific, written prior
permission. Title to copyright in the Service Data Objects
Specification will at all times remain with the Authors.
No other rights are granted by implication, estoppel or otherwise.
Revision level 1.11, last updated on 2007/12/21
=================================================================================================================
Note that the remaining files in the jar tuscany-sdo-api-r2.1-${sdo.version}.jar ....
commonj/sdo/impl/HelperProvider$1.class
commonj/sdo/impl/HelperProvider$2.class
commonj/sdo/impl/HelperProvider$DefaultHelperContext.class
commonj/sdo/impl/HelperProvider.class
commonj/sdo/impl/NoHelperProviderException.class
are licensed by the Apache License Version 2.0, January 2004 as laid out above
=================================================================================================================
For the Eclipse EMF components
(codegen-2.2.3.jar
codegen-ecore-2.2.3.jar
common-2.2.3.jar
ecore-2.2.3.jar
ecore-change-2.2.3.jar
ecore-xmi-2.2.3.jar
xsd-2.2.3.jar)
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within the Program.
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
=======================================================================================================================
For the StAX components (stax-api-1.0.1.jar and wstx-asl-3.2.1.jar)
These components are covered by the Apache License Version 2.0, January 2004, as above.
========================================================================================================================
For the backport-util-concurrent-3.0.jar library
Creative Commons Public Domain Dedication
Copyright-Only Dedication (based on United States law) or Public Domain Certification
The person or persons who have associated work with this document (the "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of his knowledge, the work of authorship identified is in the public domain of the country from which the work is published, or (b) hereby dedicates whatever copyright the dedicators holds in the work of authorship identified below (the "Work") to the public domain. A certifier, moreover, dedicates any copyright interest he may have in the associated work, and for these purposes, is described as a "dedicator" below.
A certifier has taken reasonable steps to verify the copyright status of this work. Certifier recognizes that his good faith efforts may not shield him from liability if in fact the work certified is not in the public domain.
Dedicator makes this dedication for the benefit of the public at large and to the detriment of the Dedicator's heirs and successors. Dedicator intends this dedication to be an overt act of relinquishment in perpetuity of all present and future rights under copyright law, whether vested or contingent, in the Work. Dedicator understands that such relinquishment of all rights includes the relinquishment of all rights to enforce (by lawsuit or otherwise) those copyrights in the Work.
Dedicator recognizes that, once placed in the public domain, the Work may be freely reproduced, distributed, transmitted, used, modified, built upon, or otherwise exploited by anyone for any purpose, commercial or non-commercial, and in any way, including by methods that have not yet been invented or conceived.

View file

@ -0,0 +1,17 @@
Apache Tuscany
Copyright (c) 2005 - 2008 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product also includes software developed by the Eclipse Modeling Framework project
(http://www.eclipse.org/emf/)
This product also includes software developed by the Open Service Oriented Architecture organisation
(http://osoa.org).
This product also includes software developed by the Codehaus Opensource Software Community
http://codehaus.org/
Please see the LICENSE file present in the root directory of this
distribution.

View file

@ -0,0 +1,23 @@
Tuscany SDO for ${sdo.version} Binary Distribution Readme File
See the LICENSE, DISCLAIMER and NOTICE files for legal information concerning this distribution.
See the RELEASE_NOTES file for a summary of what's new with this release.
See the INSTALL file for instructions on how to use Tuscany SDO Java provided in this binary distribution.
See the docs/javadoc/sdo-samples/index.html file for instructions on how to run the sample programs.
Documentation
For general documentation about the Tuscany project and the SDO for Java, see the Tuscany website
http://incubator.apache.org/tuscany
This distribution contains javadoc for the SDO 2.1 API, the Tuscany SDO extensions API, and the Tuscany SDO samples.
Samples
Sample source code is included with this binary distribution.

View file

@ -0,0 +1,11 @@
Apache Tuscany SDO Java Sample Programs
Documentation for these samples may be found in the docs/javadoc/sdo-samples directory
of this distribution.
The runsamples.sh and runsamples.bat scripts in their unedited form
provide a way to run all of the samples sequentially. If you run these scripts
from within the directory they are found in, they will run correctly.
If you run them from elsewhere you will need to edit the scripts and set the
BINARY_BASE variable to the path in your filesystem where you unpacked the
SDO distribution.

View file

@ -0,0 +1,26 @@
REM Licensed to the Apache Software Foundation (ASF) under one
REM or more contributor license agreements. See the NOTICE file
REM distributed with this work for additional information
REM regarding copyright ownership. The ASF licenses this file
REM to you under the Apache License, Version 2.0 (the
REM "License"); you may not use this file except in compliance
REM with the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing,
REM software distributed under the License is distributed on an
REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM KIND, either express or implied. See the License for the
REM specific language governing permissions and limitations
REM under the License.
@echo off
set BINARY_BASE=..
set RELEASE=${sdo.version}
echo SDO Sample Programs. Running with BINARY_BASE set to %BINARY_BASE%
echo If this script fails with ClassDefNotFound errors you probably need to
echo edit the BINARY_BASE variable in the script to point to the location
echo where you unpacked the Tuscany SDO binary distribution
set LIB=%BINARY_BASE%\lib
set CLASSPATH=%LIB%\sample-sdo-%RELEASE%.jar;%LIB%\sdo-api-r2.1-%RELEASE%.jar;%LIB%\tuscany-sdo-lib-%RELEASE%.jar;%LIB%\tuscany-sdo-impl-%RELEASE%.jar;%LIB%\tuscany-sdo-tools-%RELEASE%.jar;%LIB%\codegen-ecore-2.2.3.jar;%LIB%\codegen-2.2.3.jar;%LIB%\ecore-2.2.3.jar;%LIB%\ecore-change-2.2.3.jar;%LIB%\ecore-xmi-2.2.3.jar;%LIB%\common-2.2.3.jar;%LIB%\xsd-2.2.3.jar;%LIB%\stax-api-1.0.1.jar;%LIB%\wstx-asl-3.2.1.jar
java org.apache.tuscany.samples.sdo.ExecuteSamples

View file

@ -0,0 +1,27 @@
#!/bin/sh
# 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
#
# http://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.
echo SDO Sample Programs. Running with BINARY_BASE set to $BINARY_BASE
echo If this script fails with ClassDefNotFound errors you probably need to
echo edit the BINARY_BASE variable in the script to point to the location
echo where you unpacked the Tuscany SDO binary distribution
export BINARY_BASE=..
export RELEASE=${sdo.version}
export LIB=$BINARY_BASE/lib
export CLASSPATH=$LIB/sample-sdo-$RELEASE.jar:$LIB/tuscany-sdo-api-r2.1-$RELEASE.jar:$LIB/tuscany-sdo-lib-$RELEASE.jar:$LIB/tuscany-sdo-impl-$RELEASE.jar:$LIB/tuscany-sdo-tools-$RELEASE.jar:$LIB/codegen-ecore-2.2.3.jar:$LIB/codegen-2.2.3.jar:$LIB/ecore-2.2.3.jar:$LIB/ecore-change-2.2.3.jar:$LIB/ecore-xmi-2.2.3.jar:$LIB/common-2.2.3.jar:$LIB/xsd-2.2.3.jar:$LIB/stax-api-1.0.1.jar:$LIB/wstx-asl-3.2.1.jar
echo $CLASSPATH
java org.apache.tuscany.samples.sdo.ExecuteSamples

View file

@ -0,0 +1,244 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Note: This file is GENERATED from the samples using the
Document Samples utility. Hand edits will be lost when regenerated! -->
<!--
*
* 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
*
* http://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.
-->
<head><title>SDO Samples</title></head><body>
<h1>SDO Samples</h1>
<P>
The samples provided in the Tuscany SDO distribution cover many areas of
the SDO API. Here we provide two indexes into the samples. The first lists
each sample in sequence and details the central theme(s) of the sample.
It also mentions if the sample significantly demonstrates other areas in passing.
The second index lists all the themes that are covered by these samples, and
indicates which of the samples has that subject area as a central theme or as
demonstrates the subject area significant as an incidental part of the sample.<H2>Index by Sample Program Name</H2>
<h3>Sample Program CreateCompany</h3>
<b>Core function:</b><br/>
<a href="#facet2">Set Properties of DataObject by name</a><br/>
<br/><h3>Sample Program ReadPurchaseOrder</h3>
<b>Core function:</b><br/>
<a href="#facet15">Loading data from XML</a><br/>
<a href="#facet16">Saving data to XML</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet1">Get Properties of DataObject by name</a><br/>
<h3>Sample Program CreatePurchaseOrder</h3>
<b>Core function:</b><br/>
<a href="#facet15">Loading data from XML</a><br/>
<a href="#facet16">Saving data to XML</a><br/>
<br/><h3>Sample Program AccessDataObjectPropertiesByName</h3>
<b>Core function:</b><br/>
<a href="#facet1">Get Properties of DataObject by name</a><br/>
<br/><h3>Sample Program AccessingTheContentsOfASequence</h3>
<b>Core function:</b><br/>
<a href="#facet13">Accessing values in a Sequence</a><br/>
<br/><h3>Sample Program AccessDataObjectUsingValidXPath</h3>
<b>Core function:</b><br/>
<a href="#facet6">Get/Set Properties of DataObject by Xpath</a><br/>
<br/><h3>Sample Program DynamicCustomerTypeSample</h3>
<b>Core function:</b><br/>
<a href="#facet9">Create Types using the SDO API</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet2">Set Properties of DataObject by name</a><br/>
<a href="#facet12">Using Built-in Types</a><br/>
<a href="#facet16">Saving data to XML</a><br/>
<h3>Sample Program CreateCompanyTuscanyAPI</h3>
<b>Core function:</b><br/>
<a href="#facet2">Set Properties of DataObject by name</a><br/>
<br/><h3>Sample Program CreateDataObjectFromXmlString</h3>
<b>Core function:</b><br/>
<a href="#facet12">Using Built-in Types</a><br/>
<a href="#facet15">Loading data from XML</a><br/>
<br/><h3>Sample Program SerializingDeserializingADataObject</h3>
<b>Core function:</b><br/>
<a href="#facet23">Java Serialization of data graph</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet24">Testing for Graph Equality</a><br/>
<h3>Sample Program AccessingDataObjectsViaPropertyIndex</h3>
<b>Core function:</b><br/>
<a href="#facet4">Get/Set Properties of DataObject by index</a><br/>
<br/><h3>Sample Program ObtainingDataGraphFromXml</h3>
<b>Core function:</b><br/>
<a href="#facet19">Wrapping data graph in a DataGraph instance</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet12">Using Built-in Types</a><br/>
<h3>Sample Program PrintDataGraph</h3>
<b>Core function:</b><br/>
<a href="#facet14">Generic data graph traversal</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet5">Get/Set Properties by Instance Properties</a><br/>
<a href="#facet7">isMany Properties</a><br/>
<a href="#facet9">Create Types using the SDO API</a><br/>
<a href="#facet13">Accessing values in a Sequence</a><br/>
<a href="#facet21">Non-Containment</a><br/>
<h3>Sample Program MedicalScenario</h3>
<b>Core function:</b><br/>
<a href="#facet8">Containment</a><br/>
<a href="#facet9">Create Types using the SDO API</a><br/>
<a href="#facet10">Create Types using XML Schema</a><br/>
<a href="#facet20">Open Content</a><br/>
<a href="#facet21">Non-Containment</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet3">Create DataObjects by name</a><br/>
<a href="#facet7">isMany Properties</a><br/>
<a href="#facet14">Generic data graph traversal</a><br/>
<a href="#facet16">Saving data to XML</a><br/>
<h3>Sample Program MedicalScenarioWithChangeMonitoring</h3>
<b>Core function:</b><br/>
<a href="#facet8">Containment</a><br/>
<a href="#facet9">Create Types using the SDO API</a><br/>
<a href="#facet10">Create Types using XML Schema</a><br/>
<a href="#facet20">Open Content</a><br/>
<a href="#facet21">Non-Containment</a><br/>
<a href="#facet18">Change Monitoring using a ChangeSummary Property on a DataObject</a><br/>
<br/><b>Also demonstrates:</b><br/>
<a href="#facet3">Create DataObjects by name</a><br/>
<a href="#facet7">isMany Properties</a><br/>
<a href="#facet14">Generic data graph traversal</a><br/>
<a href="#facet16">Saving data to XML</a><br/>
<H2>Index by function</H2>
<a name="facet0"/>
<h3></h3>
<a name="facet1"/>
<h3>Get Properties of DataObject by name</h3>
<b>Samples which demonstrate this as their core function</b><br/>
AccessDataObjectPropertiesByName<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
ReadPurchaseOrder<br/>
<a name="facet2"/>
<h3>Set Properties of DataObject by name</h3>
<b>Samples which demonstrate this as their core function</b><br/>
CreateCompany<br/>
CreateCompanyTuscanyAPI<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
DynamicCustomerTypeSample<br/>
<a name="facet3"/>
<h3>Create DataObjects by name</h3>
<b>Samples which demonstrate this in addition to their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet4"/>
<h3>Get/Set Properties of DataObject by index</h3>
<b>Samples which demonstrate this as their core function</b><br/>
AccessingDataObjectsViaPropertyIndex<br/>
<a name="facet5"/>
<h3>Get/Set Properties by Instance Properties</h3>
<b>Samples which demonstrate this in addition to their core function</b><br/>
PrintDataGraph<br/>
<a name="facet6"/>
<h3>Get/Set Properties of DataObject by Xpath</h3>
<b>Samples which demonstrate this as their core function</b><br/>
AccessDataObjectUsingValidXPath<br/>
<a name="facet7"/>
<h3>isMany Properties</h3>
<b>Samples which demonstrate this in addition to their core function</b><br/>
PrintDataGraph<br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet8"/>
<h3>Containment</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet9"/>
<h3>Create Types using the SDO API</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
DynamicCustomerTypeSample<br/>
MedicalScenario<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
PrintDataGraph<br/>
<a name="facet10"/>
<h3>Create Types using XML Schema</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet11"/>
<h3>Create Types using the Tuscany API</h3>
<a name="facet12"/>
<h3>Using Built-in Types</h3>
<b>Samples which demonstrate this as their core function</b><br/>
CreateDataObjectFromXmlString<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
DynamicCustomerTypeSample<br/>
ObtainingDataGraphFromXml<br/>
<a name="facet13"/>
<h3>Accessing values in a Sequence</h3>
<b>Samples which demonstrate this as their core function</b><br/>
AccessingTheContentsOfASequence<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
PrintDataGraph<br/>
<a name="facet14"/>
<h3>Generic data graph traversal</h3>
<b>Samples which demonstrate this as their core function</b><br/>
PrintDataGraph<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet15"/>
<h3>Loading data from XML</h3>
<b>Samples which demonstrate this as their core function</b><br/>
CreateDataObjectFromXmlString<br/>
ReadPurchaseOrder<br/>
CreatePurchaseOrder<br/>
<a name="facet16"/>
<h3>Saving data to XML</h3>
<b>Samples which demonstrate this as their core function</b><br/>
ReadPurchaseOrder<br/>
CreatePurchaseOrder<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
DynamicCustomerTypeSample<br/>
MedicalScenario<br/>
<a name="facet17"/>
<h3>Change Monitoring using a DataGraph</h3>
<a name="facet18"/>
<h3>Change Monitoring using a ChangeSummary Property on a DataObject</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
<a name="facet19"/>
<h3>Wrapping data graph in a DataGraph instance</h3>
<b>Samples which demonstrate this as their core function</b><br/>
ObtainingDataGraphFromXml<br/>
<a name="facet20"/>
<h3>Open Content</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<a name="facet21"/>
<h3>Non-Containment</h3>
<b>Samples which demonstrate this as their core function</b><br/>
MedicalScenarioWithChangeMonitoring<br/>
MedicalScenario<br/>
<b>Samples which demonstrate this in addition to their core function</b><br/>
PrintDataGraph<br/>
<a name="facet22"/>
<h3>Create XML Schema from Types</h3>
<a name="facet23"/>
<h3>Java Serialization of data graph</h3>
<b>Samples which demonstrate this as their core function</b><br/>
SerializingDeserializingADataObject<br/>
<a name="facet24"/>
<h3>Testing for Graph Equality</h3>
<b>Samples which demonstrate this in addition to their core function</b><br/>
SerializingDeserializingADataObject<br/>
</body>
</html>

View file

@ -0,0 +1,982 @@
<?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
*
* http://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.
-->
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="sdo"
nsURI="http://www.apache.org/tuscany/2005/SDO" nsPrefix="sdo">
<eClassifiers xsi:type="ecore:EClass" name="ChangeSummary" instanceClassName="commonj.sdo.ChangeSummary"
eSuperTypes="../../org.eclipse.emf.ecore.change/model/Change.ecore#//ChangeDescription">
<eOperations name="beginLogging"/>
<eOperations name="endLogging"/>
<eOperations name="isCreated" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="isDeleted" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="getOldValues" eType="#//EJavaList">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="isModified" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="getOldValue" eType="#//ChangeSummarySetting">
<eParameters name="dataObject" eType="#//DataObject"/>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getOldContainer" eType="#//DataObject">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="getOldContainmentProperty" eType="#//Property">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="getOldSequence" eType="#//Sequence">
<eParameters name="dataObject" eType="#//DataObject"/>
</eOperations>
<eOperations name="undoChanges"/>
<eOperations name="isLogging" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="getDataGraph" eType="#//DataGraph"/>
<eOperations name="getChangedObjects" eType="#//EJavaList"/>
<eOperations name="getRootObject" eType="#//DataObject"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="eDataGraph" lowerBound="1"
eType="#//DataGraph" transient="true" resolveProxies="false" eOpposite="#//DataGraph/eChangeSummary"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ChangeSummarySetting" instanceClassName="commonj.sdo.ChangeSummary$Setting"
eSuperTypes="../../org.eclipse.emf.ecore.change/model/Change.ecore#//FeatureChange">
<eOperations name="isSet" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="getValue" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
<eOperations name="getProperty" eType="#//Property"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataGraph" instanceClassName="commonj.sdo.DataGraph"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EObject">
<eOperations name="createRootObject" eType="#//DataObject">
<eParameters name="namespaceURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="typeName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="createRootObject" eType="#//DataObject">
<eParameters name="type" eType="#//Type"/>
</eOperations>
<eOperations name="getType" eType="#//Type">
<eParameters name="namespaceURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="typeName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getRootObject" eType="#//DataObject"/>
<eOperations name="getChangeSummary" eType="#//ChangeSummary"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="resourceSet" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EResourceSet"
transient="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="rootResource" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EResource"
changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="eChangeSummary" lowerBound="1"
eType="#//ChangeSummary" resolveProxies="false" eOpposite="#//ChangeSummary/eDataGraph"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="eRootObject" lowerBound="1"
eType="ecore:EClass ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"
resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataObject" instanceClassName="commonj.sdo.DataObject"
abstract="true">
<eOperations name="get" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.get(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="set">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.set(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="isSet" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.isSet(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="unset">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.unset(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="get" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.get(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="set">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.set(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="isSet" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.isSet(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="unset">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.unset(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="get" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.get(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="set">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.set(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="isSet" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.isSet(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="unset">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.unset(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getContainer" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getContainer(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getContainmentProperty" eType="#//Property">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getContainmentProperty(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getDataGraph" eType="#//DataGraph">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDataGraph(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getType" eType="#//Type">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getType(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getBigDecimal" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getBigInteger" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getBoolean" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBoolean(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getByte" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getByte(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getBytes" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBytes(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getChar" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getChar(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDataObject(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getDate" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDate(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getDouble" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDouble(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getFloat" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getFloat(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getInt(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getList" eType="#//EJavaList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getList(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getLong" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getLong(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getSequence" eType="#//Sequence">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getSequence(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getShort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getShort(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getString(this, path);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="setBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal"/>
</eOperations>
<eOperations name="setBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/>
</eOperations>
<eOperations name="setBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBoolean(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eOperations>
<eOperations name="setByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setByte(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
</eOperations>
<eOperations name="setBytes">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBytes(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray"/>
</eOperations>
<eOperations name="setChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setChar(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
</eOperations>
<eOperations name="setDataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDataObject(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="#//DataObject"/>
</eOperations>
<eOperations name="setDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDate(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate"/>
</eOperations>
<eOperations name="setDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDouble(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
</eOperations>
<eOperations name="setFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setFloat(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
</eOperations>
<eOperations name="setInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setInt(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="setList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setList(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="#//EJavaList"/>
</eOperations>
<eOperations name="setLong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setLong(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
</eOperations>
<eOperations name="setShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setShort(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
</eOperations>
<eOperations name="setString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setString(this, path, value);"/>
</eAnnotations>
<eParameters name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getBigDecimal" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getBigInteger" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getBoolean" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBoolean(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getByte" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getByte(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getBytes" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBytes(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getChar" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getChar(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDataObject(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getDate" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDate(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getDouble" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDouble(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getFloat" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getFloat(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getInt(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getList" eType="#//EJavaList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getList(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getLong" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getLong(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getSequence" eType="#//Sequence">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getSequence(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getShort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getShort(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getString(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="setBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal"/>
</eOperations>
<eOperations name="setBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/>
</eOperations>
<eOperations name="setBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBoolean(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eOperations>
<eOperations name="setByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setByte(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
</eOperations>
<eOperations name="setBytes">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBytes(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray"/>
</eOperations>
<eOperations name="setChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setChar(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
</eOperations>
<eOperations name="setDataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDataObject(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="#//DataObject"/>
</eOperations>
<eOperations name="setDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDate(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate"/>
</eOperations>
<eOperations name="setDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDouble(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
</eOperations>
<eOperations name="setFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setFloat(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
</eOperations>
<eOperations name="setInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setInt(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="setList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setList(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="#//EJavaList"/>
</eOperations>
<eOperations name="setLong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setLong(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
</eOperations>
<eOperations name="setShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setShort(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
</eOperations>
<eOperations name="setString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setString(this, propertyIndex, value);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getBigDecimal" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getBigInteger" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getBoolean" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBoolean(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getByte" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getByte(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getBytes" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getBytes(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getChar" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getChar(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDataObject(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getDate" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDate(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getDouble" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getDouble(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getFloat" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getFloat(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getInt" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getInt(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getList" eType="#//EJavaList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getList(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getLong" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getLong(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getSequence" eType="#//Sequence">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getSequence(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getShort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getShort(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="getString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getString(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="setBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal"/>
</eOperations>
<eOperations name="setBigInteger">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/>
</eOperations>
<eOperations name="setBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBoolean(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eOperations>
<eOperations name="setByte">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setByte(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
</eOperations>
<eOperations name="setBytes">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setBytes(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EByteArray"/>
</eOperations>
<eOperations name="setChar">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setChar(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
</eOperations>
<eOperations name="setDataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDataObject(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="#//DataObject"/>
</eOperations>
<eOperations name="setDate">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDate(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDate"/>
</eOperations>
<eOperations name="setDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setDouble(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
</eOperations>
<eOperations name="setFloat">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setFloat(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
</eOperations>
<eOperations name="setInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setInt(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="setList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setList(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="#//EJavaList"/>
</eOperations>
<eOperations name="setLong">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setLong(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
</eOperations>
<eOperations name="setShort">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setShort(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
</eOperations>
<eOperations name="setString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.setString(this, property, value);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName);"/>
</eAnnotations>
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName, namespaceURI, typeName);"/>
</eAnnotations>
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="namespaceURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="typeName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex, namespaceURI, typeName);"/>
</eAnnotations>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="namespaceURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="typeName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="createDataObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property, type);"/>
</eAnnotations>
<eParameters name="property" eType="#//Property"/>
<eParameters name="type" eType="#//Type"/>
</eOperations>
<eOperations name="delete">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.delete(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getSequence" eType="#//Sequence">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getSequence(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getInstanceProperties" eType="#//EJavaList">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getInstanceProperties(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getProperty" eType="#//Property">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getProperty(this, propertyName);"/>
</eAnnotations>
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="getRootObject" eType="#//DataObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getRootObject(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="getChangeSummary" eType="#//ChangeSummary">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return &lt;%org.apache.sdo.util.SDOUtil%>.getChangeSummary(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="detach">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="&lt;%org.apache.sdo.util.SDOUtil%>.detach(this);"/>
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Property" instanceClassName="commonj.sdo.Property"
abstract="true" interface="true">
<eOperations name="getName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eOperations name="getType" eType="#//Type"/>
<eOperations name="isMany" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="isContainment" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="isReadOnly" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="getContainingType" eType="#//Type"/>
<eOperations name="getAliasNames" eType="#//EJavaList"/>
<eOperations name="getOpposite" eType="#//Property"/>
<eOperations name="getDefault" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Sequence" instanceClassName="commonj.sdo.Sequence"
abstract="true" interface="true">
<eOperations name="size" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eOperations name="getProperty" eType="#//Property">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="getValue" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eOperations>
<eOperations name="setValue" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="propertIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="propertyIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="property" eType="#//Property"/>
<eParameters name="value" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="add">
<eParameters name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
<eOperations name="add">
<eParameters name="index" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eParameters name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Type" instanceClassName="commonj.sdo.Type"
abstract="true" interface="true">
<eOperations name="getName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eOperations name="getURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eOperations name="getInstanceClass" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaClass"/>
<eOperations name="isInstance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="object" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EJavaObject"/>
</eOperations>
<eOperations name="isDataType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="isSequenced" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="isOpen" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="isAbstract" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eOperations name="getBaseTypes" eType="#//EJavaList"/>
<eOperations name="getAliasNames" eType="#//EJavaList"/>
<eOperations name="getProperties" eType="#//EJavaList"/>
<eOperations name="getDeclaredProperties" eType="#//EJavaList"/>
<eOperations name="getProperty" eType="#//Property">
<eParameters name="propertyName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EJavaList" instanceClassName="java.util.List"
serializable="false"/>
<eClassifiers xsi:type="ecore:EDataType" name="EObjectStreamException" instanceClassName="java.io.ObjectStreamException"
serializable="false"/>
<eClassifiers xsi:type="ecore:EClass" name="AnyTypeDataObject" eSuperTypes="#//DataObject ../../org.eclipse.emf.ecore/model/XMLType.ecore#//AnyType">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="mixed"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SimpleAnyTypeDataObject" eSuperTypes="#//AnyTypeDataObject ../../org.eclipse.emf.ecore/model/XMLType.ecore#//SimpleAnyType">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="simple"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class" instanceClassName="commonj.sdo.Type"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EClass #//Type"/>
<eClassifiers xsi:type="ecore:EClass" name="DataType" instanceClassName="commonj.sdo.Type"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EDataType #//Type"/>
<eClassifiers xsi:type="ecore:EClass" name="Attribute" instanceClassName="commonj.sdo.Property"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EAttribute #//Property"/>
<eClassifiers xsi:type="ecore:EClass" name="Reference" instanceClassName="commonj.sdo.Property"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EReference #//Property"/>
<eClassifiers xsi:type="ecore:EClass" name="Enum" instanceClassName="commonj.sdo.Type"
eSuperTypes="../../org.eclipse.emf.ecore/model/Ecore.ecore#//EEnum #//Type"/>
<eClassifiers xsi:type="ecore:EClass" name="DynamicDataObject" instanceClassName="commonj.sdo.DataObject"
eSuperTypes="#//DataObject"/>
<eClassifiers xsi:type="ecore:EClass" name="StoreDataObject" instanceClassName="commonj.sdo.DataObject"
eSuperTypes="#//DataObject"/>
<eClassifiers xsi:type="ecore:EClass" name="DynamicStoreDataObject" instanceClassName="commonj.sdo.DataObject"
eSuperTypes="#//StoreDataObject"/>
<eClassifiers xsi:type="ecore:EClass" name="ExtensibleDataObject" instanceClassName="commonj.sdo.DataObject"
eSuperTypes="#//DataObject"/>
</ecore:EPackage>

View file

@ -0,0 +1,565 @@
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/tuscany-sdo-impl/src/main/java"
creationCommands="false" modelPluginID="org.apache.tuscany.sdo.impl" runtimeJar="true"
modelName="SDO" modelPluginClass="" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.BasicEObjectImpl"
rootImplementsInterface="" testsDirectory="" importerID="org.eclipse.emf.importer.rose"
runtimeVersion="2.5" usedGenPackages="../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.emf.ecore/model/XMLType.genmodel#//type ../../org.eclipse.emf.ecore.change/model/Change.genmodel#//change">
<foreignModel>SDO.mdl</foreignModel>
<foreignModel>VABASE_PLUGINS_PATH</foreignModel>
<foreignModel>../..</foreignModel>
<genPackages prefix="SDO" basePackage="org.apache.tuscany" disposableProviderFactory="true"
adapterFactory="false" generateExampleClass="false" ecorePackage="SDO.ecore#/">
<genDataTypes ecoreDataType="SDO.ecore#//EJavaList"/>
<genDataTypes ecoreDataType="SDO.ecore#//EObjectStreamException"/>
<genClasses ecoreClass="SDO.ecore#//ChangeSummary">
<genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference SDO.ecore#//ChangeSummary/eDataGraph"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/beginLogging"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/endLogging"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/isCreated">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/isCreated/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/isDeleted">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/isDeleted/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getOldValues">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldValues/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/isModified">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/isModified/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getOldValue">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldValue/dataObject"/>
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldValue/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getOldContainer">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldContainer/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getOldContainmentProperty">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldContainmentProperty/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getOldSequence">
<genParameters ecoreParameter="SDO.ecore#//ChangeSummary/getOldSequence/dataObject"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/undoChanges"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/isLogging"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getDataGraph"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getChangedObjects"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummary/getRootObject"/>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//ChangeSummarySetting">
<genOperations ecoreOperation="SDO.ecore#//ChangeSummarySetting/isSet"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummarySetting/getValue"/>
<genOperations ecoreOperation="SDO.ecore#//ChangeSummarySetting/getProperty"/>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//DataGraph">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute SDO.ecore#//DataGraph/resourceSet"/>
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute SDO.ecore#//DataGraph/rootResource"/>
<genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference SDO.ecore#//DataGraph/eChangeSummary"/>
<genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference SDO.ecore#//DataGraph/eRootObject"/>
<genOperations ecoreOperation="SDO.ecore#//DataGraph/createRootObject">
<genParameters ecoreParameter="SDO.ecore#//DataGraph/createRootObject/namespaceURI"/>
<genParameters ecoreParameter="SDO.ecore#//DataGraph/createRootObject/typeName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataGraph/createRootObject.1">
<genParameters ecoreParameter="SDO.ecore#//DataGraph/createRootObject.1/type"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataGraph/getType">
<genParameters ecoreParameter="SDO.ecore#//DataGraph/getType/namespaceURI"/>
<genParameters ecoreParameter="SDO.ecore#//DataGraph/getType/typeName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataGraph/getRootObject"/>
<genOperations ecoreOperation="SDO.ecore#//DataGraph/getChangeSummary"/>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//DataObject">
<genOperations ecoreOperation="SDO.ecore#//DataObject/get">
<genParameters ecoreParameter="SDO.ecore#//DataObject/get/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/set">
<genParameters ecoreParameter="SDO.ecore#//DataObject/set/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/set/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/isSet">
<genParameters ecoreParameter="SDO.ecore#//DataObject/isSet/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/unset">
<genParameters ecoreParameter="SDO.ecore#//DataObject/unset/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/get.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/get.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/set.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/set.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/set.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/isSet.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/isSet.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/unset.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/unset.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/get.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/get.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/set.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/set.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/set.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/isSet.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/isSet.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/unset.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/unset.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getContainer"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getContainmentProperty"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDataGraph"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getType"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigDecimal">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigDecimal/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigInteger">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigInteger/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBoolean">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBoolean/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getByte">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getByte/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBytes">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBytes/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getChar">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getChar/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDataObject">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDataObject/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDate">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDate/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDouble">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDouble/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getFloat">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getFloat/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getInt">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getInt/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getList">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getList/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getLong">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getLong/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getSequence">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getSequence/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getShort">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getShort/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getString">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getString/path"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigDecimal">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigInteger">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBoolean">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setByte">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBytes">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setChar">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDataObject">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDate">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDouble">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setFloat">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setInt">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setList">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setLong">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setShort">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setString">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString/path"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigDecimal.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigDecimal.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigInteger.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigInteger.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBoolean.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBoolean.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getByte.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getByte.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBytes.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBytes.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getChar.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getChar.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDataObject.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDataObject.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDate.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDate.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDouble.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDouble.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getFloat.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getFloat.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getInt.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getInt.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getList.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getList.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getLong.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getLong.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getSequence.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getSequence.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getShort.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getShort.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getString.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getString.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigDecimal.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigInteger.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBoolean.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setByte.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBytes.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setChar.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDataObject.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDate.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDouble.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setFloat.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setInt.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setList.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setLong.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setShort.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setString.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString.1/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigDecimal.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigDecimal.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBigInteger.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBigInteger.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBoolean.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBoolean.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getByte.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getByte.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getBytes.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getBytes.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getChar.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getChar.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDataObject.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDataObject.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDate.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDate.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getDouble.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getDouble.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getFloat.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getFloat.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getInt.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getInt.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getList.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getList.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getLong.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getLong.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getSequence.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getSequence.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getShort.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getShort.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getString.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getString.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigDecimal.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigDecimal.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBigInteger.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBigInteger.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBoolean.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBoolean.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setByte.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setByte.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setBytes.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setBytes.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setChar.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setChar.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDataObject.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDataObject.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDate.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDate.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setDouble.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setDouble.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setFloat.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setFloat.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setInt.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setInt.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setList.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setList.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setLong.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setLong.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setShort.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setShort.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/setString.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/setString.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject/propertyName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject.1">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.1/propertyIndex"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject.2">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.2/property"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject.3">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.3/propertyName"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.3/namespaceURI"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.3/typeName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject.4">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.4/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.4/namespaceURI"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.4/typeName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/createDataObject.5">
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.5/property"/>
<genParameters ecoreParameter="SDO.ecore#//DataObject/createDataObject.5/type"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/delete"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getSequence.3"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getInstanceProperties"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getProperty">
<genParameters ecoreParameter="SDO.ecore#//DataObject/getProperty/propertyName"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getRootObject"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/getChangeSummary"/>
<genOperations ecoreOperation="SDO.ecore#//DataObject/detach"/>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//Property">
<genOperations ecoreOperation="SDO.ecore#//Property/getName"/>
<genOperations ecoreOperation="SDO.ecore#//Property/getType"/>
<genOperations ecoreOperation="SDO.ecore#//Property/isMany"/>
<genOperations ecoreOperation="SDO.ecore#//Property/isContainment"/>
<genOperations ecoreOperation="SDO.ecore#//Property/isReadOnly"/>
<genOperations ecoreOperation="SDO.ecore#//Property/getContainingType"/>
<genOperations ecoreOperation="SDO.ecore#//Property/getAliasNames"/>
<genOperations ecoreOperation="SDO.ecore#//Property/getOpposite"/>
<genOperations ecoreOperation="SDO.ecore#//Property/getDefault"/>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//Sequence">
<genOperations ecoreOperation="SDO.ecore#//Sequence/size"/>
<genOperations ecoreOperation="SDO.ecore#//Sequence/getProperty">
<genParameters ecoreParameter="SDO.ecore#//Sequence/getProperty/index"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/getValue">
<genParameters ecoreParameter="SDO.ecore#//Sequence/getValue/index"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/setValue">
<genParameters ecoreParameter="SDO.ecore#//Sequence/setValue/index"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/setValue/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add/propertyName"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.1">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.1/propertIndex"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.1/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.2">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.2/property"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.2/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.3">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.3/index"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.3/propertyName"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.3/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.4">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.4/index"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.4/propertyIndex"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.4/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.5">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.5/index"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.5/property"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.5/value"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.6">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.6/text"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Sequence/add.7">
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.7/index"/>
<genParameters ecoreParameter="SDO.ecore#//Sequence/add.7/text"/>
</genOperations>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//Type">
<genOperations ecoreOperation="SDO.ecore#//Type/getName"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getURI"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getInstanceClass"/>
<genOperations ecoreOperation="SDO.ecore#//Type/isInstance">
<genParameters ecoreParameter="SDO.ecore#//Type/isInstance/object"/>
</genOperations>
<genOperations ecoreOperation="SDO.ecore#//Type/isDataType"/>
<genOperations ecoreOperation="SDO.ecore#//Type/isSequenced"/>
<genOperations ecoreOperation="SDO.ecore#//Type/isOpen"/>
<genOperations ecoreOperation="SDO.ecore#//Type/isAbstract"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getBaseTypes"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getAliasNames"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getProperties"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getDeclaredProperties"/>
<genOperations ecoreOperation="SDO.ecore#//Type/getProperty">
<genParameters ecoreParameter="SDO.ecore#//Type/getProperty/propertyName"/>
</genOperations>
</genClasses>
<genClasses ecoreClass="SDO.ecore#//AnyTypeDataObject"/>
<genClasses ecoreClass="SDO.ecore#//SimpleAnyTypeDataObject"/>
<genClasses ecoreClass="SDO.ecore#//Class"/>
<genClasses ecoreClass="SDO.ecore#//DataType"/>
<genClasses ecoreClass="SDO.ecore#//Attribute"/>
<genClasses ecoreClass="SDO.ecore#//Reference"/>
<genClasses ecoreClass="SDO.ecore#//Enum"/>
<genClasses ecoreClass="SDO.ecore#//DynamicDataObject"/>
<genClasses ecoreClass="SDO.ecore#//StoreDataObject"/>
<genClasses ecoreClass="SDO.ecore#//DynamicStoreDataObject"/>
<genClasses ecoreClass="SDO.ecore#//ExtensibleDataObject"/>
</genPackages>
</genmodel:GenModel>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,189 @@
<?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
*
* http://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.
-->
<project>
<parent>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo</artifactId>
<version>1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tuscany-sdo-impl</artifactId>
<name>Tuscany SDO Implementation</name>
<description>Tuscany implementation of SDO API.</description>
<repositories>
<repository>
<id>codehaus</id>
<name>Codehaus maven repository</name>
<url>http://repository.codehaus.org/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-lib</artifactId>
<version>${sdo.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>common</artifactId>
<version>${emfVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>${emfVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore-change</artifactId>
<version>${emfVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore-xmi</artifactId>
<version>${emfVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xsd</groupId>
<artifactId>xsd</artifactId>
<version>${emfVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.0</version>
</dependency>
<!-- dependencies for optional code generation functions -->
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>2.2</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!-- dependencies for optional StAX functions -->
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
</dependency>
<!-- dependencies for OSGi support -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
<!-- dependencies for test cases -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
<Implementation-Version>${version}</Implementation-Version>
<X-Compile-Source-JDK>1.4</X-Compile-Source-JDK>
<X-Compile-Target-JDK>1.4</X-Compile-Target-JDK>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifestEntries>
<Extension-Name>${project.artifactId}</Extension-Name>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
<Specification-Version>${version}</Specification-Version>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
<Implementation-Version>${project.version}</Implementation-Version>
<!--
<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-SymbolicName>org.apache.tuscany.sdo.impl</Bundle-SymbolicName>
<Bundle-Version>1.0.0</Bundle-Version>
<Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
-->
<Require-Bundle>org.eclipse.emf.common,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.xmi,org.eclipse.xsd,org.apache.tuscany.sdo.spec;visibility:=reexport</Require-Bundle>
<Export-Package>commonj.sdo.impl,org.apache.tuscany.sdo,org.apache.tuscany.sdo.helper,org.apache.tuscany.sdo.impl,org.apache.tuscany.sdo.test,org.apache.tuscany.sdo.util</Export-Package>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.2</version>
<configuration>
<overview>${basedir}/src/main/java/org/apache/tuscany/sdo/overview.html</overview>
<version>2.0</version>
<source>1.4</source>
</configuration>
<!-- <executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions> -->
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,38 @@
/**
*
* 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
*
* http://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.tuscany.sdo;
import commonj.sdo.DataObject;
import org.eclipse.emf.ecore.xml.type.AnyType;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Any Type Data Object</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.apache.tuscany.sdo.SDOPackage#getAnyTypeDataObject()
* @model superTypes="org.apache.tuscany.sdo.DataObject org.eclipse.emf.ecore.xml.type.AnyType"
* extendedMetaData="kind='mixed'"
* @generated
*/
public interface AnyTypeDataObject extends DataObject, AnyType {
} // AnyTypeDataObject

View file

@ -0,0 +1,39 @@
/**
*
* 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
*
* http://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.tuscany.sdo;
import java.util.List;
import org.apache.tuscany.sdo.helper.SDOExtendedMetaDataImpl;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
public interface SDOExtendedMetaData extends ExtendedMetaData {
SDOExtendedMetaData INSTANCE = new SDOExtendedMetaDataImpl();
List getAliasNames(EModelElement eModelElement);
void setAliasNames(EModelElement eModelElement, List aliasNames);
void setAliasNames(EModelElement eModelElement, String aliasNames);
void setFeatureNamespaceMatchingLax(boolean featureNamespaceMatchingLax);
}

View file

@ -0,0 +1,185 @@
/**
*
* 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
*
* http://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.tuscany.sdo;
import commonj.sdo.ChangeSummary;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.emf.ecore.EStructuralFeature;
import commonj.sdo.Property;
import commonj.sdo.Type;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see org.apache.tuscany.sdo.SDOPackage
* @generated
*/
public interface SDOFactory extends EFactory{
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
SDOFactory eINSTANCE = org.apache.tuscany.sdo.impl.SDOFactoryImpl.init();
/**
* Returns a new object of class '<em>Change Summary</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Change Summary</em>'.
* @generated
*/
ChangeSummary createChangeSummary();
/**
* Returns a new object of class '<em>Change Summary Setting</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Change Summary Setting</em>'.
* @generated
*/
ChangeSummary.Setting createChangeSummarySetting();
/**
* Returns a new object of class '<em>Data Graph</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Data Graph</em>'.
* @generated
*/
DataGraph createDataGraph();
/**
* Returns a new object of class '<em>Any Type Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Any Type Data Object</em>'.
* @generated
*/
AnyTypeDataObject createAnyTypeDataObject();
/**
* Returns a new object of class '<em>Simple Any Type Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Simple Any Type Data Object</em>'.
* @generated
*/
SimpleAnyTypeDataObject createSimpleAnyTypeDataObject();
/**
* Returns a new object of class '<em>Class</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Class</em>'.
* @generated
*/
Type createClass();
/**
* Returns a new object of class '<em>Data Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Data Type</em>'.
* @generated
*/
Type createDataType();
/**
* Returns a new object of class '<em>Attribute</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Attribute</em>'.
* @generated
*/
Property createAttribute();
/**
* Returns a new object of class '<em>Reference</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Reference</em>'.
* @generated
*/
Property createReference();
/**
* Returns a new object of class '<em>Enum</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Enum</em>'.
* @generated
*/
Type createEnum();
/**
* Returns a new object of class '<em>Dynamic Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Dynamic Data Object</em>'.
* @generated
*/
DataObject createDynamicDataObject();
/**
* Returns a new object of class '<em>Store Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Store Data Object</em>'.
* @generated
*/
DataObject createStoreDataObject();
/**
* Returns a new object of class '<em>Dynamic Store Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Dynamic Store Data Object</em>'.
* @generated
*/
DataObject createDynamicStoreDataObject();
/**
* Returns a new object of class '<em>Extensible Data Object</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Extensible Data Object</em>'.
* @generated
*/
DataObject createExtensibleDataObject();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
SDOPackage getSDOPackage();
ChangeSummary.Setting createChangeSummarySetting(EStructuralFeature eStructuralFeature, Object value, boolean isSet);
} //SDOFactory

View file

@ -0,0 +1,49 @@
/**
*
* 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
*
* http://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.tuscany.sdo;
import commonj.sdo.Property;
import commonj.sdo.Type;
/**
* Visitor interface that allows applications to process SDO type metadata.
*
* @version $Rev$ $Date$
*/
public interface SDOTypeVisitor {
/**
* Visit a type definition.
*
* @param type the type to visit
*/
void visitType(Type type);
/**
* Visit a property definition.
*
* @param property the property to visit
*/
void visitProperty(Property property);
/**
* Visit after all properties.
*/
void visitEnd();
}

View file

@ -0,0 +1,35 @@
/**
*
* 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
*
* http://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.tuscany.sdo;
import org.eclipse.emf.ecore.xml.type.SimpleAnyType;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Simple Any Type Data Object</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.apache.tuscany.sdo.SDOPackage#getSimpleAnyTypeDataObject()
* @model extendedMetaData="kind='simple'"
* @generated
*/
public interface SimpleAnyTypeDataObject extends AnyTypeDataObject, SimpleAnyType {
} // SimpleAnyTypeDataObject

View file

@ -0,0 +1,98 @@
/**
*
* 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
*
* http://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.tuscany.sdo.codegen;
import java.util.List;
import commonj.sdo.Property;
import commonj.sdo.Type;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.apache.tuscany.sdo.SDOTypeVisitor;
/**
* Implementation of a generator that will directly emit bytecode for an interface that
* corresponds to the static properties of a SDO type.
*
* @version $Rev$ $Date$
*/
public class BytecodeInterfaceGenerator implements SDOTypeVisitor {
private final ClassWriter cw;
public BytecodeInterfaceGenerator() {
cw = new ClassWriter(false);
}
public void visitType(Type type) {
String name = type.getName();
int lastDot = name.lastIndexOf('.');
if (lastDot != -1) {
name = name.replace('.', '/');
} else {
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
List baseTypes = type.getBaseTypes();
String[] interfaces = new String[baseTypes.size()];
for (int i = 0; i < baseTypes.size(); i++) {
Type baseType = (Type) baseTypes.get(i);
interfaces[i] = baseType.getInstanceClass().getName().replace('.', '/');
}
cw.visit(Opcodes.V1_4,
Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT + Opcodes.ACC_INTERFACE,
name, null, "java/lang/Object", interfaces);
}
public void visitProperty(Property property) {
String name = property.getName();
String propertyName = Character.toUpperCase(name.charAt(0)) + name.substring(1);
Class javaType = property.getType().getInstanceClass();
String desc = org.objectweb.asm.Type.getDescriptor(javaType);
if (property.isMany()) {
cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "get" + propertyName, "()Ljava/util/List;", null, null).visitEnd();
} else {
if (boolean.class.equals(javaType)) {
cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "is" + propertyName, "()Z", null, null).visitEnd();
} else {
cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "get" + propertyName, "()" + desc, null, null).visitEnd();
}
if (!property.isReadOnly()) {
cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "set" + propertyName, '(' + desc + ")V", null, null).visitEnd();
}
}
}
public void visitEnd() {
cw.visitEnd();
}
/**
* Return the bytecode for the interface class in a form that can be written
* to disk, added to a JAR file, or passed to a ClassLoader.
*
* @return the bytecode for the SDO Type's interface class
*/
public byte[] getClassData() {
return cw.toByteArray();
}
}

View file

@ -0,0 +1,42 @@
/**
*
* 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
*
* http://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.tuscany.sdo.codegen;
/**
* Exception indicating there was a problem with code generation.
*
* @version $Rev$ $Date$
*/
public abstract class GenerationException extends RuntimeException {
public GenerationException() {
}
public GenerationException(String message) {
super(message);
}
public GenerationException(String message, Throwable cause) {
super(message, cause);
}
public GenerationException(Throwable cause) {
super(cause);
}
}

View file

@ -0,0 +1,179 @@
/**
*
* 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
*
* http://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.tuscany.sdo.codegen;
import java.io.PrintWriter;
import java.util.List;
import commonj.sdo.Property;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.SDOTypeVisitor;
/**
* Implementation of a generator that will output the source code for a Java interface
* that corresponds to the SDO Type's static properties.
*
* @version $Rev$ $Date$
*/
public class JavaInterfaceGenerator implements SDOTypeVisitor {
private static String canonicalize(String className) {
if (className == null) {
return "";
}
if (className.charAt(0) != '[') { // if not array
return className;
}
// process array
boolean invalidClassName = false;
int nestLevel = 1;
StringBuffer sb = new StringBuffer();
try {
while (className.charAt(nestLevel) == '[') {
nestLevel++;
}
char typeChar = className.charAt(nestLevel);
int end = nestLevel;
switch (typeChar) {
case 'L':
end = className.length() - 1;
if (className.charAt(end) != ';') {
invalidClassName = true;
} else {
sb.append(className.substring(nestLevel+1, end));
}
break;
case 'Z':
sb.append("boolean");
break;
case 'B':
sb.append("byte");
break;
case 'C':
sb.append("char");
break;
case 'D':
sb.append("double");
break;
case 'F':
sb.append("float");
break;
case 'I':
sb.append("int");
break;
case 'J':
sb.append("long");
break;
case 'S':
sb.append("short");
break;
default:
invalidClassName = true;
break;
}
if (end != (className.length() - 1)) {
invalidClassName = true; // we have not used all the characters
} else {
for (int i=0; i<nestLevel; i++) {
sb.append("[]");
}
}
} catch(Exception e) {
invalidClassName = true;
}
if (invalidClassName) {
System.err.println("unable to canonicalize class name: "+className);
return className;
}
return sb.toString();
}
private final PrintWriter writer;
/**
* Constructor providing the Writer to output the source to.
*
* @param writer where the generated source code will be written to
*/
public JavaInterfaceGenerator(PrintWriter writer) {
this.writer = writer;
}
public void visitType(Type type) {
String name = type.getName();
int lastDot = name.lastIndexOf('.');
if (lastDot != -1) {
writer.print("package ");
writer.print(name.substring(0, lastDot));
writer.println(';');
writer.println();
name = name.substring(lastDot + 1);
} else {
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
writer.print("public interface ");
writer.print(name);
List baseTypes = type.getBaseTypes();
for (int i = 0; i < baseTypes.size(); i++) {
Type baseType = (Type) baseTypes.get(i);
if (i == 0) {
writer.print(" extends ");
} else {
writer.print(", ");
}
writer.print(baseType.getInstanceClass().getName());
}
writer.println(" {");
}
public void visitProperty(Property property) {
String name = property.getName();
String propertyName = Character.toUpperCase(name.charAt(0)) + name.substring(1);
String javaType = canonicalize(property.getType().getInstanceClass().getName());
if (!property.isMany()) {
writer.print(" ");
writer.print(javaType);
writer.print("boolean".equals(javaType) ? " is" : " get");
writer.print(propertyName);
writer.println("();");
if (!property.isReadOnly()) {
writer.print(" void set");
writer.print(propertyName);
writer.print('(');
writer.print(javaType);
writer.println(" value);");
}
} else {
writer.print(" java.util.List get");
writer.print(propertyName);
writer.println("();");
}
}
public void visitEnd() {
writer.println('}');
writer.flush();
}
}

View file

@ -0,0 +1,61 @@
/**
*
* 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
*
* http://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.tuscany.sdo.codegen;
import commonj.sdo.Type;
/**
* Exception that indicates there is no Java mapping for an SDO type.
*
* @version $Rev$ $Date$
*/
public class NoJavaImplementationException extends GenerationException {
private final Type type;
/**
* Constructor supplying the Type that did not have a Java implementation.
* A default message is provided of the form "${URI}#${Name}"
*
* @param type the type that did not have a Java implementation.
*/
public NoJavaImplementationException(Type type) {
super(type == null ? null : type.getURI() + "#" + type.getName());
this.type = type;
}
/**
* Constructor supplying a message and the Type that did not have a Java implementation.
*
* @param message the message
* @param type the type that did not have a Java implementation.
*/
public NoJavaImplementationException(String message, Type type) {
super(message);
this.type = type;
}
/**
* Return the type that did not have a Java implementation.
* @return the type that did not have a Java implementation
*/
public Type getType() {
return type;
}
}

View file

@ -0,0 +1,178 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.impl.SDOPackageImpl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
/**
* A BasicExtendedMetaData that uses a supplied (SDO) ecore factory to create
* properties and types.
*/
public class BaseSDOExtendedMetaDataImpl extends BasicExtendedMetaData {
protected EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
protected DemandMetaData demandMetaData = new DemandMetaData();
public static class DemandMetaData {
EClassifier getEObject() {
return EcorePackage.eINSTANCE.getEObject();
}
EClass getAnyType() {
return XMLTypePackage.eINSTANCE.getAnyType();
}
EClassifier getAnySimpleType() {
return XMLTypePackage.eINSTANCE.getAnySimpleType();
}
EClass getXMLTypeDocumentRoot() {
return XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot();
}
}
public BaseSDOExtendedMetaDataImpl(EPackage.Registry registry) {
super(registry);
}
public EPackage demandPackage(String namespace) {
EPackage ePackage = demandRegistry.getEPackage(namespace);
if (ePackage == null) {
ePackage = ecoreFactory.createEPackage();
ePackage.setNsURI(namespace);
setQualified(ePackage, namespace != null);
if (namespace != null) {
ePackage.setNsPrefix(namespace
.equals(ExtendedMetaData.XMLNS_URI) ? namespace
.equals(ExtendedMetaData.XML_URI) ? "xml" : "xmlns"
: computePrefix(namespace));
}
demandRegistry.put(namespace, ePackage);
// demandDocumentRoot(ePackage);
EClass documentRootEClass = ecoreFactory.createEClass();
documentRootEClass.getESuperTypes().add(
demandMetaData.getXMLTypeDocumentRoot());
documentRootEClass.setName("DocumentRoot");
ePackage.getEClassifiers().add(documentRootEClass);
setDocumentRoot(documentRootEClass);
}
return ePackage;
}
public EClassifier demandType(String namespace, String name) {
EPackage ePackage = demandPackage(namespace);
EClassifier eClassifier = getType(ePackage, name);
if (eClassifier != null) {
return eClassifier;
} else {
// if it is a DataObject I need to put the SDOPackage DataObject
// Class...
EClass eClass = null;
//if ("DataObject".equals(name)) {
// eClass = SDOPackage.eINSTANCE.getAnyTypeDataObject();
//} else {
eClass = ecoreFactory.createEClass();
eClass.setName(name);
eClass.getESuperTypes().add(demandMetaData.getAnyType());
setContentKind(eClass, MIXED_CONTENT);
//}
ePackage.getEClassifiers().add(eClass);
return eClass;
}
}
public EStructuralFeature demandFeature(String namespace, String name,
boolean isElement, boolean isReference) {
EPackage ePackage = demandPackage(namespace);
EClass documentRootEClass = getDocumentRoot(ePackage);
EStructuralFeature eStructuralFeature = isElement ? getLocalElement(
documentRootEClass, namespace, name) : getLocalAttribute(
documentRootEClass, namespace, name);
if (eStructuralFeature != null) {
return eStructuralFeature;
} else {
if (isReference) {
EReference eReference = ecoreFactory.createEReference();
eReference.setContainment(isElement);
eReference.setEType(demandMetaData.getEObject());
eReference.setName(name);
eReference.setDerived(true);
eReference.setTransient(true);
eReference.setVolatile(true);
documentRootEClass.getEStructuralFeatures().add(eReference);
setFeatureKind(eReference, isElement ? ELEMENT_FEATURE
: ATTRIBUTE_FEATURE);
setNamespace(eReference, namespace);
// Mark the bound as unspecified so that it won't be considered
// many
// but can nevertheless be recognized as being unspecified and
// perhaps still be treat as many.
//
if (isElement) {
eReference
.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
}
return eReference;
} else {
EAttribute eAttribute = ecoreFactory.createEAttribute();
eAttribute.setName(name);
eAttribute.setEType(demandMetaData.getAnySimpleType());
eAttribute.setDerived(true);
eAttribute.setTransient(true);
eAttribute.setVolatile(true);
documentRootEClass.getEStructuralFeatures().add(eAttribute);
setFeatureKind(eAttribute, isElement ? ELEMENT_FEATURE
: ATTRIBUTE_FEATURE);
setNamespace(eAttribute, namespace);
// Mark the bound as unspecified so that it won't be considered
// many
// but can nevertheless be recognized as being unspecified and
// perhaps still be treat as many.
//
if (isElement) {
eAttribute
.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
}
return eAttribute;
}
}
}
}

View file

@ -0,0 +1,115 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
import commonj.sdo.ChangeSummary;
import commonj.sdo.DataObject;
import commonj.sdo.helper.CopyHelper;
/**
* A helper for copying DataObjects.
*/
public class CopyHelperImpl implements CopyHelper
{
public DataObject copyShallow(DataObject dataObject)
{
Copier copier = new SDOCopier()
{
protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject)
{
}
};
return (DataObject)copier.copy((EObject)dataObject);
}
public DataObject copy(DataObject dataObject)
{
Copier copier = new SDOCopier(){
protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) {
if(("ChangeSummaryType".equals(eAttribute.getEType().getName()) && "commonj.sdo".equals(eAttribute.getEType().getEPackage().getNsURI()))) {
throw new UnsupportedOperationException("Copying of change summary yet to be done");
} else {
super.copyAttribute(eAttribute, eObject, copyEObject);
}
}
};
return (DataObject)copier.copy((EObject)dataObject);
}
}
class SDOCopier extends Copier {
List csToTurnOn = new ArrayList();
List csToTurnOff = new ArrayList();
public EObject copy(EObject object) {
EObject result = super.copy(object);
copyReferences();
for (Iterator csit = csToTurnOn.iterator(); csit.hasNext();) {
ChangeSummary cs = (ChangeSummary) csit.next();
if(!cs.isLogging()) { cs.beginLogging(); }
}
for (Iterator csit = csToTurnOff.iterator(); csit.hasNext();) {
ChangeSummary cs = (ChangeSummary) csit.next();
if(cs.isLogging()) { cs.endLogging(); }
}
return result;
}
protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) {
if(("ChangeSummaryType".equals(eAttribute.getEType().getName()) && "commonj.sdo".equals(eAttribute.getEType().getEPackage().getNsURI()))) {
if (((ChangeSummary)eObject.eGet(eAttribute)).isLogging()) {
csToTurnOn.add(((DataObject)copyEObject).getChangeSummary());
} else {
csToTurnOff.add(((DataObject)copyEObject).getChangeSummary());
}
ChangeSummary copyCS = (ChangeSummary)copyEObject.eGet(eAttribute);
if(copyCS.isLogging()) copyCS.endLogging();
} else {
super.copyAttribute(eAttribute, eObject, copyEObject);
}
}
}

View file

@ -0,0 +1,255 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.CopyHelper;
import commonj.sdo.helper.TypeHelper;
/**
* A CopyHelper implementation that creates the copy objects in a specific metadata scope.
* The target scope must contain a compatible version of the Types needed to create the copy objects.
*/
public class CrossScopeCopyHelperImpl implements CopyHelper
{
protected TypeHelper scope;
public CrossScopeCopyHelperImpl(TypeHelper targetScope)
{
scope = targetScope;
}
public DataObject copyShallow(DataObject dataObject)
{
Copier copier = new CrossScopeCopier()
{
protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject)
{
}
protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject)
{
if (eObject.eIsSet(eAttribute) && !FeatureMapUtil.isFeatureMap(eAttribute))
{
super.copyAttribute(eAttribute,eObject,copyEObject);
}
}
};
EObject result = copier.copy((EObject)dataObject);
copier.copyReferences();
return (DataObject)result;
}
public DataObject copy(DataObject dataObject)
{
Copier copier = new CrossScopeCopier();
DataObject result = (DataObject)copier.copy((EObject)dataObject);
copier.copyReferences();
return (DataObject)result;
}
protected class CrossScopeCopier extends EcoreUtil.Copier
{
protected boolean useOriginalReferences = false;
protected EClass getTarget(EClass eClass)
{
EClass target = (EClass)get(eClass);
if (target == null)
{
Type type = (Type)eClass;
target = (EClass)scope.getType(type.getURI(), type.getName());
}
return target;
}
protected EStructuralFeature getTarget(EStructuralFeature eStructuralFeature)
{
EClass eClass = getTarget(eStructuralFeature.getEContainingClass());
EStructuralFeature targetEf = eClass.getEStructuralFeature(eStructuralFeature.getName());
return targetEf;
}
/**
* This Method WILL BE REMOVED when EMF 3.0 is available
*/
public void copyReferences()
{
for (Iterator i = entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
EObject eObject = (EObject)entry.getKey();
EObject copyEObject = (EObject)entry.getValue();
EClass eClass = eObject.eClass();
for (int j = 0, size = eClass.getFeatureCount(); j < size; ++j)
{
EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(j);
if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived())
{
if (eStructuralFeature instanceof EReference)
{
EReference eReference = (EReference)eStructuralFeature;
if (!eReference.isContainment() && !eReference.isContainer())
{
copyReference(eReference, eObject, copyEObject);
}
}
else if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
{
FeatureMap featureMap = (FeatureMap)eObject.eGet(eStructuralFeature);
FeatureMap copyFeatureMap = (FeatureMap)copyEObject.eGet(getTarget(eStructuralFeature));
int copyFeatureMapSize = copyFeatureMap.size();
for (int k = 0, featureMapSize = featureMap.size(); k < featureMapSize; ++k)
{
EStructuralFeature feature = featureMap.getEStructuralFeature(k);
if (feature instanceof EReference)
{
Object referencedEObject = featureMap.getValue(k);
Object copyReferencedEObject = get(referencedEObject);
if (copyReferencedEObject == null && referencedEObject != null)
{
EReference reference = (EReference)feature;
if (!useOriginalReferences || reference.isContainment() || reference.getEOpposite() != null)
{
continue;
}
copyReferencedEObject = referencedEObject;
}
// If we can't add it, it must aleady be in the list so find it and move it to the end.
//
if (!copyFeatureMap.add(feature, copyReferencedEObject))
{
for (int l = 0; l < copyFeatureMapSize; ++l)
{
if (copyFeatureMap.getEStructuralFeature(l) == feature && copyFeatureMap.getValue(l) == copyReferencedEObject)
{
copyFeatureMap.move(copyFeatureMap.size() - 1, l);
--copyFeatureMapSize;
break;
}
}
}
}
else
{
copyFeatureMap.add(featureMap.get(k));
}
}
}
}
}
}
}
/**
* This Method WILL BE REMOVED when EMF 3.0 is available
*/
protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject)
{
if (eObject.eIsSet(eReference))
{
if (eReference.isMany())
{
InternalEList source = (InternalEList)eObject.eGet(eReference);
InternalEList target = (InternalEList)copyEObject.eGet(getTarget(eReference));
if (source.isEmpty())
{
target.clear();
}
else
{
boolean isBidirectional = eReference.getEOpposite() != null;
int index = 0;
for (Iterator k = resolveProxies ? source.iterator() : source.basicIterator(); k.hasNext();)
{
Object referencedEObject = k.next();
Object copyReferencedEObject = get(referencedEObject);
if (copyReferencedEObject == null)
{
if (useOriginalReferences && !isBidirectional)
{
target.addUnique(index, referencedEObject);
++index;
}
}
else
{
if (isBidirectional)
{
int position = target.indexOf(copyReferencedEObject);
if (position == -1)
{
target.addUnique(index, copyReferencedEObject);
}
else if (index != position)
{
target.move(index, copyReferencedEObject);
}
}
else
{
target.addUnique(index, copyReferencedEObject);
}
++index;
}
}
}
}
else
{
Object referencedEObject = eObject.eGet(eReference, resolveProxies);
if (referencedEObject == null)
{
copyEObject.eSet(getTarget(eReference), null);
}
else
{
Object copyReferencedEObject = get(referencedEObject);
if (copyReferencedEObject == null)
{
if (useOriginalReferences && eReference.getEOpposite() == null)
{
copyEObject.eSet(getTarget(eReference), referencedEObject);
}
}
else
{
copyEObject.eSet(getTarget(eReference), copyReferencedEObject);
}
}
}
}
}
}
}

View file

@ -0,0 +1,59 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.DataFactory;
import commonj.sdo.helper.HelperContext;
/**
* A Factory for creating DataObjects. The created DataObjects are not connected
* to any other DataObjects.
*/
public class DataFactoryImpl implements DataFactory {
protected HelperContext helperContext;
public DataFactoryImpl(HelperContext hc) {
this.helperContext = hc;
}
public DataObject create(String uri, String typeName) {
Type type = helperContext.getTypeHelper().getType(uri, typeName);
return create(type);
}
public DataObject create(Class interfaceClass) {
// TODO more efficient implementation ... this is a really bad one!
Type type = helperContext.getTypeHelper().getType(interfaceClass);
return create(type);
}
public DataObject create(Type type) {
return DataObjectUtil.create(type);
}
public HelperContext getHelperContext() {
return helperContext;
}
}

View file

@ -0,0 +1,615 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import commonj.sdo.Property;
import commonj.sdo.Type;
import commonj.sdo.helper.DataHelper;
/**
* Data helper methods.
*/
public class DataHelperImpl implements DataHelper
{
/**
* @param dateString - Must comply to the pattern of yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'
* @return null if dataString couldn't be parsed
*/
public synchronized Date toDate(String dateString)
{
if (dateString == null)
{
return null;
}
SDOSimpleDateFormat format;
Date result = null;
boolean negative = false;
String formatString;
dateString = dateString.trim();
// Determine if it is a negative Date, DateTime, or Duration
if (dateString.length() > 2 && dateString.charAt(0) == '-' && dateString.charAt(1) != '-')
{
negative = true;
dateString = dateString.substring(1);
}
// SDO Date Format ends with a Z
if (dateString.endsWith("Z"))
{
if (dateString.indexOf('.') != -1)
formatString = new String("yyyy-MM-dd'T'HH:mm:ss'.'S'Z'");
else
formatString = new String ("yyyy-MM-dd'T'HH:mm:ss'Z'");
format = new SDOSimpleDateFormat(formatString);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
result = checkFormat(dateString, format);
// If no match, continue to try further possibilities
if (result != null)
{
if (negative)
return handleBCE(result);
else
return result;
}
}
// Duration format begins with a P
if (dateString.startsWith("P"))
{
// Remove any spaces in the dateString
String durationString = dateString.replaceAll(" ", "");
// Build the formatString based on the contents of dateString
formatString = obtainDurationFormats(durationString);
format = new SDOSimpleDateFormat(formatString);
result = checkFormat(durationString, format);
if (result != null)
{
if (negative)
return handleNegative(result);
else
return result;
}
}
formatString = obtainSpecificFormat(dateString);
if (formatString != null)
{
format = new SDOSimpleDateFormat(formatString);
result = checkFormat(dateString, format);
if (result != null)
{
if (negative)
return handleBCE(result);
else
return result;
}
}
return null;
}
private synchronized Date checkFormat(String dateString, SDOSimpleDateFormat format)
{
String formatPattern = format.toPattern();
StringBuffer addedFields = new StringBuffer();
String fieldsString, parseString;
SDOSimpleDateFormat compositeFormat;
Date dateValue;
// For certain permissable input strings (e.g. those resulting from toYear
// toDay, toTime), there are fields missing which when converted to Date have
// default values. (e.g. Year -> 1970). Because of this, there can be great
// variation in how daylight savings time is accounted for. (e.g. In 1970 Britain
// was on DST year round, and during the summer of 1944 was on double daylight time.)
// Because these possible variations exist, it is assumed that the user would prefer
// the current handling of daylight savings time. As such, the year, month and day
// will default to their current values when absent. (The user should not be checking
// for Year=1970 (etc.) as evidence of taking the default, as explicitly setting a
// year to 1970 is valid and would then not be an instance of a default taken.)
if (!(formatPattern.startsWith("P")))
{
if (formatPattern.indexOf('y') == -1)
addedFields.append("yyyy ");
if (formatPattern.indexOf('M') == -1)
addedFields.append("MM ");
if (formatPattern.indexOf('d') == -1)
addedFields.append("dd ");
}
fieldsString = addedFields.toString();
if (fieldsString.length() == 0)
{
parseString = dateString;
compositeFormat = format;
}
else
{
compositeFormat = new SDOSimpleDateFormat(fieldsString);
dateValue = new Date(System.currentTimeMillis());
parseString = compositeFormat.format(dateValue) + dateString;
compositeFormat.applyPattern(fieldsString + formatPattern);
}
try
{
return compositeFormat.parse(parseString);
}
catch (ParseException parseException)
{
}
return null;
}
public synchronized String obtainSpecificFormat(String dateString)
{
StringBuffer formatBuffer = new StringBuffer();
int colonIndex = dateString.indexOf(':');
int hyphenIndex = dateString.indexOf('-');
if (dateString.startsWith("--"))
{
if (dateString.charAt(2) == '-') // starts with ---
formatBuffer.append("'---'dd");
else if (dateString.substring(2).indexOf('-') == -1)
formatBuffer.append("'--'MM");
else
formatBuffer.append("'--'MM'-'dd");
}
else if (colonIndex == 1 || colonIndex == 2)
{
if (dateString.indexOf('.') != -1)
formatBuffer.append("HH:mm:ss'.'S");
else if (dateString.substring(colonIndex + 1).indexOf(':') != -1)
formatBuffer.append("HH:mm:ss");
else
formatBuffer.append("HH:mm");
}
else if (hyphenIndex != -1)
{
if (dateString.substring(hyphenIndex + 1).indexOf('-') == -1)
formatBuffer.append("yyyy-MM");
else if (colonIndex != -1)
{
if (dateString.indexOf('.') != -1)
formatBuffer.append("yyyy-MM-dd'T'HH:mm:ss'.'S");
else if (dateString.substring(colonIndex + 1).indexOf(':') != -1)
formatBuffer.append("yyyy-MM-dd'T'HH:mm:ss");
else
formatBuffer.append("yyyy-MM-dd'T'HH:mm");
}
else
formatBuffer.append ("yyyy-MM-dd");
}
else if (colonIndex == -1) // indexOf('-') == -1
{
formatBuffer.append("yyyy");
}
else
return null;
// Determine if a Time Zone is included and needs to be parsed.
// ---------------------------------
// The only letter allowed in the above formats is 'T'.
// All times zones include at least one letter other than 'T'.
int i = 0;
boolean letterFound = false;
char currentChar;
while (i < dateString.length() && !letterFound)
{
currentChar = dateString.charAt(i);
if (Character.isLetter(currentChar) && currentChar != 'T')
letterFound = true;;
i++;
}
if (letterFound)
formatBuffer.append(" z");
return formatBuffer.toString();
}
public synchronized String obtainDurationFormats(String dateString)
{
String firstPart, secondPart;
StringBuffer formatBuffer = new StringBuffer("'P'");
// Must divide it into two parts to distinguish between Months and Minutes
int time_index = dateString.indexOf('T');
if (time_index != -1)
{
firstPart = dateString.substring(0, time_index + 1);
secondPart = dateString.substring(time_index);
}
else
{
firstPart = dateString;
secondPart = null;
}
if (firstPart.indexOf('Y') != -1)
formatBuffer.append("yyyy'Y'");
if (firstPart.indexOf('M') != -1)
formatBuffer.append("MM'M'");
if (firstPart.indexOf('D') != -1)
formatBuffer.append("dd'D'");
if (time_index != -1)
{
formatBuffer.append("'T'");
if (secondPart.indexOf('H') != -1)
formatBuffer.append("HH'H'");
if (secondPart.indexOf('M') != -1)
formatBuffer.append("mm'M'");
if (secondPart.indexOf("S.") != -1)
formatBuffer.append("ss'S'.S");
else if (secondPart.indexOf('S') != -1)
formatBuffer.append("ss'S'");
}
return formatBuffer.toString().replaceAll("''", "");
}
// Return a negative Duration if a negative sign existed in dateString
public synchronized Date handleNegative(Date output)
{
return new Date(0 - output.getTime());
}
// Return the date in BCE if a negative sign existed in dateString
public synchronized Date handleBCE(Date output)
{
GregorianCalendar temp = new GregorianCalendar();
temp.setTime(output);
temp.set(GregorianCalendar.ERA, GregorianCalendar.BC);
return temp.getTime();
}
public synchronized Calendar toCalendar(String dateString)
{
return toCalendar(dateString, null);
}
public synchronized Calendar toCalendar(String dateString, Locale locale)
{
if (dateString == null)
{
return null;
}
Date date = toDate(dateString);
if (date == null)
{
return null;
}
Calendar calendar = locale != null ? new GregorianCalendar(locale) : new GregorianCalendar();
calendar.setTime(date);
return calendar;
}
public synchronized String toDateTime(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'");
f.setTimeZone(TimeZone.getTimeZone("UTC"));
return f.format(date);
}
public synchronized String toDuration(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("'P'yyyy'Y' MM'M' dd'D' 'T' HH'H' mm'M' ss'S.'SSS");
return f.format(date);
}
public synchronized String toTime(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("HH:mm:ss'.'SSS zz");
return f.format(date);
}
public synchronized String toDay(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("---dd zz");
return f.format(date);
}
public synchronized String toMonth(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("--MM zz");
return f.format(date);
}
public synchronized String toMonthDay(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("--MM-dd zz");
return f.format(date);
}
public synchronized String toYear(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy zz");
return f.format(date);
}
public synchronized String toYearMonth(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy-MM zz");
return f.format(date);
}
public synchronized String toYearMonthDay(Date date)
{
if (date == null)
{
return null;
}
SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy-MM-dd zz");
return f.format(date);
}
public synchronized String toDateTime(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toDateTime(calendar.getTime());
}
public synchronized String toDuration(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toDuration(calendar.getTime());
}
public synchronized String toTime(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toTime(calendar.getTime());
}
public synchronized String toDay(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toDay(calendar.getTime());
}
public synchronized String toMonth(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toMonth(calendar.getTime());
}
public synchronized String toMonthDay(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toMonthDay(calendar.getTime());
}
public synchronized String toYear(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toYear(calendar.getTime());
}
public synchronized String toYearMonth(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toYearMonth(calendar.getTime());
}
public synchronized String toYearMonthDay(Calendar calendar)
{
if (calendar == null)
{
return null;
}
return toYearMonthDay(calendar.getTime());
}
public Object convert(Type type, Object value)
{
Class typeClass = type.getInstanceClass();
if (typeClass.isInstance(value))
return value;
if (typeClass == BigDecimal.class) {
return DataObjectUtil.getBigDecimal(value);
}
else if (typeClass == BigInteger.class) {
return DataObjectUtil.getBigInteger(value);
}
else if (typeClass == boolean.class || typeClass == Boolean.class) {
return new Boolean(DataObjectUtil.getBoolean(value));
}
else if (typeClass == byte.class || typeClass == Byte.class) {
return new Byte(DataObjectUtil.getByte(value));
}
else if (typeClass == byte[].class) {
return DataObjectUtil.getBytes(value);
}
else if (typeClass == char.class || typeClass == Character.class) {
return new Character(DataObjectUtil.getChar(value));
}
else if (typeClass == Date.class) {
return DataObjectUtil.getDate(value);
}
else if (typeClass == double.class || typeClass == Double.class) {
return new Double(DataObjectUtil.getDouble(value));
}
else if (typeClass == float.class || typeClass == Float.class) {
return new Float(DataObjectUtil.getFloat(value));
}
else if (typeClass == int.class || typeClass == Integer.class) {
return new Integer(DataObjectUtil.getInt(value));
}
else if (typeClass == long.class || typeClass == Long.class) {
return new Long(DataObjectUtil.getLong(value));
}
else if (typeClass == short.class || typeClass == Short.class) {
return new Short(DataObjectUtil.getShort(value));
}
else if (typeClass == String.class) {
return DataObjectUtil.getString(value);
}
throw new IllegalArgumentException();
}
public Object convert(Property property, Object value)
{
Type type = property.getType();
if (!property.isMany())
{
return convert(type, value);
}
else
{
List listValue = (List)value;
List listResult = new ArrayList();
for (Iterator iter = listValue.iterator(); iter.hasNext(); ) {
listResult.add(convert(type, iter.next()));
}
return listResult;
}
}
}

View file

@ -0,0 +1,72 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
public class DefaultHelperContextImpl extends HelperContextImpl {
public DefaultHelperContextImpl(final boolean extensibleNamespaces) {
super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces);
}
public DefaultHelperContextImpl(final boolean extensibleNamespaces, final Map options) {
super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces, options);
}
protected static class SDOPackageRegistryDelegator extends EPackageRegistryImpl.Delegator {
/**
* A map from class loader to its associated registry.
*/
protected Map classLoaderToRegistryMap = new WeakHashMap();
/**
* Returns the package registry associated with the given class loader.
* @param classLoader the class loader.
* @return the package registry associated with the given class loader.
*/
public synchronized EPackage.Registry getRegistry(final ClassLoader classLoader)
{
EPackage.Registry result = (EPackage.Registry)classLoaderToRegistryMap.get(classLoader);
if (result == null)
{
if (classLoader == null)
{
result = HelperContextImpl.getBuiltInModelRegistry();
}
else
{
result = new EPackageRegistryImpl(getRegistry(classLoader.getParent()));
classLoaderToRegistryMap.put(classLoader, result);
}
}
return result;
}
protected EPackage.Registry delegateRegistry(final ClassLoader classLoader)
{
return getRegistry(classLoader);
}
}
}

View file

@ -0,0 +1,96 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
import commonj.sdo.DataObject;
import commonj.sdo.helper.EqualityHelper;
/**
* A helper for comparing DataObjects.
*/
public class EqualityHelperImpl implements EqualityHelper
{
public boolean equalShallow(DataObject dataObject1, DataObject dataObject2)
{
EcoreUtil.EqualityHelper equalityHelper = new EcoreUtil.EqualityHelper()
{
protected boolean haveEqualFeature(EObject eObject1, EObject eObject2, EStructuralFeature feature)
{
if (feature instanceof EAttribute)
{
if(!("ChangeSummaryType".equals(feature.getEType().getName()) && "commonj.sdo".equals(feature.getEType().getEPackage().getNsURI()))) {
boolean eIsSet = eObject1.eIsSet(feature);
if (eIsSet != eObject2.eIsSet(feature) || !haveEqualAttribute(eObject1, eObject2, (EAttribute)feature))
{
return false;
}
}
}
return true;
}
protected boolean equalFeatureMapValues(Object value1, Object value2, EStructuralFeature feature)
{
if (feature instanceof EAttribute)
{
return value1 == null ? value2 == null : value1.equals(value2);
}
return true;
}
};
return equalityHelper.equals((EObject)dataObject1, (EObject)dataObject2);
}
public boolean equal(DataObject dataObject1, DataObject dataObject2)
{
EcoreUtil.EqualityHelper equalityHelper = new EcoreUtil.EqualityHelper()
{
protected boolean haveEqualAttribute(EObject eObject1, EObject eObject2, EAttribute attribute) {
if(("ChangeSummaryType".equals(attribute.getEType().getName()) && "commonj.sdo".equals(attribute.getEType().getEPackage().getNsURI()))) {
throw new UnsupportedOperationException("This will be implemented when change summary serialzation/deserialization is in place");
}
else if( "Bytes".equals(attribute.getEType().getName()) ) {
try
{
byte [] value1 = (byte [])eObject1.eGet(attribute);
byte [] value2 = (byte [])eObject2.eGet(attribute);
return( java.util.Arrays.equals(value1,value2) );
}
catch(Exception ex)
{
// if any exception is thrown, assumption is they are not equal
return false;
}
}
else {
return super.haveEqualAttribute(eObject1, eObject2, attribute);
}
}
};
return equalityHelper.equals((EObject)dataObject1, (EObject)dataObject2); }
}

View file

@ -0,0 +1,193 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.change.ChangePackage;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
import commonj.sdo.helper.CopyHelper;
import commonj.sdo.helper.DataFactory;
import commonj.sdo.helper.DataHelper;
import commonj.sdo.helper.EqualityHelper;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.api.XMLStreamHelper;
public class HelperContextImpl implements HelperContext {
/*
* Relationship: HelperContext*Impl* ---1:1---> ExtendedMetaData ---1:1--->
* Map (:defaultOption) <---1:1---> TypeHelper <---1:1---> XMLHelper
* <---1:1---> XMLStreamHelper <---1:1---> XSDHelper <---1:1---> DataFactory
*/
protected ExtendedMetaData extendedMetaData;
protected DataFactory dataFactory;
protected TypeHelper typeHelper;
protected XMLHelper xmlHelper;
protected XSDHelper xsdHelper;
protected XMLStreamHelper xmlStreamHelper;
protected Map defaultOptions = null;
public HelperContextImpl(ExtendedMetaData extendedMetaData, boolean extensibleNamespaces) {
this.defaultOptions = null;
this.extendedMetaData = extendedMetaData;
typeHelper = new TypeHelperImpl(this);
dataFactory = new DataFactoryImpl(this);
xmlHelper = new XMLHelperImpl(this);
xsdHelper = new XSDHelperImpl(this, null, extensibleNamespaces);
xmlStreamHelper = new XMLStreamHelperImpl(this);
}
public HelperContextImpl(ExtendedMetaData extendedMetaData, boolean extensibleNamespaces, Map options) {
this.defaultOptions = options;
this.extendedMetaData = extendedMetaData;
typeHelper = new TypeHelperImpl(this);
dataFactory = new DataFactoryImpl(this);
xmlHelper = new XMLHelperImpl(this);
xsdHelper = new XSDHelperImpl(this, null, extensibleNamespaces);
xmlStreamHelper = new XMLStreamHelperImpl(this);
}
// many places this is called in existing code
// This is used for supporting the deprecated util -
// org.apache.tuscany.sdo.util.SDOUtil
// Once we conpletely remove this deprecated util, we can remove the below
// constructor
public HelperContextImpl(TypeHelper scope) {
this(scope, null);
}
public HelperContextImpl(TypeHelper scope, Map options) {
this.defaultOptions = options;
typeHelper = scope;
this.extendedMetaData = ((TypeHelperImpl)scope).getExtendedMetaData();
dataFactory = new DataFactoryImpl(this);
xmlHelper = new XMLHelperImpl(this);
xsdHelper = new XSDHelperImpl(this);
xmlStreamHelper = new XMLStreamHelperImpl(this);
}
public HelperContextImpl(boolean extensibleNamespaces) {
this(new SDOExtendedMetaDataImpl(new EPackageRegistryImpl(getBuiltInModelRegistry())), extensibleNamespaces);
}
public HelperContextImpl(boolean extensibleNamespaces, Map options) {
this(new SDOExtendedMetaDataImpl(new EPackageRegistryImpl(getBuiltInModelRegistry())), extensibleNamespaces,
options);
}
static protected EPackage.Registry builtInModelRegistry = null;
static public EPackage.Registry getBuiltInModelRegistry() {
if (builtInModelRegistry == null) {
EPackageRegistryImpl registry = new EPackageRegistryImpl();
for (Iterator iter = TypeHelperImpl.getBuiltInModels().iterator(); iter.hasNext();) {
EPackage ePackage = (EPackage)iter.next();
registry.put(ePackage.getNsURI(), ePackage);
}
registry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
registry.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
registry.put(ChangePackage.eNS_URI, ChangePackage.eINSTANCE);
registry.put(XMLNamespacePackage.eNS_URI, XMLNamespacePackage.eINSTANCE);
registry.put(SDOPackage.eNS_URI, SDOPackage.eINSTANCE);
builtInModelRegistry = registry;
}
return builtInModelRegistry;
}
public CopyHelper getCopyHelper() {
return CopyHelper.INSTANCE;
}
public DataFactory getDataFactory() {
return dataFactory;
}
public DataHelper getDataHelper() {
return DataHelper.INSTANCE;
}
public EqualityHelper getEqualityHelper() {
return EqualityHelper.INSTANCE;
}
public TypeHelper getTypeHelper() {
return typeHelper;
}
public XMLHelper getXMLHelper() {
return xmlHelper;
}
public XMLStreamHelper getXMLStreamHelper() {
return xmlStreamHelper;
}
public XSDHelper getXSDHelper() {
return xsdHelper;
}
public void setOptions(Map options) {
this.defaultOptions = options;
}
public Map getOptions() {
return this.defaultOptions;
}
public Map getMergedOption(Map options) {
Map mergedOptions = null;// copy to be used for merge
if (defaultOptions == null) {
return options;
}
mergedOptions = new HashMap(defaultOptions);
if (options == null) {
return mergedOptions;
}
mergedOptions.putAll(options);
return mergedOptions;
}
public ExtendedMetaData getExtendedMetaData() {
return extendedMetaData;
}
}

View file

@ -0,0 +1,50 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import org.apache.tuscany.sdo.spi.HelperProviderBase;
import commonj.sdo.helper.HelperContext;
/**
* Create and manage all the default helper INSTANCEs
*/
public class HelperProviderImpl extends HelperProviderBase
{
public HelperContext createDefaultHelpers()
{
//FB HelperContext hc = SDOUtil.createHelperContext();
//FB The defulat HelperContext must use EMF's ClassLoader-delegating EPackage.Registry.INSTANCE, until we provide
//FB another way to get (ClassLoader scope) support for HelperContext.
HelperContext hc = new DefaultHelperContextImpl(false);
typeHelper = hc.getTypeHelper();
dataFactory = hc.getDataFactory();
xmlHelper = hc.getXMLHelper();
xsdHelper = hc.getXSDHelper();
copyHelper = new CopyHelperImpl();
equalityHelper = new EqualityHelperImpl();
dataHelper = new DataHelperImpl();
sdoHelper = new SDOHelperImpl();
xmlStreamHelper = ((HelperContextImpl)hc).getXMLStreamHelper();
return hc;
}
}

View file

@ -0,0 +1,51 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
public class SDOAnnotations
{
public static final String COLON = ":";
public static final String COMMONJ_SDO_NS = "commonj.sdo";
public static final String COMMONJ_SDO_NS_PREFIX = "sdo";
public static final String SDO_JAVA_NS = "commonj.sdo/java";
public static final String SDO_JAVA_NS_PREFIX = "sdoJava";
public static final String JAVA_PACKAGE = SDO_JAVA_NS_PREFIX + COLON + "package";
public static final String ALIAS_NAMES = COMMONJ_SDO_NS_PREFIX + COLON + "aliasName";
public static final String READ_ONLY = COMMONJ_SDO_NS_PREFIX + COLON + "readOnly";
public static final String INSTANCE_CLASS = SDO_JAVA_NS_PREFIX + COLON + "instanceClass";
public static final String ABSTRACT_TYPE = "abstract";
public static final String PROPERTY_TYPE = COMMONJ_SDO_NS_PREFIX + COLON + "propertyType";
public static final String OPPOSITE_PROPERTY = COMMONJ_SDO_NS_PREFIX + COLON + "oppositeProperty";
//used by the annotations map to uniquely identify schema elements that need to be annotated
//and to store the corresponding annotations in a map
public static final String SCHEMA = "schema";
public static final String ELEMENT = "element";
public static final String COMPLEX_TYPE = "complexType";
public static final String SIMPLE_TYPE = "simpleType";
public static final String ATTRIBUTE = "attribute";
public static String makeAnnotationMapKey(String namespace, String schemaElementType, String nameAttrValue)
{
return namespace + schemaElementType + nameAttrValue;
}
}

View file

@ -0,0 +1,308 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.tuscany.sdo.SDOExtendedMetaData;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.impl.SDOFactoryImpl.SDOEcoreFactory;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EPackage.Registry;
/**
* TODO make demand() methods synchronous?
*/
public class SDOExtendedMetaDataImpl
extends BaseSDOExtendedMetaDataImpl
implements SDOExtendedMetaData
{
public SDOExtendedMetaDataImpl() {
this(HelperContextImpl.getBuiltInModelRegistry());
}
public SDOExtendedMetaDataImpl(Registry registry) {
super(registry);
ecoreFactory = new SDOEcoreFactory();
demandMetaData = new SDODemandMetaData();
//demandRegistry.put("commonj.sdo", SDOPackage.eINSTANCE);
}
public static class SDODemandMetaData extends DemandMetaData {
EClassifier getEObject() { return (EClassifier)((ModelFactoryImpl)ModelFactory.INSTANCE).getDataObject(); }
EClassifier getAnySimpleType() { return (EClassifier)((ModelFactoryImpl)ModelFactory.INSTANCE).getObject(); }
}
public EPackage getPackage(String namespace)
{
if ("".equals(namespace)) namespace = null; //FB
EPackage result = registry.getEPackage(namespace);
return result == null ? super.getPackage(namespace) : result;
}
/**
* Returns the listing of alias names as specified by the sdo:aliasNames
* property.
*/
public List getAliasNames(EModelElement modelElement) {
EAnnotation eAnnotation = getAnnotation(modelElement, false);
List list = null;
if (eAnnotation != null) {
String aliasNames = (String)eAnnotation.getDetails().get("aliasNames");
if (aliasNames != null) {
list = new ArrayList();
StringTokenizer st = new StringTokenizer(aliasNames, " ");
while (st.hasMoreTokens()) {
String t = st.nextToken();
list.add(t);
}
}
}
return list;
}
public void setAliasNames(EModelElement modelElement, List aliasNames) {
if (aliasNames == null || aliasNames.isEmpty()) {
setAliasNames(modelElement, (String)null);
} else {
StringBuffer buf = new StringBuffer();
for (int n = 0; n < aliasNames.size(); n++) {
String name = (String) aliasNames.get(n);
buf.append(name);
buf.append(" ");
}
setAliasNames(modelElement, buf.toString());
}
}
/**
* Adds an alias name per sdo:aliasName
*/
public void setAliasNames(EModelElement modelElement, String aliasNames) {
EAnnotation eAnnotation = getAnnotation(modelElement, true);
eAnnotation.getDetails().put("aliasNames", aliasNames);
}
public EPackage.Registry getRegistry()
{
return registry;
}
boolean featureNamespaceMatchingLax = true;
public void setFeatureNamespaceMatchingLax(boolean b) {
featureNamespaceMatchingLax = b;
}
protected boolean isFeatureNamespaceMatchingLax() {
return featureNamespaceMatchingLax;
}
/*
* (non-Javadoc)
*
* Eagerly pre-cache the "holder"s for static packages.
*
* @see org.eclipse.emf.ecore.util.BasicExtendedMetaData#putPackage(java.lang.String,
* org.eclipse.emf.ecore.EPackage)
*/
public void putPackage(String namespace, EPackage ePackage) {
for (Iterator iterator = ePackage.eAllContents(); iterator.hasNext();) {
Object object = iterator.next();
if (object instanceof EClassifier) {
this.getName((EClassifier) object);
} else if (object instanceof EStructuralFeature) {
this.getName((EStructuralFeature) object);
}
}
super.putPackage(namespace, ePackage);
}
/******************************************************************************************************
* Following methods, getLocalAttribute & getLocalElement, ARE TEMPORARY COPIES FROM THE BASE CLASS.
* One line (the last line)in each method is changed to support lax namespace matching.
* DO NOT EDIT THESE METHODS. THEY WILL BE REMOVED WHEN WE MOVE TO EMF 2.3, WHICH FIXES THE PROBLEM.
******************************************************************************************************/
public EStructuralFeature getLocalAttribute(EClass eClass, String namespace, String name)
{
EStructuralFeature result = null;
if (isFeatureKindSpecific())
{
List allAttributes = getAllAttributes(eClass);
for (int i = 0, size = allAttributes.size(); i < size; ++i)
{
EStructuralFeature eStructuralFeature = (EStructuralFeature) allAttributes.get(i);
if (name.equals(getName(eStructuralFeature)))
{
String featureNamespace = getNamespace(eStructuralFeature);
if (namespace == null)
{
if (featureNamespace == null)
{
return eStructuralFeature;
}
else if (result == null)
{
result = eStructuralFeature;
}
}
else if (namespace.equals(featureNamespace))
{
return eStructuralFeature;
}
else if (featureNamespace == null && result == null)
{
result = eStructuralFeature;
}
}
}
}
else
{
for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)
{
EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
switch (getFeatureKind(eStructuralFeature))
{
case UNSPECIFIED_FEATURE:
case ATTRIBUTE_FEATURE:
{
if (name.equals(getName(eStructuralFeature)))
{
String featureNamespace = getNamespace(eStructuralFeature);
if (namespace == null)
{
if (featureNamespace == null)
{
return eStructuralFeature;
}
else if (result == null)
{
result = eStructuralFeature;
}
}
else if (namespace.equals(featureNamespace))
{
return eStructuralFeature;
}
else if (featureNamespace == null && result == null)
{
result = eStructuralFeature;
}
}
break;
}
}
}
}
return isFeatureNamespaceMatchingLax() ? result : null;
}
protected EStructuralFeature getLocalElement(EClass eClass, String namespace, String name)
{
EStructuralFeature result = null;
if (isFeatureKindSpecific())
{
List allElements = getAllElements(eClass);
for (int i = 0, size = allElements.size(); i < size; ++i)
{
EStructuralFeature eStructuralFeature = (EStructuralFeature) allElements.get(i);
if (name.equals(getName(eStructuralFeature)))
{
String featureNamespace = getNamespace(eStructuralFeature);
if (namespace == null)
{
if (featureNamespace == null)
{
return eStructuralFeature;
}
else if (result == null)
{
result = eStructuralFeature;
}
}
else if (namespace.equals(featureNamespace))
{
return eStructuralFeature;
}
else if (featureNamespace == null && result == null)
{
result = eStructuralFeature;
}
}
}
}
else
{
for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)
{
EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
switch (getFeatureKind(eStructuralFeature))
{
case UNSPECIFIED_FEATURE:
case ELEMENT_FEATURE:
{
if (name.equals(getName(eStructuralFeature)))
{
String featureNamespace = getNamespace(eStructuralFeature);
if (namespace == null)
{
if (featureNamespace == null)
{
return eStructuralFeature;
}
else if (result == null)
{
result = eStructuralFeature;
}
}
else if (namespace.equals(featureNamespace))
{
return eStructuralFeature;
}
else if (featureNamespace == null && result == null)
{
result = eStructuralFeature;
}
}
break;
}
}
}
}
return isFeatureNamespaceMatchingLax() ? result : null;
}
}

View file

@ -0,0 +1,530 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.tuscany.sdo.SDOExtendedMetaData;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.apache.tuscany.sdo.api.SDOHelper;
import org.apache.tuscany.sdo.api.XMLStreamHelper;
import org.apache.tuscany.sdo.api.EventListener;
import org.apache.tuscany.sdo.impl.ClassImpl;
import org.apache.tuscany.sdo.impl.DataGraphImpl;
import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
import org.apache.tuscany.sdo.spi.SDOHelperBase;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.xmi.XMLResource;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import commonj.sdo.helper.CopyHelper;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
import commonj.sdo.impl.HelperProvider;
public class SDOHelperImpl extends SDOHelperBase implements SDOHelper, SDOHelper.MetaDataBuilder {
public DataObject createDataTypeWrapper(Type dataType, Object value) {
SimpleAnyTypeDataObject simpleAnyType = SDOFactory.eINSTANCE.createSimpleAnyTypeDataObject();
simpleAnyType.setInstanceType((EDataType)dataType);
simpleAnyType.setValue(value);
return simpleAnyType;
}
public Object createFromString(Type dataType, String literal) {
return EcoreUtil.createFromString((EDataType)dataType, literal);
}
public String convertToString(Type dataType, Object value) {
return EcoreUtil.convertToString((EDataType)dataType, value);
}
public Type getXSDSDOType(String xsdType) {
Type type = null;
String name = (String)xsdToSdoMappings.get(xsdType);
if (name != null)
type = (Type)((ModelFactoryImpl)ModelFactory.INSTANCE).getEClassifier(name);
return type;
}
public Sequence getSubstitutionValues(DataObject dataObject, Property head) {
final EStructuralFeature group = ExtendedMetaData.INSTANCE.getGroup((EStructuralFeature)head);
return null == group ? null : (Sequence)((FeatureMap.Internal)((EObject)dataObject).eGet(group)).getWrapper();
}
public Type getJavaSDOType(Class javaClass) {
String name = (String)javaToSdoMappings.get(javaClass);
if (name != null) {
return (Type)((ModelFactoryImpl)ModelFactory.INSTANCE).getEClassifier(name);
}
return null;
}
public boolean isRequired(Property property) {
return ((EStructuralFeature)property).isRequired();
}
public int getUpperBound(Property property) {
return ((EStructuralFeature)property).getUpperBound();
}
public int getLowerBound(Property property) {
return ((EStructuralFeature)property).getLowerBound();
}
public List getEnumerationFacet(Type type) {
List instProps = type.getInstanceProperties();
String propertyName = "enumeration";
Property enumProperty = null;
for (int i = 0; i < instProps.size(); i++)
{
Property prop = (Property)instProps.get(i);
if (propertyName.equals(prop.getName()))
enumProperty = prop;
}
return (List)DataObjectUtil.getMetaObjectInstanceProperty((EModelElement)type, enumProperty);
}
public List getPatternFacet(Type type) {
List instProps = type.getInstanceProperties();
String propertyName = "pattern";
Property patternProperty = null;
for (int i = 0; i < instProps.size(); i++)
{
Property prop = (Property)instProps.get(i);
if (propertyName.equals(prop.getName()))
patternProperty = prop;
}
return (List)DataObjectUtil.getMetaObjectInstanceProperty((EModelElement)type, patternProperty);
}
public boolean isMany(Property property, DataObject context) {
return FeatureMapUtil.isMany((EObject)context, (EStructuralFeature)property);
}
public DataGraph createDataGraph() {
return SDOFactory.eINSTANCE.createDataGraph();
}
public void setRootObject(DataGraph dataGraph, DataObject rootObject) {
((DataGraphImpl)dataGraph).setERootObject((EObject)rootObject);
}
public static DataGraph loadDataGraph(InputStream inputStream, Map options) throws IOException {
ResourceSet resourceSet = DataObjectUtil.createResourceSet();
Resource resource = resourceSet.createResource(URI.createURI("all.datagraph"));
resource.load(inputStream, options);
return (DataGraph)resource.getContents().get(0);
}
static final Object LOADING_SCOPE = XMLResource.OPTION_EXTENDED_META_DATA;
protected void registerLoadingScope(Map options, TypeHelper scope) {
Object extendedMetaData = ((TypeHelperImpl)scope).getExtendedMetaData();
options.put(LOADING_SCOPE, extendedMetaData);
}
public DataGraph loadDataGraph(InputStream inputStream, Map options, HelperContext scope) throws IOException {
if (scope == null) {
scope = HelperProvider.getDefaultContext();
}
TypeHelper th = scope.getTypeHelper();
DataGraph result = null;
if (th == null || th == TypeHelper.INSTANCE) {
result = loadDataGraph(inputStream, options);
} else if (options == null) {
options = new HashMap();
registerLoadingScope(options, th);
result = loadDataGraph(inputStream, options);
} else if (options.containsKey(LOADING_SCOPE)) {
Object restore = options.get(LOADING_SCOPE);
registerLoadingScope(options, th);
try {
result = loadDataGraph(inputStream, options);
} finally {
options.put(LOADING_SCOPE, restore);
}
} else {
registerLoadingScope(options, th);
try {
result = loadDataGraph(inputStream, options);
} finally {
options.remove(LOADING_SCOPE);
}
}
return result;
}
public void saveDataGraph(DataGraph dataGraph, OutputStream outputStream, Map options) throws IOException {
((DataGraphImpl)dataGraph).getDataGraphResource().save(outputStream, options);
}
public void registerDataGraphTypes(DataGraph dataGraph, List/* Type */types) {
// if (types == null)
// types = SDOUtil.getDataGraphTypes(dataGraph);
Set/* EPackage */packages = new HashSet();
for (final Iterator iterator = types.iterator(); iterator.hasNext();) {
EClassifier type = (EClassifier)iterator.next();
packages.add(type.getEPackage());
}
ResourceSet resourceSet = ((DataGraphImpl)dataGraph).getResourceSet();
for (Iterator iterator = packages.iterator(); iterator.hasNext();) {
EPackage typePackage = (EPackage)iterator.next();
Resource resource = typePackage.eResource();
if (resource == null) {
resource = resourceSet.createResource(URI.createURI(".ecore"));
resource.setURI(URI.createURI(typePackage.getNsURI()));
resource.getContents().add(typePackage);
} else if (resource.getResourceSet() != resourceSet)
resourceSet.getResources().add(resource);
}
}
public HelperContext createHelperContext() {
return new HelperContextImpl(false, null);
}
public HelperContext createHelperContext(boolean extensibleNamespaces) {
return new HelperContextImpl(extensibleNamespaces);
}
public HelperContext createHelperContext(Map options) {
return new HelperContextImpl(false, options);
}
public HelperContext createHelperContext(boolean extensibleNamespaces, Map options) {
return new HelperContextImpl(extensibleNamespaces, options);
}
public CopyHelper createCrossScopeCopyHelper(HelperContext hc) {
return new CrossScopeCopyHelperImpl(hc.getTypeHelper());
}
public XMLStreamHelper createXMLStreamHelper(HelperContext hc) {
return ((HelperContextImpl)hc).getXMLStreamHelper();
}
public List getTypes(HelperContext hc, String uri) {
EPackage ePackage = ((HelperContextImpl)hc).getExtendedMetaData().getPackage(uri);
if (ePackage != null) {
return new ArrayList(ePackage.getEClassifiers());
}
return null;
}
public List getOpenContentProperties(DataObject dataObject) {
List result = new UniqueEList();
((ClassImpl)dataObject.getType()).addOpenProperties((EObject)dataObject, result);
return result;
}
public boolean isDocumentRoot(Type type) {
return "".equals(SDOExtendedMetaData.INSTANCE.getName((EClassifier)type));
}
public Type createType(HelperContext hc, String uri, String name, boolean isDataType) {
ExtendedMetaData extendedMetaData = ((HelperContextImpl)hc).getExtendedMetaData();
if ("".equals(uri))
uri = null; // FB
EPackage ePackage = extendedMetaData.getPackage(uri);
if (ePackage == null) {
ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
ePackage.setNsURI(uri);
String packagePrefix = uri != null ? URI.createURI(uri).trimFileExtension().lastSegment() : ""; // FB
ePackage.setName(packagePrefix);
ePackage.setNsPrefix(packagePrefix);
extendedMetaData.putPackage(uri, ePackage);
}
EClassifier eClassifier = ePackage.getEClassifier(name);
if (eClassifier != null) // already defined?
{
// throw new IllegalArgumentException();
return null;
}
if (name != null) {
eClassifier =
isDataType ? (EClassifier)SDOFactory.eINSTANCE.createDataType() : (EClassifier)SDOFactory.eINSTANCE
.createClass();
eClassifier.setName(name);
} else {
eClassifier = DataObjectUtil.createDocumentRoot();
}
ePackage.getEClassifiers().add(eClassifier);
return (Type)eClassifier;
}
public void addBaseType(Type type, Type baseType) {
((EClass)type).getESuperTypes().add((EClass) baseType);
}
public void addAliasName(Type type, String aliasName) {
throw new UnsupportedOperationException(); // TODO: implement this
// method properly
// type.getAliasNames().add(aliasName);
}
public void setOpen(Type type, boolean isOpen) {
if (isOpen == type.isOpen())
return;
if (isOpen) {
EAttribute eAttribute = (EAttribute)SDOFactory.eINSTANCE.createAttribute();
((EClass)type).getEStructuralFeatures().add(eAttribute);
eAttribute.setName("any");
eAttribute.setUnique(false);
eAttribute.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
eAttribute.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry());
ExtendedMetaData.INSTANCE.setFeatureKind(eAttribute, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE);
ExtendedMetaData.INSTANCE.setProcessingKind(eAttribute, ExtendedMetaData.LAX_PROCESSING);
ExtendedMetaData.INSTANCE.setWildcards(eAttribute, Collections.singletonList("##any"));
// FB TBD Add an "anyAttribute" EAttribute as well.
if (ExtendedMetaData.INSTANCE.getMixedFeature((EClass)type) != null) {
eAttribute.setDerived(true);
eAttribute.setTransient(true);
eAttribute.setVolatile(true);
}
} else {
EClass eClass = (EClass)type;
EAttribute any = (EAttribute)eClass.getEStructuralFeature("any");
eClass.getEStructuralFeatures().remove(any);
}
}
public void setSequenced(Type type, boolean isSequenced) {
// currently, we require setSequenced to be called first, before
// anything else is added to the type.
if (type.isDataType() || !type.getProperties().isEmpty()) {
if (type.getName() != "DocumentRoot") // document root is a
// special case
throw new IllegalArgumentException();
}
if (isSequenced) {
EClass eClass = (EClass)type;
ExtendedMetaData.INSTANCE.setContentKind(eClass, ExtendedMetaData.MIXED_CONTENT);
EAttribute mixedFeature = (EAttribute)SDOFactory.eINSTANCE.createAttribute();
mixedFeature.setName("mixed");
mixedFeature.setUnique(false);
mixedFeature.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry());
mixedFeature.setLowerBound(0);
mixedFeature.setUpperBound(-1);
// eClass.getEStructuralFeatures().add(mixedFeature);
((ClassImpl)eClass).setSequenceFeature(mixedFeature);
ExtendedMetaData.INSTANCE.setFeatureKind(mixedFeature, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE);
ExtendedMetaData.INSTANCE.setName(mixedFeature, ":mixed");
} else {
// nothing to do, because of current restriction that setSequence
// must be called first.
}
}
public void setAbstract(Type type, boolean isAbstract) {
((EClass)type).setAbstract(isAbstract);
}
public void setJavaClassName(Type type, String javaClassName) {
((EClassifier)type).setInstanceClassName(javaClassName);
}
public Property createProperty(Type containingType, String name, Type propertyType) {
EStructuralFeature eStructuralFeature =
propertyType.isDataType() ? (EStructuralFeature)SDOFactory.eINSTANCE.createAttribute()
: (EStructuralFeature)SDOFactory.eINSTANCE.createReference();
eStructuralFeature.setName(name);
eStructuralFeature.setEType((EClassifier)propertyType);
((EClass)containingType).getEStructuralFeatures().add(eStructuralFeature);
if ("".equals(ExtendedMetaData.INSTANCE.getName((EClass)containingType))) // DocumentRoot
// containingType?
{
ExtendedMetaData.INSTANCE.setNamespace(eStructuralFeature, containingType.getURI());
//FB???eStructuralFeature.setUnique(false);
//FB???eStructuralFeature.setUpperBound(ETypedElement.UNSPECIFIED_MULTIPLICITY);
}
if (ExtendedMetaData.INSTANCE.getMixedFeature((EClass)containingType) != null) {
eStructuralFeature.setDerived(true);
eStructuralFeature.setTransient(true);
eStructuralFeature.setVolatile(true);
ExtendedMetaData.INSTANCE.setFeatureKind(eStructuralFeature, ExtendedMetaData.ELEMENT_FEATURE);
} else {
// By default, a SDO property is an XSD element
ExtendedMetaData.INSTANCE.setFeatureKind(eStructuralFeature, ExtendedMetaData.ELEMENT_FEATURE);
}
return (Property)eStructuralFeature;
}
public void setPropertyXMLKind(Property property, boolean isXmlElement) {
if (isXmlElement) {
ExtendedMetaData.INSTANCE.setFeatureKind((EStructuralFeature)property, ExtendedMetaData.ELEMENT_FEATURE);
}
else {
ExtendedMetaData.INSTANCE.setFeatureKind((EStructuralFeature)property, ExtendedMetaData.ATTRIBUTE_FEATURE);
}
}
public Property createOpenContentProperty(HelperContext hc, String uri, String name, Type type)
{
ExtendedMetaData extendedMetaData = ((HelperContextImpl)hc).getExtendedMetaData();
// get/create document root
EPackage ePackage = extendedMetaData.getPackage(uri);
Type documentRoot = ePackage != null ? (Type)extendedMetaData.getType(ePackage, "") : null;
if (documentRoot == null) {
documentRoot = createType(hc, uri, null, false);
}
// Determine if property already exists
Property newProperty = documentRoot.getProperty(name);
if (newProperty == null) {
// Create the new property 'under' the document root.....
newProperty = createProperty(documentRoot, name, type);
} else {
// if property already exists, validate the expected type
if (!newProperty.getType().equals(type))
throw new IllegalArgumentException();
}
return newProperty;
}
public void addAliasName(Property property, String aliasName) {
throw new UnsupportedOperationException(); // TODO: implement this
// method properly
// property.getAliasNames().add(aliasName);
}
public void setMany(Property property, boolean isMany) {
((EStructuralFeature)property).setUpperBound(isMany ? EStructuralFeature.UNBOUNDED_MULTIPLICITY : 1);
}
public void setContainment(Property property, boolean isContainment) {
((EReference)property).setContainment(isContainment);
}
public void setDefault(Property property, String defaultValue) {
((EStructuralFeature)property).setDefaultValueLiteral(defaultValue);
}
public void setReadOnly(Property property, boolean isReadOnly) {
((EStructuralFeature)property).setChangeable(!isReadOnly);
}
public void setOpposite(Property property, Property opposite) {
((EReference)property).setEOpposite((EReference)opposite);
}
public void addTypeInstanceProperty(Type definedType, Property instanceProperty, Object value) {
addInstanceProperty((EModelElement)definedType, instanceProperty, value);
}
public void addPropertyInstanceProperty(Property definedProperty, Property instanceProperty, Object value) {
addInstanceProperty((EModelElement)definedProperty, instanceProperty, value);
}
protected void addInstanceProperty(EModelElement metaObject, Property property, Object value) {
String uri = property.getContainingType().getURI();
EAnnotation eAnnotation = metaObject.getEAnnotation(uri);
if (eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(uri);
metaObject.getEAnnotations().add(eAnnotation);
}
// TODO if (property.isMany()) ... // convert list of values
String stringValue = convertToString(property.getType(), value);
eAnnotation.getDetails().put(property.getName(), stringValue);
}
public void addChangeListener(DataObject dob, EventListener listener) {
// Adapter l = (Adapter)listener;
((Notifier)dob).eAdapters().add((Adapter) listener);
}
public void removeChangeListener(DataObject dob, EventListener listener) {
((Notifier)dob).eAdapters().remove(listener);
}
}

View file

@ -0,0 +1,92 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.TimeZone;
/**
* Fixes the bug reported at JIRA TUSCANY-1659
* This class ensures the time zone will be formatted as the abbreviation format.
*/
public class SDOSimpleDateFormat extends SimpleDateFormat {
private static final long serialVersionUID = 2519728288048681529L;
public SDOSimpleDateFormat() {
super();
setTimeZone(getTimeZone());
}
public SDOSimpleDateFormat(String pattern) {
super(pattern);
setTimeZone(getTimeZone());
}
public SDOSimpleDateFormat(String pattern, Locale locale) {
super(pattern, locale);
setTimeZone(getTimeZone());
}
public SDOSimpleDateFormat(String pattern, DateFormatSymbols formatSymbols) {
super(pattern, formatSymbols);
setTimeZone(getTimeZone());
}
/**
* Overrides the SimpleDateFormat.setTimeZone(TimeZone) method.
* It checks if the TimeZone to be set is in the abbreviation format.
* If not, it looks for its abbreviation format and set it.
*
* @param timeZone the time zone to be set
*
*/
public void setTimeZone(TimeZone timeZone) {
if (timeZone.getID().length() != 3) {
String[] timeZoneNames = TimeZone.getAvailableIDs(timeZone.getRawOffset());
for (int i = 0 ; i < timeZoneNames.length ; i++ ) {
String actualTimeZoneName = timeZoneNames[i].trim();
// if the time zone name has 3 letters and ends with a T character,
// it's considered to be the abbreviation format
if (actualTimeZoneName.length() == 3 && actualTimeZoneName.charAt(actualTimeZoneName.length() - 1) == 'T') {
timeZone = TimeZone.getTimeZone(timeZoneNames[i]);
break;
}
}
}
super.setTimeZone(timeZone);
}
}

View file

@ -0,0 +1,789 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.XMLConstants;
import org.apache.tuscany.sdo.SDOExtendedMetaData;
import org.apache.tuscany.sdo.api.SDOUtil;
import org.apache.tuscany.sdo.impl.AttributeImpl;
import org.apache.tuscany.sdo.impl.SDOFactoryImpl.SDOEcoreFactory;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.util.EcoreUtil.UsageCrossReferencer;
import org.eclipse.xsd.XSDComplexTypeDefinition;
import org.eclipse.xsd.XSDComponent;
import org.eclipse.xsd.XSDConcreteComponent;
import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDFeature;
import org.eclipse.xsd.XSDNamedComponent;
import org.eclipse.xsd.XSDParticle;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDSimpleTypeDefinition;
import org.eclipse.xsd.XSDTerm;
import org.eclipse.xsd.XSDTypeDefinition;
import org.eclipse.xsd.ecore.EcoreSchemaBuilder;
import org.eclipse.xsd.util.XSDResourceFactoryImpl;
import org.eclipse.xsd.util.XSDResourceImpl;
import org.eclipse.xsd.util.XSDSchemaLocator;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
public class SDOXSDEcoreBuilder extends BaseSDOXSDEcoreBuilder
{
protected boolean replaceConflictingTypes = false;
public SDOXSDEcoreBuilder(ExtendedMetaData extendedMetaData, boolean replaceConflictingTypes)
{
super(extendedMetaData);
ecoreFactory = new SDOEcoreFactory();
this.replaceConflictingTypes = replaceConflictingTypes;
populateTypeToTypeObjectMap((EPackage)ModelFactory.INSTANCE);
}
/**
* Overrides method in EMF. This will cause the SDO Properties to be in the
* order in which the Attributes appeared in the XSD.
*/
protected boolean useSortedAttributes()
{
return false;
}
/*
* Required for Java 1.4.2 support
* Node#lookupPrefix is only available since DOM Level 3 (Java 5)
* and it doesn't return rebound prefix.
* XSDConstants.lookupQualifier isn't supposed to return rebound prefix either.
* This lookupPrefix returns any bound prefix no matter rebound to other NameSpace or not, for {@link #getEPackage}.
*/
static protected String lookupPrefix(Node element, String namespaceURI) {
String prefix = element.getPrefix();
if (prefix != null && namespaceURI != null && namespaceURI.equals(element.getNamespaceURI()))
return prefix;
NamedNodeMap attributes = element.getAttributes();
if (attributes != null)
for (int index = attributes.getLength(); index != 0;) {
Node attribute = attributes.item(--index);
if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attribute.getNamespaceURI()) && attribute.getNodeValue().equals(namespaceURI)
&& XMLConstants.XMLNS_ATTRIBUTE.equals(attribute.getPrefix()))
return attribute.getLocalName();
}
for (Node parent; (parent = element.getParentNode()) != null; element = parent)
if (parent.getNodeType() == Node.ELEMENT_NODE)
return lookupPrefix(parent, namespaceURI);
return null;
}
public EPackage getEPackage(XSDNamedComponent xsdNamedComponent) {
XSDSchema containingXSDSchema = xsdNamedComponent.getSchema();
String targetNamespace = containingXSDSchema == null ?
xsdNamedComponent.getTargetNamespace() : containingXSDSchema.getTargetNamespace();
EPackage ePackage = (EPackage) targetNamespaceToEPackageMap.get(targetNamespace);
if (ePackage != null)
return ePackage;
ePackage = super.getEPackage(xsdNamedComponent);
String nsPrefix = lookupPrefix(xsdNamedComponent.getElement(), targetNamespace);
if (nsPrefix != null)
ePackage.setNsPrefix(nsPrefix);
return ePackage;
}
public EClassifier getEClassifier(XSDTypeDefinition xsdTypeDefinition) {
EClassifier eClassifier = null;
if (xsdTypeDefinition != null)
{
if (rootSchema.getSchemaForSchemaNamespace().equals(xsdTypeDefinition.getTargetNamespace())) {
eClassifier =
getBuiltInEClassifier(xsdTypeDefinition.getURI(), xsdTypeDefinition.getName());
}
else if (xsdTypeDefinition.getContainer() == null) {
EPackage pkg = extendedMetaData.getPackage(xsdTypeDefinition.getTargetNamespace());
if(pkg != null) {
eClassifier = pkg.getEClassifier(xsdTypeDefinition.getName());
}
}
}
if (eClassifier == null) {
eClassifier = super.getEClassifier(xsdTypeDefinition);
}
return eClassifier;
}
public EDataType getEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
EDataType eClassifier = null;
if (xsdSimpleTypeDefinition != null && rootSchema.getSchemaForSchemaNamespace().equals(xsdSimpleTypeDefinition.getTargetNamespace())) {
eClassifier =
(EDataType)getBuiltInEClassifier(
xsdSimpleTypeDefinition.getURI(),
xsdSimpleTypeDefinition.getName());
} else {
eClassifier = super.getEDataType(xsdSimpleTypeDefinition);
}
return (EDataType)eClassifier;
}
/* (non-Javadoc)
* @see org.eclipse.xsd.ecore.XSDEcoreBuilder#createResourceSet()
*/
protected ResourceSet createResourceSet() {
ResourceSet result = super.createResourceSet();
result.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XSDResourceFactoryImpl());
result.getAdapterFactories().add(new XSDSchemaAdapterFactoryImpl());
result.setPackageRegistry(new EPackageRegistryImpl(HelperContextImpl.getBuiltInModelRegistry()));
return result;
}
protected EClassifier getBuiltInEClassifier(String namespace, String name)
{
EClassifier eClassifier = null;
if ("base64Binary".equals(name)) {
eClassifier = (EClassifier)AttributeImpl.INTERNAL_BASE64_BYTES;
}
else if ("QName".equals(name)) {
eClassifier = (EClassifier)AttributeImpl.INTERNAL_QNAME;
}
else {
eClassifier = (EClassifier)SDOUtil.getXSDSDOType(name);
}
if (eClassifier == null)
eClassifier = super.getBuiltInEClassifier(namespace, name);
return eClassifier;
}
private void updateReferences(EObject oldEObject, EObject newEObject)
{
Collection usages = UsageCrossReferencer.find(oldEObject, targetNamespaceToEPackageMap.values());
for (Iterator iter = usages.iterator(); iter.hasNext(); )
{
EStructuralFeature.Setting setting = (EStructuralFeature.Setting)iter.next();
EObject referencingEObject = setting.getEObject();
EStructuralFeature eStructuralFeature = setting.getEStructuralFeature();
if (eStructuralFeature.isChangeable())
{
if (eStructuralFeature.isMany())
{
List refList = (List)referencingEObject.eGet(eStructuralFeature);
int refIndex = refList.indexOf(oldEObject);
if (refIndex != -1) refList.set(refIndex, newEObject);
}
else
{
referencingEObject.eSet(eStructuralFeature, newEObject);
}
}
}
}
private XSDTypeDefinition getXSDTypeDefinition(EClassifier eClassifier)
{
//TODO Maybe we should create a reverse (eModelElementToXSDComponentMap) for better performance.
// Use a HashMap subclass for xsdComponentToEModelElementMap that overrides put() to also add the
// reverse mapping in eModelElementToXSDComponentMap
XSDTypeDefinition xsdTypeDefinition = null;
for (Iterator i = xsdComponentToEModelElementMap.entrySet().iterator(); i.hasNext(); )
{
Entry e = (Entry) i.next();
if (eClassifier == e.getValue())
{
xsdTypeDefinition = (XSDTypeDefinition)e.getKey();
break;
}
}
return xsdTypeDefinition;
}
private boolean sameType(XSDTypeDefinition t1, XSDTypeDefinition t2)
{
XSDConcreteComponent n1 = t1, n2 = t2;
while (n1 != null && n2 != null)
{
if (n1.eClass() != n2.eClass()) break;
if (n1 instanceof XSDNamedComponent /*&& n2 instanceof XSDNamedComponent*/)
{
String s1 = ((XSDNamedComponent)n1).getName();
String s2 = ((XSDNamedComponent)n2).getName();
if (s1 == null ? s1 != s2 : !s1.equals(s2)) break;
}
n1 = n1.getContainer();
n2 = n2.getContainer();
}
return n1 == null && n2 == null;
}
protected void removeDuplicateEClassifier(EClassifier eClassifier, XSDTypeDefinition xsdTypeDefinition)
{
EPackage ePackage = eClassifier.getEPackage();
List eClassifiers = ePackage.getEClassifiers();
String name = eClassifier.getName();
int size = eClassifiers.size();
for (int index = eClassifiers.indexOf(eClassifier); ++index < size; )
{
EClassifier nextEClassifier = (EClassifier)eClassifiers.get(index);
if (!name.equals(nextEClassifier.getName())) break;
if (extendedMetaData.getName(eClassifier).equals(extendedMetaData.getName(nextEClassifier)))
{
XSDTypeDefinition nextXSDTypeDefinition = getXSDTypeDefinition(nextEClassifier);
if (!sameType(nextXSDTypeDefinition, xsdTypeDefinition))
{
//System.out.println("###EClassifier mismatch: ");
//System.out.println(" old: " + extendedMetaData.getName(nextEClassifier));
//System.out.println(" new: " + extendedMetaData.getName(eClassifier));
continue;
}
eClassifiers.remove(index);
updateReferences(nextEClassifier, eClassifier);
break;
}
}
}
protected void removeDuplicateDocumentRootFeature(EClass eClass, EStructuralFeature eStructuralFeature)
{
List eStructuralFeatures = eClass.getEStructuralFeatures();
int last = eStructuralFeatures.size() - 1;
String name = extendedMetaData.getName(eStructuralFeature);
for (int index = 0; index < last; index++)
{
EStructuralFeature otherEStructuralFeature = (EStructuralFeature)eStructuralFeatures.get(index);
if (name.equals(extendedMetaData.getName(otherEStructuralFeature)))
{
if (otherEStructuralFeature.eClass() != eStructuralFeature.eClass())
{
//System.out.println("###EStructuralFeature mismatch: ");
//System.out.println(" old: " + extendedMetaData.getName(otherEStructuralFeature));
//System.out.println(" new: " + extendedMetaData.getName(eStructuralFeature));
continue;
}
eStructuralFeatures.remove(index);
updateReferences(otherEStructuralFeature, eStructuralFeature);
break;
}
}
}
public EClass computeEClass(XSDComplexTypeDefinition xsdComplexTypeDefinition) {
if (xsdComplexTypeDefinition == null) return super.computeEClass(xsdComplexTypeDefinition);
EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdComplexTypeDefinition.getTargetNamespace());
if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
EClassifier eclassifier = ePackage.getEClassifier(xsdComplexTypeDefinition.getName());
if (eclassifier != null) return (EClass)eclassifier;
}
EClass eClass = super.computeEClass(xsdComplexTypeDefinition);
if (replaceConflictingTypes) removeDuplicateEClassifier(eClass, xsdComplexTypeDefinition);
String aliasNames = getEcoreAttribute(xsdComplexTypeDefinition.getElement(), "aliasName");
if (aliasNames != null) {
SDOExtendedMetaData.INSTANCE.setAliasNames(eClass, aliasNames);
}
return eClass;
}
protected EClassifier computeEClassifier(XSDTypeDefinition xsdTypeDefinition) {
if (xsdTypeDefinition == null) return super.computeEClassifier(xsdTypeDefinition);
EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdTypeDefinition.getTargetNamespace());
if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
EClassifier eclassifier = ePackage.getEClassifier(xsdTypeDefinition.getName());
if (eclassifier != null) return eclassifier;
}
EClassifier eclassifier = super.computeEClassifier(xsdTypeDefinition);
EClassifier etype = (EClassifier) typeToTypeObjectMap.get(eclassifier);
String aliasNames = getEcoreAttribute(xsdTypeDefinition.getElement(), "aliasName");
if (aliasNames != null) {
SDOExtendedMetaData.INSTANCE.setAliasNames(eclassifier, aliasNames);
if (etype != null) {
SDOExtendedMetaData.INSTANCE.setAliasNames(etype, aliasNames);
}
}
return eclassifier;
}
protected EDataType computeEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
if (xsdSimpleTypeDefinition == null) return super.computeEDataType(xsdSimpleTypeDefinition);
EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdSimpleTypeDefinition.getTargetNamespace());
if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
EClassifier eclassifier = ePackage.getEClassifier(xsdSimpleTypeDefinition.getName());
if (eclassifier != null) return (EDataType)eclassifier;
}
EDataType eDataType = super.computeEDataType(xsdSimpleTypeDefinition);
if (replaceConflictingTypes) removeDuplicateEClassifier(eDataType, xsdSimpleTypeDefinition);
String aliasNames = getEcoreAttribute(xsdSimpleTypeDefinition.getElement(), "aliasName");
if (aliasNames != null) {
SDOExtendedMetaData.INSTANCE.setAliasNames(eDataType, aliasNames);
}
return eDataType;
}
protected EEnum computeEEnum(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
return null;
}
protected EStructuralFeature createFeature(EClass eClass, String name, EClassifier type, XSDComponent xsdComponent, int minOccurs, int maxOccurs) {
EStructuralFeature feature = super.createFeature(eClass, name, type, xsdComponent, minOccurs, maxOccurs);
if (xsdComponent instanceof XSDParticle) {
XSDTerm xsdTerm = ((XSDParticle)xsdComponent).getTerm();
if (xsdTerm instanceof XSDElementDeclaration && ((XSDElementDeclaration)xsdTerm).isNillable())
EcoreUtil.setAnnotation(feature, ExtendedMetaData.ANNOTATION_URI, "nillable", "true");
}
//FB What is the following for?
if (feature instanceof EReference)
{
EReference eReference = (EReference)feature;
if (xsdComponent != null && xsdComponent instanceof XSDParticle)
{
XSDTerm xsdTerm = ((XSDParticle)xsdComponent).getTerm();
if (xsdTerm instanceof XSDElementDeclaration)
{
XSDTypeDefinition elementTypeDefinition = getEffectiveTypeDefinition(xsdComponent, (XSDElementDeclaration)xsdTerm);
EClassifier eClassifier = getEClassifier(elementTypeDefinition);
if (elementTypeDefinition instanceof XSDSimpleTypeDefinition && eClassifier instanceof EClass)
{
eReference.setContainment(true);
}
}
}
}
feature.setName(name); // this is needed because super.createFeature() does EMF name mangling (toLower)
if (replaceConflictingTypes && "".equals(extendedMetaData.getName(eClass)))
removeDuplicateDocumentRootFeature(eClass, feature);
if (xsdComponent != null)
{
String aliasNames = getEcoreAttribute(xsdComponent.getElement(), "aliasName");
if (aliasNames != null)
{
SDOExtendedMetaData.INSTANCE.setAliasNames(feature, aliasNames);
}
}
return feature;
}
protected String getInstanceClassName(XSDTypeDefinition typeDefinition, EDataType baseEDataType) {
String name = getEcoreAttribute(typeDefinition, "extendedInstanceClass");
return (name != null) ? name : super.getInstanceClassName(typeDefinition, baseEDataType);
}
protected String getEcoreAttribute(Element element, String attribute)
{
String sdoAttribute = null;
if ("name".equals(attribute))
sdoAttribute = "name";
else if ("opposite".equals(attribute))
sdoAttribute = "oppositeProperty";
else if ("mixed".equals(attribute))
sdoAttribute = "sequence";
else if ("string".equals(attribute))
sdoAttribute = "string";
else if ("changeable".equals(attribute))
sdoAttribute = "readOnly";
else if ("aliasName".equals(attribute))
sdoAttribute = "aliasName";
if (sdoAttribute != null)
{
String value =
element != null && element.hasAttributeNS("commonj.sdo/xml", sdoAttribute) ?
element.getAttributeNS("commonj.sdo/xml", sdoAttribute) :
null;
if ("changeable".equals(attribute)) {
if ("true".equals(value)) value = "false";
else if ("false".equals(value)) value = "true";
}
return value;
}
if ("package".equals(attribute))
sdoAttribute = "package";
else if ("instanceClass".equals(attribute))
sdoAttribute = "instanceClass";
else if ("extendedInstanceClass".equals(attribute))
sdoAttribute = "extendedInstanceClass";
else if ("nestedInterfaces".equals(attribute))
sdoAttribute = "nestedInterfaces";
if (sdoAttribute != null)
{
return
element != null && element.hasAttributeNS("commonj.sdo/java", sdoAttribute) ?
element.getAttributeNS("commonj.sdo/java", sdoAttribute) :
null;
}
return super.getEcoreAttribute(element, attribute);
}
/*
protected String getEcoreAttribute(XSDConcreteComponent xsdConcreteComponent, String attribute)
{
String value = super.getEcoreAttribute(xsdConcreteComponent, attribute);
if ("package".equals(attribute) && value == null)
{
XSDSchema xsdSchema = (XSDSchema)xsdConcreteComponent;
value = getDefaultPackageName(xsdSchema.getTargetNamespace());
}
return value;
}
*/
protected XSDTypeDefinition getEcoreTypeQNameAttribute(XSDConcreteComponent xsdConcreteComponent, String attribute)
{
if (xsdConcreteComponent == null) return null;
String sdoAttribute = null;
if ("reference".equals(attribute)) sdoAttribute = "propertyType";
if ("dataType".equals(attribute)) sdoAttribute = "dataType";
if (sdoAttribute != null)
{
Element element = xsdConcreteComponent.getElement();
return element == null ? null : getEcoreTypeQNameAttribute(xsdConcreteComponent, element, "commonj.sdo/xml", sdoAttribute);
}
return super.getEcoreTypeQNameAttribute(xsdConcreteComponent, attribute);
}
/**
* Override default EMF behavior so that the name is not mangled.
*/
protected String validName(String name, int casing, String prefix) {
return name;
}
/**
* Override default EMF name mangling for anonymous types (simple and complex)
*/
protected String validAliasName(XSDTypeDefinition xsdTypeDefinition, boolean isUpperCase) {
return getAliasName(xsdTypeDefinition);
}
protected String getAliasName(XSDNamedComponent xsdNamedComponent) {
String result = xsdNamedComponent.getName();
if (result == null)
{
XSDConcreteComponent container = xsdNamedComponent.getContainer();
if (container instanceof XSDNamedComponent)
{
result = getAliasName((XSDNamedComponent)container);
if (container instanceof XSDTypeDefinition)
{
result = "_" + result;
}
}
}
return result;
}
protected XSDTypeDefinition getEffectiveTypeDefinition(XSDComponent xsdComponent, XSDFeature xsdFeature)
{
if (xsdFeature == null)
{
return super.getEffectiveTypeDefinition(xsdComponent, xsdFeature);
}
XSDTypeDefinition typeDef = getEcoreTypeQNameAttribute(xsdComponent, "dataType");
String isString = getEcoreAttribute(xsdComponent, xsdFeature, "string");
if ("true".equalsIgnoreCase(isString)) {
typeDef =
xsdFeature.resolveSimpleTypeDefinition(rootSchema.getSchemaForSchemaNamespace(), "string");
}
if (typeDef == null)
typeDef = xsdFeature.getType();
return typeDef;
}
/**
* Override EMF algorithm.
*/
public String qualifiedPackageName(String namespace)
{
return getDefaultPackageName(namespace);
}
//Code below here to provide common URI to java packagname
public static String uncapNameStatic(String name)
{
if (name.length() == 0)
{
return name;
}
else
{
String lowerName = name.toLowerCase();
int i;
for (i = 0; i < name.length(); i++)
{
if (name.charAt(i) == lowerName.charAt(i))
{
break;
}
}
if (i > 1 && i < name.length() && !Character.isDigit(name.charAt(i)))
{
--i;
}
return name.substring(0, i).toLowerCase() + name.substring(i);
}
}
protected static String validNameStatic(String name, int casing, String prefix)
{
List parsedName = parseNameStatic(name, '_');
StringBuffer result = new StringBuffer();
for (Iterator i = parsedName.iterator(); i.hasNext(); )
{
String nameComponent = (String)i.next();
if (nameComponent.length() > 0)
{
if (result.length() > 0 || casing == UPPER_CASE)
{
result.append(Character.toUpperCase(nameComponent.charAt(0)));
result.append(nameComponent.substring(1));
}
else
{
result.append(nameComponent);
}
}
}
return
result.length() == 0 ?
prefix :
Character.isJavaIdentifierStart(result.charAt(0)) ?
casing == LOWER_CASE ?
uncapNameStatic(result.toString()) :
result.toString() :
prefix + result;
}
protected static List parseNameStatic(String sourceName, char separator)
{
List result = new ArrayList();
if (sourceName != null)
{
StringBuffer currentWord = new StringBuffer();
boolean lastIsLower = false;
for (int index = 0, length = sourceName.length(); index < length; ++index)
{
char curChar = sourceName.charAt(index);
if (!Character.isJavaIdentifierPart(curChar))
{
curChar = separator;
}
if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == separator)
{
if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0)
{
result.add(currentWord.toString());
currentWord = new StringBuffer();
}
lastIsLower = false;
}
else
{
if (!lastIsLower)
{
int currentWordLength = currentWord.length();
if (currentWordLength > 1)
{
char lastChar = currentWord.charAt(--currentWordLength);
currentWord.setLength(currentWordLength);
result.add(currentWord.toString());
currentWord = new StringBuffer();
currentWord.append(lastChar);
}
}
lastIsLower = true;
}
if (curChar != separator)
{
currentWord.append(curChar);
}
}
result.add(currentWord.toString());
}
return result;
}
public static String getDefaultPackageName(String targetNamespace)
{
if (targetNamespace == null)
return null;
URI uri = URI.createURI(targetNamespace);
List parsedName;
if (uri.isHierarchical())
{
String host = uri.host();
if (host != null && host.startsWith("www."))
{
host = host.substring(4);
}
parsedName = parseNameStatic(host, '.');
Collections.reverse(parsedName);
if (!parsedName.isEmpty())
{
parsedName.set(0, ((String)parsedName.get(0)).toLowerCase());
}
parsedName.addAll(parseNameStatic(uri.trimFileExtension().path(), '/'));
}
else
{
String opaquePart = uri.opaquePart();
int index = opaquePart.indexOf(":");
if (index != -1 && "urn".equalsIgnoreCase(uri.scheme()))
{
parsedName = parseNameStatic(opaquePart.substring(0, index), '-');
if (parsedName.size() > 0 && DOMAINS.contains(parsedName.get(parsedName.size() - 1)))
{
Collections.reverse(parsedName);
parsedName.set(0, ((String)parsedName.get(0)).toLowerCase());
}
parsedName.addAll(parseNameStatic(opaquePart.substring(index + 1), '/'));
}
else
{
parsedName = parseNameStatic(opaquePart, '/');
}
}
StringBuffer qualifiedPackageName = new StringBuffer();
for (Iterator i = parsedName.iterator(); i.hasNext(); )
{
String packageName = (String)i.next();
if (packageName.length() > 0)
{
if (qualifiedPackageName.length() > 0)
{
qualifiedPackageName.append('.');
}
qualifiedPackageName.append(validNameStatic(packageName, LOWER_CASE,"_"));
}
}
return qualifiedPackageName.toString().toLowerCase(); //make sure it's lower case .. we can't work with Axis if not.
}
private XSDSchema loadEPackage(EPackage ePackage)
{
XSDSchema ePackageXSDSchema = null;
XSDEcoreSchemaBuilder schemaBuilder = new XSDEcoreSchemaBuilder(extendedMetaData);
ePackageXSDSchema = schemaBuilder.getSchema(ePackage);
xsdComponentToEModelElementMap.putAll(schemaBuilder.getXSDComponentToEModelElementMap());
targetNamespaceToEPackageMap.put(ePackage.getNsURI(), ePackage);
populateTypeToTypeObjectMap(ePackage);
xsdSchemas.add(ePackageXSDSchema);
return ePackageXSDSchema;
}
private static class XSDEcoreSchemaBuilder extends EcoreSchemaBuilder
{
public XSDEcoreSchemaBuilder(ExtendedMetaData extendedMetaData)
{
super(extendedMetaData);
}
public Map getXSDComponentToEModelElementMap()
{
return xsdComponentToEModelElementMap;
}
}
class XSDSchemaAdapterFactoryImpl extends AdapterFactoryImpl
{
protected SchemaLocator schemaLocator = new SchemaLocator();
public boolean isFactoryForType(Object type)
{
return type == XSDSchemaLocator.class;
}
public Adapter adaptNew(Notifier target, Object type)
{
return schemaLocator;
}
class SchemaLocator extends XSDResourceImpl.SchemaLocator
{
public XSDSchema locateSchema(XSDSchema xsdSchema, String namespaceURI,
String rawSchemaLocationURI, String resolvedSchemaLocation)
{
if (targetNamespaceToEPackageMap.containsKey(namespaceURI))
{
for (Iterator iter = xsdSchemas.iterator(); iter.hasNext();) {
XSDSchema schema = (XSDSchema)iter.next();
String targetNamespace = schema.getTargetNamespace();
if (targetNamespace != null && targetNamespace.equals(namespaceURI))
{
return schema;
}
}
}
if (namespaceURI != null && !namespaceURI.equals(xsdSchema.getTargetNamespace()))
{
EPackage ePackage = extendedMetaData.getPackage(namespaceURI);
if (ePackage != null)
{
XSDSchema schema = loadEPackage(ePackage);
return schema;
}
}
return super.locateSchema(xsdSchema, namespaceURI, rawSchemaLocationURI, resolvedSchemaLocation);
}
}
}
}

View file

@ -0,0 +1,786 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import javax.xml.namespace.QName;
import org.apache.tuscany.sdo.util.SDOUtil;
import org.eclipse.xsd.XSDAttributeDeclaration;
import org.eclipse.xsd.XSDAttributeUse;
import org.eclipse.xsd.XSDComplexTypeDefinition;
import org.eclipse.xsd.XSDCompositor;
import org.eclipse.xsd.XSDConstraint;
import org.eclipse.xsd.XSDDerivationMethod;
import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDFactory;
import org.eclipse.xsd.XSDForm;
import org.eclipse.xsd.XSDImport;
import org.eclipse.xsd.XSDInclude;
import org.eclipse.xsd.XSDModelGroup;
import org.eclipse.xsd.XSDParticle;
import org.eclipse.xsd.XSDProcessContents;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDSchemaContent;
import org.eclipse.xsd.XSDSimpleTypeDefinition;
import org.eclipse.xsd.XSDTypeDefinition;
import org.eclipse.xsd.XSDWildcard;
import commonj.sdo.Property;
import commonj.sdo.Type;
import commonj.sdo.helper.XSDHelper;
public class SchemaBuilder extends SDOAnnotations
{
public static final String DEFAULT_SCHEMA_LOCATION = "";
public static final String NAME_SPACE_PREFIX = "stn_";
private static int prefixCount = 1;
//public static final String MIXED = "mixed";
//public static final String GROUP = "group";
public static final String EFEATURE_MAP_ENTRY = "EFeatureMapEntry";
private Map schemaMap = null;
protected Map targetNamespacePrefixMap = new Hashtable();
protected Map schemaLocationMap = null;
protected TypeTable typeTable = null;
protected XSDFactory xsdFactory = XSDFactory.eINSTANCE;
protected SchemaBuilder(Map schemaMap,
Map nsPrefixMap,
TypeTable typeTable,
Map schemaLocMap )
{
this.schemaMap = schemaMap;
this.targetNamespacePrefixMap = nsPrefixMap;
this.typeTable = typeTable;
this.schemaLocationMap = schemaLocMap;
}
private QName addAttribute2ComplexType(String targetNamespace,
XSDComplexTypeDefinition complexType,
Property aProperty)
{
QName attributeSchemaType = null;
String prefix = null;
try
{
attributeSchemaType = buildSchema(aProperty.getType());
}
catch ( IllegalArgumentException e )
{
//schema cannot be generated for this type as there exists an xsd already
//so include that original XSD
attributeSchemaType = new QName(aProperty.getType().getURI(),
aProperty.getType().getName(),
generatePrefix());
if ( aProperty.getType().isDataType() )
{
typeTable.addSimpleSchemaType(aProperty.getType().getName(), attributeSchemaType);
XSDSimpleTypeDefinition simpleType = xsdFactory.createXSDSimpleTypeDefinition();
simpleType.setName(aProperty.getType().getName());
simpleType.setTargetNamespace(aProperty.getType().getURI());
typeTable.addXSDTypeDef(attributeSchemaType.getNamespaceURI(),
attributeSchemaType.getLocalPart(),
simpleType);
}
else
{
typeTable.addComplexSchemaType(aProperty.getType().getURI(),
aProperty.getType().getName(),
attributeSchemaType);
XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
extComplexType.setName(aProperty.getType().getName());
extComplexType.setTargetNamespace(aProperty.getType().getURI());
typeTable.addXSDTypeDef(attributeSchemaType.getNamespaceURI(),
attributeSchemaType.getLocalPart(),
extComplexType);
}
includeExtXSD(aProperty.getType());
}
//ensure than an import is done rightaway so that the right prefixes will be used by the
//attribute whose type is set as 'this type'. Otherwise when setting the type for the attribute
//there will be a duplicate prefix (like Q1 or Q2... ) that will be created
prefix = addImports((XSDSchema)schemaMap.get(targetNamespace), attributeSchemaType);
XSDAttributeDeclaration attribute = xsdFactory.createXSDAttributeDeclaration();
attribute.setName(aProperty.getName());
XSDAttributeUse orderDateAttributeUse = xsdFactory.createXSDAttributeUse();
orderDateAttributeUse.setContent(attribute);
complexType.getAttributeContents().add(orderDateAttributeUse);
attribute.updateElement();
if ( aProperty.getType().isDataType() )
{
attribute.setTypeDefinition((XSDSimpleTypeDefinition)typeTable.getXSDTypeDef(attributeSchemaType.getNamespaceURI(),
attributeSchemaType.getLocalPart()));
}
else
{
attribute.setTypeDefinition((XSDSimpleTypeDefinition)typeTable.getXSDTypeDef(
typeTable.getSimpleSchemaTypeName("URI").getNamespaceURI(),
typeTable.getSimpleSchemaTypeName("URI").getLocalPart()));
}
if ( aProperty.getDefault() != null )
{
attribute.setConstraint(XSDConstraint.DEFAULT_LITERAL);
attribute.setLexicalValue(aProperty.getDefault().toString());
}
addAnnotations(attribute, aProperty );
if ( !aProperty.getType().isDataType() )
{
String value = prefix + COLON + attributeSchemaType.getLocalPart();
attribute.getElement().setAttribute(PROPERTY_TYPE, value);
}
return attributeSchemaType;
}
private QName addElement2ComplexType(String targetNamespace,
XSDComplexTypeDefinition complexType,
Property aProperty)
{
String prefix = null;
QName elementSchemaType = null;
try
{
elementSchemaType = buildSchema(aProperty.getType());
}
catch ( IllegalArgumentException e )
{
//schema cannot be generated for this type as there exists an xsd already
//so include that original XSD
elementSchemaType = new QName(aProperty.getType().getURI(),
aProperty.getType().getName(),
generatePrefix());
if ( aProperty.getType().isDataType() )
{
typeTable.addSimpleSchemaType(aProperty.getType().getName(), elementSchemaType);
XSDSimpleTypeDefinition simpleType = xsdFactory.createXSDSimpleTypeDefinition();
simpleType.setName(aProperty.getType().getName());
simpleType.setTargetNamespace(aProperty.getType().getURI());
typeTable.addXSDTypeDef(elementSchemaType.getNamespaceURI(),
elementSchemaType.getLocalPart(),
simpleType);
}
else
{
typeTable.addComplexSchemaType(aProperty.getType().getURI(),
aProperty.getType().getName(),
elementSchemaType);
XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
extComplexType.setName(aProperty.getType().getName());
extComplexType.setTargetNamespace(aProperty.getType().getURI());
typeTable.addXSDTypeDef(elementSchemaType.getNamespaceURI(),
elementSchemaType.getLocalPart(),
extComplexType);
}
includeExtXSD(aProperty.getType());
}
//ensure than an import is done rightaway so that the right prefixes will be used by the
//element whose type is set as 'this type'. Otherwise when setting the type for the element
//there will be a duplicate prefix (like Q1 or Q2... ) that will be created
prefix = addImports((XSDSchema)schemaMap.get(targetNamespace), elementSchemaType);
//XmlSchemaElement element = new XmlSchemaElement();
XSDElementDeclaration element = xsdFactory.createXSDElementDeclaration();
element.setName(aProperty.getName());
XSDParticle aParticle = xsdFactory.createXSDParticle();
aParticle.setContent(element);
((XSDModelGroup)((XSDParticle)complexType.getContent()).getContent()).
getContents().add(aParticle);
element.updateElement();
if ( aProperty.isMany() )
{
aParticle.setMaxOccurs(-1);
aParticle.setMinOccurs(0);
}
if ( aProperty.isContainment() )
{
element.setTypeDefinition(typeTable.getXSDTypeDef(elementSchemaType.getNamespaceURI(),
elementSchemaType.getLocalPart()));
}
else
{
if ( !aProperty.getType().isDataType() )
{
QName qName = typeTable.getSimpleSchemaTypeName("URI");
element.setTypeDefinition(typeTable.getXSDTypeDef(qName.getNamespaceURI(),
qName.getLocalPart()));
}
}
addAnnotations(element, aProperty);
if ( !aProperty.isContainment() && !aProperty.getType().isDataType() )
{
String value = prefix + COLON + elementSchemaType.getLocalPart();
element.getElement().setAttribute(PROPERTY_TYPE, value);
}
return elementSchemaType;
}
private void addAnnotations(XSDSchemaContent xsdContent, Property aProperty)
{
if ( !aProperty.getAliasNames().isEmpty() )
{
addAliasNamesAnnotation(xsdContent, aProperty.getAliasNames());
}
if ( aProperty.isReadOnly() )
{
xsdContent.getElement().setAttribute(READ_ONLY, Boolean.toString(aProperty.isReadOnly()));
}
if ( aProperty.getOpposite() != null )
{
xsdContent.getElement().setAttribute(OPPOSITE_PROPERTY, aProperty.getOpposite().getName());
}
}
private QName buildComplexSchemaTypeContents(String targetNamespace,
XSDComplexTypeDefinition complexType,
Type dataType)
{
//clipProperties(dataType);
List properties = dataType.getDeclaredProperties();
Iterator iterator = properties.iterator();
Property aProperty;
QName propertySchemaTypeName = null;
while ( iterator.hasNext() )
{
aProperty = (Property)iterator.next();
if ( aProperty.isContainment() || aProperty.isMany() || !aProperty.getType().isDataType() )
{
propertySchemaTypeName = addElement2ComplexType(targetNamespace, complexType, aProperty);
}
else
{
propertySchemaTypeName = addAttribute2ComplexType(targetNamespace, complexType, aProperty);
}
/*if ( !EFEATURE_MAP_ENTRY.equals(aProperty.getType().getName()) )
{
addContents2ComplexType(targetNamespace, complexType, aProperty);
}*/
}
return propertySchemaTypeName;
}
public QName buildComplexSchemaType(Type dataType)
{
//this is called from buildSchema only if isXSD(dataType) is false
QName complexSchemaTypeName = null ;
if ( !dataType.isDataType() &&
(complexSchemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), dataType.getName())) == null )
{
XSDSchema xmlSchema = getXmlSchema(dataType);
String targetNamespace = dataType.getURI();
String targetNamespacePrefix = (String)targetNamespacePrefixMap.get(targetNamespace);
complexSchemaTypeName = new QName(targetNamespace,
dataType.getName(),
targetNamespacePrefix);
XSDComplexTypeDefinition complexType = xsdFactory.createXSDComplexTypeDefinition();
complexType.setName(dataType.getName());
complexType.setTargetNamespace(targetNamespace);
complexType.setAbstract(dataType.isAbstract());
xmlSchema.getTypeDefinitions().add(complexType);
xmlSchema.getContents().add(complexType);
complexType.updateElement();
addAnnotations(complexType, dataType);
handleBaseExtn(xmlSchema, dataType, complexType);
handleSDOSequence(dataType, complexType);
handleSDOOpenType(dataType, complexType);
//add before constructing the contents because a content element could
//possibly be of type 'complexType'.
typeTable.addComplexSchemaType(dataType.getURI(), dataType.getName(), complexSchemaTypeName);
typeTable.addXSDTypeDef(dataType.getURI(), dataType.getName(), complexType);
//now compose the contents for this complex type
buildComplexSchemaTypeContents(targetNamespace, complexType, dataType);
//finally create a global element for this type
createGlobalElement(xmlSchema, complexType, complexSchemaTypeName);
}
return complexSchemaTypeName;
}
private void addAnnotations(XSDTypeDefinition xsdType, Type dataType)
{
if ( dataType.isAbstract() )
{
if ( xsdType instanceof XSDComplexTypeDefinition )
{
((XSDComplexTypeDefinition)xsdType).setAbstract(dataType.isAbstract());
}
else
{
xsdType.getElement().setAttribute(ABSTRACT_TYPE,
Boolean.toString(dataType.isAbstract()));
}
}
//add alias names if it exists
addAliasNamesAnnotation(xsdType,
dataType.getAliasNames());
//add instanceClass annotation
if ( dataType.getInstanceClass() != null )
{
xsdType.getElement().setAttribute(INSTANCE_CLASS, dataType.getInstanceClass().getName());
}
}
private QName buildSimpleSchemaType(Type dataType)
{
QName simpleSchemaTypeName = null;
if ( dataType.isDataType() &&
(simpleSchemaTypeName = typeTable.getSimpleSchemaTypeName(dataType.getName()) ) == null )
{
XSDSchema xmlSchema = getXmlSchema(dataType);
XSDSimpleTypeDefinition simpleType = xsdFactory.createXSDSimpleTypeDefinition();
//set the name
simpleType.setName(dataType.getName());
simpleType.setTargetNamespace(dataType.getURI());
//set abstract=true if abstract
simpleSchemaTypeName = new QName(dataType.getURI(),
dataType.getName(),
(String)targetNamespacePrefixMap.get(dataType.getURI()));
xmlSchema.getContents().add(simpleType);
simpleType.updateElement();
addAnnotations(simpleType, dataType);
if ( !dataType.getBaseTypes().isEmpty() )
{
Type baseType = (Type)dataType.getBaseTypes().get(0);
QName baseSchemaType = null;
try
{
baseSchemaType = buildSchema(baseType);
}
catch ( IllegalArgumentException e )
{
//this means that the base type comes from a original xsd and hence not generated
baseSchemaType = new QName(baseType.getURI(),
baseType.getName(),
generatePrefix());
typeTable.addSimpleSchemaType(baseType.getName(), baseSchemaType);
XSDSimpleTypeDefinition baseTypeDef = xsdFactory.createXSDSimpleTypeDefinition();
baseTypeDef.setName(baseType.getName());
baseTypeDef.setTargetNamespace(baseType.getURI());
typeTable.addXSDTypeDef(baseType.getURI(), baseType.getName(), baseTypeDef);
//include external XSD locations
includeExtXSD(baseType);
}
simpleType.setBaseTypeDefinition((XSDSimpleTypeDefinition)typeTable.
getXSDTypeDef(baseSchemaType.getNamespaceURI(),baseSchemaType.getLocalPart()));
addImports(xmlSchema, baseSchemaType);
}
typeTable.addSimpleSchemaType(dataType.getName(), simpleSchemaTypeName);
typeTable.addXSDTypeDef(dataType.getURI(), dataType.getName(), simpleType);
}
return simpleSchemaTypeName;
}
private void includeExtXSD(Type dataType)
{
//now we know there is a type for which the xsd must come from outside
//create a schema for the namespace of this type and add an include in it for
//the xsd that is defined externally
XSDSchema xmlSchema = getXmlSchema(dataType);
//ideally there could be more than one external schema defintions for a namespace
//and hence schemalocations will be a list of locations
//List schemaLocations = (List)schemaLocationMap.get(dataType.getURI());
//since as per the specs the input to XSDHelper is a map of <String, String> allowing
//only one schemalocation for a namespace. So for now this single location will be
//picked up and put into a list
List schemaLocations = new Vector();
if ( schemaLocationMap.get(dataType.getURI()) != null )
{
schemaLocations.add(schemaLocationMap.get(dataType.getURI()));
}
if ( schemaLocations.size() <= 0 )
{
schemaLocations.add(DEFAULT_SCHEMA_LOCATION);
}
Object schemaContent = null;
Iterator includesIterator = xmlSchema.getContents().iterator();
Iterator schemaLocIterator = schemaLocations.iterator();
String aSchemaLocation = null;
boolean includeExists = false;
//include all external schema locations
while ( schemaLocIterator.hasNext() )
{
aSchemaLocation = (String)schemaLocIterator.next();
while ( includesIterator.hasNext() )
{
schemaContent = includesIterator.next();
if ( schemaContent instanceof XSDInclude )
{
if ( !includeExists && aSchemaLocation.equals(
((XSDInclude)schemaContent).getSchemaLocation()
))
{
includeExists = true;
}
}
}
if ( !includeExists )
{
XSDInclude includeElement = xsdFactory.createXSDInclude();
includeElement.setSchemaLocation(aSchemaLocation);
xmlSchema.getContents().add(0, includeElement);
}
}
}
protected QName buildSchema(Type dataType) throws IllegalArgumentException
{
QName schemaTypeName = null;
if ( dataType.isDataType() )
{
schemaTypeName = typeTable.getSimpleSchemaTypeName(dataType.getName());
}
else
{
schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), dataType.getName());
}
//attempt to generate only if we have not done it already..i.e the type is
//not found in the typetable
if ( schemaTypeName == null )
{
XSDHelper xsdHelper = SDOUtil.createHelperContext().getXSDHelper();
if ( !xsdHelper.isXSD( dataType ) )
{
if ( dataType.isDataType() )
{
schemaTypeName = buildSimpleSchemaType(dataType);
}
else
{
schemaTypeName = buildComplexSchemaType(dataType);
}
}
else
{
throw new IllegalArgumentException("Cannot generate XSD since SDO Type '" +
dataType.getName() + "' was orginally generated from XSD. Use original XSD");
}
}
return schemaTypeName;
}
private XSDSchema getXmlSchema(Type dataType)
{
XSDSchema xmlSchema = null;
if ((xmlSchema = (XSDSchema) schemaMap.get(dataType.getURI())) == null)
{
String targetNamespacePrefix = generatePrefix();
xmlSchema = xsdFactory.createXSDSchema();
xmlSchema.setTargetNamespace(dataType.getURI());
xmlSchema.setAttributeFormDefault(XSDForm.QUALIFIED_LITERAL);
xmlSchema.setElementFormDefault(XSDForm.QUALIFIED_LITERAL);
targetNamespacePrefixMap.put(dataType.getURI(), targetNamespacePrefix);
schemaMap.put(dataType.getURI(), xmlSchema);
xmlSchema.getQNamePrefixToNamespaceMap().put(TypeTable.XS_URI_PREFIX, TypeTable.XML_SCHEMA_URI);
xmlSchema.setSchemaForSchemaQNamePrefix(TypeTable.XS_URI_PREFIX);
xmlSchema.getQNamePrefixToNamespaceMap().put(targetNamespacePrefix, dataType.getURI());
//xmlSchema.setSchemaForSchemaQNamePrefix(targetNamespacePrefix);
addSDONamespaces(xmlSchema);
addPackageAnnotation(xmlSchema, dataType);
}
return xmlSchema;
}
private void addSDONamespaces(XSDSchema xmlSchema)
{
xmlSchema.getQNamePrefixToNamespaceMap().put(COMMONJ_SDO_NS_PREFIX, COMMONJ_SDO_NS);
//xmlSchema.setSchemaForSchemaQNamePrefix(COMMONJ_SDO_NS_PREFIX);
xmlSchema.getQNamePrefixToNamespaceMap().put(SDO_JAVA_NS_PREFIX, SDO_JAVA_NS);
//xmlSchema.setSchemaForSchemaQNamePrefix(SDO_JAVA_NS_PREFIX);
}
/**
* JAM convert first name of an attribute into UpperCase as an example if
* there is a instance variable called foo in a bean , then Jam give that as
* Foo so this method is to correct that error
*
* @param wrongName
* @return the right name, using english as the locale for case conversion
*/
public static String getCorrectName(String wrongName)
{
if (wrongName.length() > 1) {
return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH)
+ wrongName.substring(1, wrongName.length());
} else {
return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH);
}
}
private String addImports(XSDSchema xmlSchema, QName schemaTypeName)
{
String prefix = null;
Iterator iterator = xmlSchema.getQNamePrefixToNamespaceMap().keySet().iterator();
while ( iterator.hasNext() )
{
prefix = (String)iterator.next();
if ( schemaTypeName.getNamespaceURI().equals(
xmlSchema.getQNamePrefixToNamespaceMap().get(prefix)) )
{
return prefix;
}
}
//the following lines are executed only if a prefix was not found which implies that the
//schemaTypeName was not imported earlier and also it does not belong to the targetnamespace
XSDImport importElement = xsdFactory.createXSDImport();
importElement.setNamespace(schemaTypeName.getNamespaceURI());
xmlSchema.getContents().add(0, importElement);
prefix = schemaTypeName.getPrefix();
if ( prefix == null || prefix.length() <= 0 )
{
prefix = generatePrefix();
}
xmlSchema.getQNamePrefixToNamespaceMap().put(prefix, schemaTypeName.getNamespaceURI());
return prefix;
}
private void handleSDOSequence(Type datatype, XSDComplexTypeDefinition complexType)
{
if ( datatype.isSequenced() )
{
complexType.setMixed(true);
XSDModelGroup choice = xsdFactory.createXSDModelGroup();
choice.setCompositor(XSDCompositor.CHOICE_LITERAL);
XSDParticle aParticle = xsdFactory.createXSDParticle();
aParticle.setContent(choice);
aParticle.setMaxOccurs(-1);
complexType.setContent(aParticle);
}
else
{
//hack to handle group property as choice
/*if ( getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() > 0 )
{
XmlSchemaChoice choice = new XmlSchemaChoice();
choice.setMaxOccurs(Long.MAX_VALUE);
complexType.setParticle(choice);
}
else*/
{
XSDModelGroup sequence = xsdFactory.createXSDModelGroup();
sequence.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
XSDParticle aParticle = xsdFactory.createXSDParticle();
aParticle.setContent(sequence);
complexType.setContent(aParticle);
}
}
}
private void handleSDOOpenType(Type datatype, XSDComplexTypeDefinition complexType)
{
if ( datatype.isOpen() /*&&
getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() <= 0 */)
{
XSDWildcard elementWildcard = xsdFactory.createXSDWildcard();
elementWildcard.getLexicalNamespaceConstraint().add("##other");
elementWildcard.setProcessContents(XSDProcessContents.LAX_LITERAL);
// Create a particle to hold the wildcard.
XSDParticle wildcardParticle = xsdFactory.createXSDParticle();
wildcardParticle.setContent(elementWildcard);
wildcardParticle.setMaxOccurs(-1);
((XSDModelGroup)((XSDParticle)complexType.getContent()).getContent()).
getContents().add(wildcardParticle);
XSDWildcard attributeWildcard = xsdFactory.createXSDWildcard();
attributeWildcard.getLexicalNamespaceConstraint().add("##other");
attributeWildcard.setProcessContents(XSDProcessContents.LAX_LITERAL);
complexType.setAttributeWildcard(attributeWildcard);
}
}
private void handleBaseExtn(XSDSchema xmlSchema,
Type datatype,
XSDComplexTypeDefinition complexType)
{
if ( datatype.getBaseTypes().size() > 0 )
{
Type baseType = (Type)datatype.getBaseTypes().get(0);
QName baseSchemaType = null;
try
{
baseSchemaType = buildSchema(baseType);
}
catch ( IllegalArgumentException e )
{
//schema cannot be generated for this type as there exists an xsd already
//so include that original XSD
baseSchemaType = new QName(baseType.getURI(),
baseType.getName(),
generatePrefix());
XSDSimpleTypeDefinition baseTypeDef = xsdFactory.createXSDSimpleTypeDefinition();
baseTypeDef.setName(baseType.getName());
baseTypeDef.setTargetNamespace(baseType.getURI());
typeTable.addXSDTypeDef(baseType.getURI(), baseType.getName(), baseTypeDef);
includeExtXSD(baseType);
}
complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
if ( baseType.isDataType() )
{
XSDSimpleTypeDefinition anonymousSimpleTypeDefinition
= xsdFactory.createXSDSimpleTypeDefinition();
anonymousSimpleTypeDefinition.setBaseTypeDefinition((XSDSimpleTypeDefinition)typeTable.
getXSDTypeDef(baseSchemaType.getNamespaceURI(),baseSchemaType.getLocalPart()));
complexType.setContent(anonymousSimpleTypeDefinition);
}
else
{
complexType.setBaseTypeDefinition((XSDSimpleTypeDefinition)typeTable.
getXSDTypeDef(baseSchemaType.getNamespaceURI(),baseSchemaType.getLocalPart()));
}
addImports(xmlSchema, baseSchemaType);
}
}
private String formGlobalElementName(String typeName)
{
String firstChar = typeName.substring(0,1);
return typeName.replaceFirst(firstChar, firstChar.toLowerCase());
}
private void createGlobalElement(XSDSchema xmlSchema,
XSDComplexTypeDefinition complexType,
QName schemaElementName )
{
XSDElementDeclaration globalElement = xsdFactory.createXSDElementDeclaration();
globalElement.setTargetNamespace(xmlSchema.getTargetNamespace());
globalElement.setName(formGlobalElementName(complexType.getName()));
globalElement.setTypeDefinition
(typeTable.getXSDTypeDef(schemaElementName.getNamespaceURI(),
schemaElementName.getLocalPart()));
xmlSchema.getContents().add(globalElement);
xmlSchema.getElementDeclarations().add(globalElement);
}
private void addAliasNamesAnnotation(XSDSchemaContent typeDef,
List aliasNames)
{
if ( !aliasNames.isEmpty() )
{
StringBuffer sb = new StringBuffer();
Iterator iterator = aliasNames.iterator();
while ( iterator.hasNext() )
{
sb.append(iterator.next());
}
typeDef.getElement().setAttribute(ALIAS_NAMES, sb.toString());
}
}
private void addPackageAnnotation(XSDSchema xmlSchema, Type dataType)
{
if ( dataType.getInstanceClass() != null )
{
xmlSchema.updateElement();
xmlSchema.getElement().setAttribute(JAVA_PACKAGE,
dataType.getInstanceClass().getPackage().getName());
}
}
private String generatePrefix()
{
return NAME_SPACE_PREFIX + prefixCount++;
}
}

View file

@ -0,0 +1,317 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.tuscany.sdo.api.SDOUtil;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.internal.InternalFactory;
import org.apache.tuscany.sdo.model.java.JavaFactory;
import org.apache.tuscany.sdo.model.xml.XMLFactory;
import org.apache.tuscany.sdo.model.xml.impl.XMLFactoryImpl;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
/**
* Look up a Type given the uri and typeName or interfaceClass. SDO Types are
* available through the getType("commonj.sdo", typeName) method. Defines Types
* from DataObjects.
*/
public class TypeHelperImpl implements TypeHelper {
protected HelperContext helperContext;
private ExtendedMetaData extendedMetaData;
static protected Set builtInModels = null;
static public Set getBuiltInModels() {
if (builtInModels == null) {
builtInModels = new HashSet();
builtInModels.add(ModelFactory.INSTANCE);
builtInModels.add(JavaFactory.INSTANCE);
builtInModels.add(XMLFactory.INSTANCE);
builtInModels.add(InternalFactory.INSTANCE);
}
return TypeHelperImpl.builtInModels;
}
public ExtendedMetaData getExtendedMetaData() {
return extendedMetaData;
}
// JIRA-helperContext
public TypeHelperImpl(HelperContext hc) {
this.helperContext = hc;
this.extendedMetaData = ((HelperContextImpl)hc).extendedMetaData;
// Register the standard (predefined) SDO types
getBuiltInModels(); // Simply accessing EMF packages causes auto
// registration in global registry
// MetadataFactoryImpl.init(); //FB do we want to preregister this?
}
public Type getType(String uri, String typeName) {
EPackage ePackage = extendedMetaData.getPackage(uri);
if (ePackage != null) {
EClassifier eClassifier = ePackage.getEClassifier(typeName);
if (eClassifier == null) {
eClassifier = extendedMetaData.getType(ePackage, typeName);
}
return (Type)eClassifier;
}
return null;
}
private Method getGetStaticTypeMethod(Class classObj) {
try {
Method method = classObj.getMethod("getStaticType", null);
return method;
}
catch (Exception e) {
return null;
}
}
public Type getType(Class interfaceClass) {
Type type = SDOUtil.getJavaSDOType(interfaceClass);
if (type != null) {
return type;
}
Class sdoTypeImplClass = interfaceClass;
Method getStaticTypeMethod = getGetStaticTypeMethod(interfaceClass);
if (getStaticTypeMethod == null) {
String sdoTypeImplClassName = interfaceClass.getName();
if (sdoTypeImplClassName.endsWith("Impl") == false) {
sdoTypeImplClass = DataObjectUtil.getImplementationClass(interfaceClass, false);
if (sdoTypeImplClass == null) {
return null;
}
getStaticTypeMethod = getGetStaticTypeMethod(sdoTypeImplClass);
if (getStaticTypeMethod == null) {
return null;
}
}
else {
return null;
}
}
try {
Object implInstance = sdoTypeImplClass.newInstance();
return (Type)getStaticTypeMethod.invoke(implInstance, null);
}
catch (Exception e) {
return null;
}
}
public Type define(DataObject type) {
if (!(type instanceof org.apache.tuscany.sdo.model.Type))
throw new IllegalArgumentException();
org.apache.tuscany.sdo.model.Type modeledType = (org.apache.tuscany.sdo.model.Type)type;
boolean isDataType = modeledType.isDataType();
Type definedType = SDOUtil.createType(helperContext, modeledType.getUri(), modeledType.getName(), isDataType);
if (definedType == null) {
// If type already defined, return existing Type.
return getType(modeledType.getUri(), modeledType.getName());
}
SDOUtil.setJavaClassName(definedType, modeledType.getInstanceClassName());
if (!isDataType) {
SDOUtil.setSequenced(definedType, modeledType.isSequenced());
SDOUtil.setOpen(definedType, modeledType.isOpen());
SDOUtil.setAbstract(definedType, modeledType.isAbstract());
for (Iterator iter = modeledType.getBaseType().iterator(); iter.hasNext();) {
Type baseType = getDefinedType((org.apache.tuscany.sdo.model.Type)iter.next());
SDOUtil.addBaseType(definedType, baseType);
}
for (Iterator iter = modeledType.getAliasName().iterator(); iter.hasNext();) {
String aliasName = (String)iter.next();
SDOUtil.addAliasName(definedType, aliasName);
}
for (Iterator iter = modeledType.getProperty().iterator(); iter.hasNext();) {
org.apache.tuscany.sdo.model.Property modeledProperty =
(org.apache.tuscany.sdo.model.Property)iter.next();
Type propertyType = getDefinedType(modeledProperty.getType_());
Property definedProperty = SDOUtil.createProperty(definedType, modeledProperty.getName(), propertyType);
initializeProperty(definedProperty, modeledProperty);
}
// define a global property to accompany the type definition
if (!SDOUtil.isDocumentRoot(definedType)) {
String propertyName = definedType.getName();
if (!Character.isLowerCase(propertyName.charAt(0))) {
propertyName = propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1);
}
Property globalProperty =
SDOUtil.createOpenContentProperty(helperContext, definedType.getURI(), propertyName, definedType);
SDOUtil.setContainment(globalProperty, true);
}
} // if (!isDataType)
addTypeInstanceProperties(definedType, (DataObject)modeledType);
return definedType;
}
protected void addTypeInstanceProperties(Type definedType, DataObject modeledType) {
List instanceProperties = SDOUtil.getOpenContentProperties(modeledType);
for (Iterator iter = instanceProperties.iterator(); iter.hasNext();) {
Property property = (Property)iter.next();
SDOUtil.addTypeInstanceProperty(definedType, property, modeledType.get(property));
}
}
protected void addPropertyInstanceProperties(Property definedProperty, DataObject modeledProperty) {
List instanceProperties = SDOUtil.getOpenContentProperties(modeledProperty);
for (Iterator iter = instanceProperties.iterator(); iter.hasNext();) {
Property property = (Property)iter.next();
SDOUtil.addPropertyInstanceProperty(definedProperty, property, modeledProperty.get(property));
}
}
public List /* Type */define(List /* DataObject */types) {
int count = types.size();
List definedTypes = new ArrayList(count);
for (int i = 0; i < count; i++) {
definedTypes.add(define((DataObject)types.get(i)));
}
return definedTypes;
}
protected Type getDefinedType(org.apache.tuscany.sdo.model.Type modeledType) {
if (modeledType instanceof Type) {
return (Type)modeledType;
} else {
EClassifier eClassifier = extendedMetaData.getType(modeledType.getUri(), modeledType.getName());
if (eClassifier != null) {
return (Type)eClassifier;
} else {
return define((DataObject)modeledType);
}
}
}
protected Property getDefinedProperty(org.apache.tuscany.sdo.model.Property modeledProperty) {
if (modeledProperty instanceof Property) {
return (Property)modeledProperty;
} else {
DataObject modeledContainingType = ((DataObject)modeledProperty).getContainer();
Type definedContainingType = getDefinedType((org.apache.tuscany.sdo.model.Type)modeledContainingType);
String propertyName = modeledProperty.getName();
return definedContainingType.getProperty(propertyName);
}
}
protected void initializeProperty(Property newProperty, org.apache.tuscany.sdo.model.Property modeledProperty) {
SDOUtil.setMany(newProperty, modeledProperty.isMany());
SDOUtil.setDefault(newProperty, modeledProperty.getDefault_());
SDOUtil.setReadOnly(newProperty, modeledProperty.isReadOnly());
for (Iterator iter = modeledProperty.getAliasName().iterator(); iter.hasNext();) {
String aliasName = (String)iter.next();
SDOUtil.addAliasName(newProperty, aliasName);
}
if (newProperty.getType().isDataType()) {
// Setting xmlElement to FALSE only makes sense here
Boolean isXmlElement = Boolean.TRUE; // By default, a SDO property is an XSD element
Sequence anyAttr = modeledProperty.getAnyAttribute();
for (int i=0; i<anyAttr.size(); i++) {
Property anyProp = anyAttr.getProperty(i);
if (XMLFactoryImpl.NAMESPACE_URI.equals(anyProp.getContainingType().getURI())) {
String propName = anyProp.getName();
if ("xmlElement".equals(propName)) {
isXmlElement = (Boolean)anyAttr.getValue(i);
}
}
}
if (!isXmlElement.booleanValue()) {
SDOUtil.setPropertyXMLKind(newProperty, false);
}
}
else
{
SDOUtil.setContainment(newProperty, modeledProperty.isContainment());
if (modeledProperty.getOpposite_() != null) {
SDOUtil.setOpposite(newProperty, getDefinedProperty(modeledProperty.getOpposite_()));
}
}
addPropertyInstanceProperties(newProperty, (DataObject)modeledProperty);
}
public static final String TUSCANY_NO_URI = "http://tuscany-no-uri";
public Property defineOpenContentProperty(String uri, DataObject property) {
// validate property and get type
if (!(property instanceof org.apache.tuscany.sdo.model.impl.PropertyImpl))
throw new IllegalArgumentException();
org.apache.tuscany.sdo.model.Property modeledProperty = (org.apache.tuscany.sdo.model.Property)property;
Type propertyType = getDefinedType(modeledProperty.getType_());
if (uri == null)
uri = TUSCANY_NO_URI;
Property newProperty = SDOUtil.createOpenContentProperty(helperContext, uri, modeledProperty.getName(), propertyType);
// Propagate the modeled property's attributes
initializeProperty(newProperty, modeledProperty);
return newProperty;
}
public Property getOpenContentProperty(String uri, String propertyName) {
EClass documentRoot = (EClass)extendedMetaData.getType(uri, "");
return documentRoot != null ? (Property)documentRoot.getEStructuralFeature(propertyName) : null;
}
public HelperContext getHelperContext() {
return helperContext;
}
}

View file

@ -0,0 +1,254 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.xml.namespace.QName;
//import org.apache.axiom.om.OMElement;
import org.eclipse.xsd.XSDFactory;
import org.eclipse.xsd.XSDTypeDefinition;
import org.w3c.dom.Element;
public class TypeTable
{
public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
public static final String XS_URI_PREFIX = "xs";
public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX);
public static final String DELIMITER = "#";
private Hashtable simpleXSDTypes;
private Hashtable complexXSDTypes;
private Hashtable xsdTypeDefs;
public static String asQualifiedName(String uri, String typeName)
{
return (uri + DELIMITER + typeName);
}
public TypeTable()
{
simpleXSDTypes = new Hashtable();
complexXSDTypes = new Hashtable();
xsdTypeDefs = new Hashtable();
populateSimpleXSDTypes();
populateStdSDOTypes();
}
private void populateStdSDOTypes()
{
simpleXSDTypes.put("Boolean",
new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
simpleXSDTypes.put("Byte",
new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
simpleXSDTypes.put("Bytes",
new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX));
simpleXSDTypes.put("Character",
new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
simpleXSDTypes.put("DataObject",
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put("Date",
new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
simpleXSDTypes.put("Day",
new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX));
simpleXSDTypes.put("Decimal",
new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX));
simpleXSDTypes.put("Double",
new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
simpleXSDTypes.put("Duration",
new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX));
simpleXSDTypes.put("Float",
new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
simpleXSDTypes.put("Int",
new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
simpleXSDTypes.put("Integer",
new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX));
simpleXSDTypes.put("Long",
new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
simpleXSDTypes.put("Month",
new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX));
simpleXSDTypes.put("monthDay",
new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX));
simpleXSDTypes.put("Object",
new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX));
simpleXSDTypes.put("Short",
new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
simpleXSDTypes.put("String",
new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
simpleXSDTypes.put("Strings",
new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
simpleXSDTypes.put("Time",
new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX));
simpleXSDTypes.put("Year",
new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX));
simpleXSDTypes.put("YearMonth",
new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX));
simpleXSDTypes.put("YearMonthDay",
new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX));
simpleXSDTypes.put("URI",
new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX));
}
private void populateSimpleXSDTypes() {
//todo pls use the types from org.apache.ws.commons.schema.constants.Constants
simpleXSDTypes.put("int",
new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.String",
new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
simpleXSDTypes.put("boolean",
new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
simpleXSDTypes.put("float",
new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
simpleXSDTypes.put("double",
new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
simpleXSDTypes.put("short",
new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
simpleXSDTypes.put("long",
new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
simpleXSDTypes.put("byte",
new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
simpleXSDTypes.put("char",
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Integer",
new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Double",
new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Float",
new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Long",
new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Character",
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Boolean",
new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Byte",
new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Short",
new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
simpleXSDTypes.put("java.util.Date",
new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
simpleXSDTypes.put("java.util.Calendar",
new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
simpleXSDTypes.put("java.lang.Object",
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put("java.math.BigDecimal",
new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX));
// Any types
simpleXSDTypes.put(Element.class.getName(),
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put(ArrayList.class.getName(),
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put(Vector.class.getName(),
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
simpleXSDTypes.put(List.class.getName(),
new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
}
public QName getStdSdoType(String typename)
{
return (QName) simpleXSDTypes.get(typename);
}
public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName)
{
return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName));
}
public boolean isSimpleType(String typeName)
{
Iterator keys = simpleXSDTypes.keySet().iterator();
while (keys.hasNext()) {
String s = (String) keys.next();
if (s.equals(typeName)) {
return true;
}
}
return false;
}
public QName getSimpleSchemaTypeName(String typename)
{
return (QName) simpleXSDTypes.get(typename);
}
public void addSimpleSchemaType(String typeName, QName schemaType)
{
simpleXSDTypes.put(typeName, schemaType);
}
public void addComplexSchemaType(String namespaceURI, String name, QName schemaType)
{
complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType);
}
public QName getQNamefortheType(String namespaceURI, String typeName)
{
if ( XML_SCHEMA_URI.equals(namespaceURI))
{
return getSimpleSchemaTypeName(typeName);
}
else
{
return getComplexSchemaTypeName(namespaceURI, typeName);
}
}
public void addXSDTypeDef(String namespaceURI, String typeName, XSDTypeDefinition aTypeDef)
{
if ( namespaceURI != null && typeName != null && aTypeDef != null )
{
xsdTypeDefs.put(asQualifiedName(namespaceURI, typeName), aTypeDef);
}
}
public XSDTypeDefinition getXSDTypeDef(String namespaceURI, String typeName)
{
XSDTypeDefinition typeDef = null;
if ( namespaceURI != null && typeName != null )
{
if ( XML_SCHEMA_URI.equals(namespaceURI) )
{
if ( ( typeDef = (XSDTypeDefinition)xsdTypeDefs.get(asQualifiedName(namespaceURI, typeName)) ) == null )
{
typeDef = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
typeDef.setName(typeName);
typeDef.setTargetNamespace(namespaceURI);
addXSDTypeDef(namespaceURI, typeName, typeDef);
}
}
else
{
typeDef = (XSDTypeDefinition)xsdTypeDefs.get(asQualifiedName(namespaceURI, typeName));
}
}
return typeDef;
}
}

View file

@ -0,0 +1,574 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.apache.tuscany.sdo.util.SDOUtil;
import org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.XMLDocument;
/**
* Represents an XML Document containing a tree of DataObjects.
*
* An example XMLDocument fragment is:
* <?xml version="1.0"?>
* <purchaseOrder orderDate="1999-10-20">
*
* created from this XML Schema fragment:
* <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
* <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
* <xsd:complexType name="PurchaseOrderType">
*
* Upon loading this XMLDocument:
* DataObject is an instance of Type PurchaseOrderType.
* RootElementURI is null because the XSD has no targetNamespace URI.
* RootElementName is purchaseOrder.
* Encoding is null because the document did not specify an encoding.
* XMLDeclaration is true because the document contained an XML declaration.
* XMLVersion is 1.0
* SchemaLocation and noNamespaceSchemaLocation are null because they are
* not specified in the document.
*
* When saving the root element, if the type of the root dataObject is not the
* type of global element specified by rootElementURI and rootElementName,
* or if a global element does not exist for rootElementURI and rootElementName,
* then an xsi:type declaration is written to record the root DataObject's Type.
*
* When loading the root element and an xsi:type declaration is found
* it is used as the type of the root DataObject. In this case,
* if validation is not being performed, it is not an error if the
* rootElementName is not a global element.
*/
public class XMLDocumentImpl implements XMLDocument
{
protected ExtendedMetaData extendedMetaData;
protected EObject rootObject;
protected XMLResource resource;
protected EStructuralFeature rootElement;
protected EObject documentRoot;
protected final static String WHITESPACE_REGEX = "\\s";
//TODO clean up the options thing
protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, Object options)
{
this.extendedMetaData = extendedMetaData;
ResourceSet resourceSet = DataObjectUtil.createResourceSet();
if (options instanceof Map)
{
Class resourceFactoryClass = (Class)((Map)options).get("GENERATED_LOADER");
if (resourceFactoryClass != null)
{
try
{
Object resourceFactory = resourceFactoryClass.newInstance();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
resource = (XMLResource)resourceSet.createResource(URI.createURI("http:///temp.xml"));
DataObjectUtil.configureXMLResource(resource, extendedMetaData);
}
protected XMLDocumentImpl(ExtendedMetaData extendedMetaData)
{
this(extendedMetaData, null);
}
protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, DataObject dataObject, String rootElementURI, String rootElementName)
{
this(extendedMetaData);
rootObject = (EObject)dataObject;
rootElement = extendedMetaData.getElement(rootElementURI, rootElementName);
if (rootElement == null)
{
rootElement = ExtendedMetaData.INSTANCE.demandFeature(rootElementURI, rootElementName, true);
}
EClass documentRootClass = rootElement.getEContainingClass();
documentRoot = EcoreUtil.create(documentRootClass);
resource.getContents().add(documentRoot);
}
protected void save(OutputStream outputStream, Object options) throws IOException
{
save(outputStream, null, options);
}
protected void save(Writer outputWriter, Object options) throws IOException
{
// TODO temporary brute-force implementation ... to be replaced
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
save(outputStream, options);
outputWriter.write(new String(outputStream.toByteArray()));
}
protected void save(Node node, Object options) throws IOException
{
save(null, (Document)node, options);
}
protected void save(OutputStream outputStream, Document document, Object options) throws IOException
{
EObject oldContainer = null;
Resource oldResource = null;
EReference oldContainmentReference = null;
int oldContainmentIndex = -1;
if (documentRoot != null)
{
oldContainer = rootObject.eContainer();
if (oldContainer != null)
oldContainmentReference = rootObject.eContainmentFeature();
else
oldResource = rootObject.eResource();
if (oldContainer != documentRoot || oldContainmentReference != rootElement)
{
if (oldResource != null)
{
oldContainmentIndex = oldResource.getContents().indexOf(rootObject);
oldResource.getContents().remove(oldContainmentIndex);
}
else if (oldContainmentReference != null && FeatureMapUtil.isMany(oldContainer, oldContainmentReference))
oldContainmentIndex = ((List)oldContainer.eGet(oldContainmentReference)).indexOf(rootObject);
Object rootValue =
rootElement instanceof EAttribute && rootObject instanceof SimpleAnyTypeDataObject ?
((SimpleAnyTypeDataObject)rootObject).getValue() : rootObject;
documentRoot.eSet(rootElement, rootValue);
}
}
if (outputStream != null)
resource.save(outputStream, (Map)options);
else // if (document != null)
resource.save(document, (Map)options, null);
if (oldResource != null)
{
oldResource.getContents().add(oldContainmentIndex, rootObject);
}
if (rootElement instanceof EReference)
{
if (oldContainer != null)
{
if (oldContainer != documentRoot || oldContainmentReference != rootElement)
{
if (FeatureMapUtil.isMany(oldContainer, oldContainmentReference))
((List)oldContainer.eGet(oldContainmentReference)).add(oldContainmentIndex, rootObject);
else
oldContainer.eSet(oldContainmentReference, rootObject);
}
}
else if (documentRoot != null)
{
documentRoot.eSet(rootElement, null);
}
}
}
protected void load(InputStream inputStream, String locationURI, Object options) throws IOException
{
InputSource inputSource = new InputSource(inputStream);
load(inputSource, locationURI, options);
}
protected void load(Reader inputReader, String locationURI, Object options) throws IOException
{
InputSource inputSource = new InputSource(inputReader);
load(inputSource, locationURI, options);
}
protected final void load(Node node, Object options) throws IOException {
resource.load(node, (Map)options);
initLoadedRoot();
}
protected final void load(XMLStreamReader reader, Map options) throws IOException
{
((SDOXMLResourceImpl)resource).load(reader, options);
initLoadedRoot();
}
protected void load(InputSource inputSource, String locationURI, Object options) throws IOException
{
if (locationURI != null)
{
inputSource.setSystemId(locationURI);
resource.setURI(URI.createURI(locationURI));
}
resource.load(inputSource, (Map)options);
initLoadedRoot();
}
/**
* @return a Map object with key-value pair where key is the DataObject and value contains the info
* about the unknown properties for the DataObject
*/
public Map getUnknownProperties(){
return resource.getEObjectToExtensionMap();
}
private void initLoadedRoot()
{
rootObject = null;
rootElement = null;
documentRoot = null;
if (!resource.getContents().isEmpty())
{
documentRoot = (EObject)resource.getContents().get(0);
EClass documentRootClass = documentRoot.eClass();
if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
{
FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
int size = featureMap.size();
for (int index = 0; index < size; index++)
{
EStructuralFeature feature = featureMap.getEStructuralFeature(index);
boolean isText =
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||
feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
if (!isText)
{
if (feature instanceof EReference)
{
rootObject = (EObject)featureMap.getValue(index);
documentRoot.eUnset(feature);
}
else //EAttribute
{
rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
}
rootElement = feature;
break;
}
} //for
if (rootObject == null)
rootObject = ((SDOXMLResourceImpl) resource).root;
}
else
{
rootObject = documentRoot;
documentRoot = null;
}
}
}
public DataObject getRootObject()
{
return (DataObject)rootObject;
}
public String getRootElementURI()
{
if (rootElement != null)
{
return extendedMetaData.getNamespace(rootElement);
}
else if (rootObject != null)
{
return extendedMetaData.getNamespace(rootObject.eClass());
}
return null;
}
public String getRootElementName()
{
if (rootElement != null)
{
return extendedMetaData.getName(rootElement);
}
else if (rootObject != null)
{
return extendedMetaData.getName(rootObject.eClass());
}
return null;
}
public String getEncoding()
{
return resource.getEncoding();
}
public void setEncoding(String encoding)
{
resource.setEncoding(encoding);
}
public boolean isXMLDeclaration()
{
return Boolean.FALSE.equals(resource.getDefaultSaveOptions().get(XMLResource.OPTION_DECLARE_XML));
}
public void setXMLDeclaration(boolean xmlDeclaration)
{
resource.getDefaultSaveOptions().put(XMLResource.OPTION_DECLARE_XML, xmlDeclaration ? Boolean.TRUE : Boolean.FALSE);
}
public String getXMLVersion()
{
return resource.getXMLVersion();
}
public void setXMLVersion(String xmlVersion)
{
resource.setXMLVersion(xmlVersion);
}
/**
* @return an EMap containing the schema locations or null when no map
*/
protected EMap getSchemaLocationMap()
{
EMap result = null;
if ((documentRoot != null) && (extendedMetaData != null))
{
EReference xsiSchemaLocationMapFeature = extendedMetaData
.getXSISchemaLocationMapFeature(documentRoot.eClass());
if (xsiSchemaLocationMapFeature != null)
{
result = (EMap) documentRoot.eGet(xsiSchemaLocationMapFeature);
}
}
return result;
}
/**
* @param value
* from schema location map.
* @return string form of URI from provided value, deresolved if appropriate.
*/
protected String deresolve(String value)
{
URI location = URI.createURI(value);
URI resourceURI = resource.getURI();
boolean shouldDeresolve = resourceURI != null && !resourceURI.isRelative()
&& resourceURI.isHierarchical();
if (shouldDeresolve && !location.isRelative())
{
URI deresolvedURI = location.deresolve(resourceURI, true, true, false);
if (deresolvedURI.hasRelativePath())
{
location = deresolvedURI;
}
}
return location.toString();
}
/**
* @param value
* for schema location from input parameter.
* @return string form of URI from provided value, resolved if appropriate.
*/
protected String resolve(String value)
{
URI location = URI.createURI(value);
URI resourceURI = resource.getURI();
boolean shouldResolve = resourceURI != null && resourceURI.isHierarchical()
&& !resourceURI.isRelative();
if (shouldResolve && location.isRelative() && location.hasRelativePath())
{
location = location.resolve(resourceURI, false);
}
return location.toString();
}
public String getSchemaLocation()
{
EMap xsiSchemaLocationMap = getSchemaLocationMap();
if (xsiSchemaLocationMap != null)
{
if (!xsiSchemaLocationMap.isEmpty())
{
StringBuffer xsiSchemaLocation = new StringBuffer();
for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i
.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
String namespace = (String) entry.getKey();
if (namespace != null)
{
if (xsiSchemaLocation.length() > 0)
{
xsiSchemaLocation.append(' ');
}
xsiSchemaLocation.append(namespace);
xsiSchemaLocation.append(' ');
String value = entry.getValue().toString();
xsiSchemaLocation.append(deresolve(value));
}
}
return xsiSchemaLocation.toString().equals("") ? null
: xsiSchemaLocation.toString();
}
}
return null;
}
public void setSchemaLocation(String schemaLocation)
{
EMap xsiSchemaLocationMap = getSchemaLocationMap();
if (xsiSchemaLocationMap != null)
{
// only remove the entries from xsiSchemaLocationMap that contain a
// non-null key
for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
if (entry.getKey() != null)
{
i.remove();
}
}
if (xsiSchemaLocationMap.size() == 0)
{
resource.getDefaultSaveOptions().put(
XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE);
}
if (schemaLocation != null)
{
String[] values = schemaLocation.split(WHITESPACE_REGEX);
for (int i = 0; i < values.length; i++) // note: also incremented in
// loop
{
String key = values[i++];
if (i < values.length)
{
xsiSchemaLocationMap.put(key, resolve(values[i]));
}
}
if (xsiSchemaLocationMap.size() != 0)
{
resource.getDefaultSaveOptions().put(
XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
}
}
}
}
public String getNoNamespaceSchemaLocation()
{
EMap xsiSchemaLocationMap = getSchemaLocationMap();
if (xsiSchemaLocationMap != null)
{
StringBuffer xsiSchemaLocation = new StringBuffer();
if (!xsiSchemaLocationMap.isEmpty())
{
Object valueObject = xsiSchemaLocationMap.get(null);
if (valueObject != null)
{
String valueString = (String) valueObject;
String[] values = valueString.split(WHITESPACE_REGEX);
for (int i = 0; i < values.length; i++)
{
if (xsiSchemaLocation.length() > 0)
{
xsiSchemaLocation.append(' ');
}
xsiSchemaLocation.append(deresolve(values[i]));
}
}
String result = xsiSchemaLocation.toString();
return result.equals("") ? null : result;
}
}
return null;
}
public void setNoNamespaceSchemaLocation(String schemaLocation)
{
EMap xsiSchemaLocationMap = getSchemaLocationMap();
if (xsiSchemaLocationMap != null)
{
// only remove the entries from xsiSchemaLocationMap that contain a null
// key
xsiSchemaLocationMap.removeKey(null);
if (xsiSchemaLocationMap.size() == 0)
{
resource.getDefaultSaveOptions().put(
XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE);
}
if (schemaLocation != null)
{
String[] values = schemaLocation.split(WHITESPACE_REGEX);
for (int i = 0; i < values.length; i++)
{
xsiSchemaLocationMap.put(null, resolve(values[i]));
}
if (xsiSchemaLocationMap.size() != 0)
{
resource.getDefaultSaveOptions().put(
XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
}
}
}
}
}

View file

@ -0,0 +1,193 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.xml.sax.InputSource;
import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLDocument;
import commonj.sdo.helper.XMLHelper;
/**
* A helper to convert XML documents into DataObects and DataObjects into XML
* documnets.
*/
public class XMLHelperImpl implements XMLHelper {
protected HelperContext helperContext;
private ExtendedMetaData extendedMetaData;
public XMLHelperImpl(HelperContext hc) {
this.helperContext = hc;
this.extendedMetaData = ((HelperContextImpl)hc).extendedMetaData;
}
public XMLDocument load(String inputString) {
try {
return load(new StringReader(inputString), null, null);
} catch (IOException e) {
throw new RuntimeException(e); // should never happen
}
}
public XMLDocument load(String inputString, Object options) {
try {
return load(new StringReader(inputString), null, options);
} catch (IOException e) {
throw new RuntimeException(e); // should never happen
}
}
public XMLDocument load(InputStream inputStream) throws IOException {
return load(inputStream, null, null);
}
private Object checkSetOptions(Object options) throws IOException {
if (options != null && !(options instanceof Map)) {
throw new IOException("Invalid load options!");
}
if (helperContext != null) {
return ((HelperContextImpl)helperContext).getMergedOption((Map)options);
} else {// null is acceptable as it will be ignored
return options;
}
}
public XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException {
options = checkSetOptions(options);
XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options);
document.load(inputStream, locationURI, options);
return document;
}
public XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException {
XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options);
options = checkSetOptions(options);
document.load(inputReader, locationURI, options);
return document;
}
public XMLDocument load(Source source, String locationURI, Object options) throws IOException {
options = checkSetOptions(options);
if (source instanceof DOMSource) {
DOMSource domSource = (DOMSource)source;
XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options);
document.load(domSource.getNode(), options);
return document;
} else if (source instanceof SAXSource) {
XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options);
InputSource inputSource = SAXSource.sourceToInputSource(source);
document.load(inputSource, locationURI, options);
return document;
} else if (source instanceof StreamSource) {
return load(((StreamSource)source).getInputStream(), locationURI, options);
} else {
throw new UnsupportedOperationException();
}
}
public String save(DataObject dataObject, String rootElementURI, String rootElementName) {
StringWriter stringWriter = new StringWriter();
try {
save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, null);
return stringWriter.toString();
} catch (IOException e) {
throw new RuntimeException(e); // should never happen
}
}
public String save(DataObject dataObject, String rootElementURI, String rootElementName, Object options) {
StringWriter stringWriter = new StringWriter();
try {
save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, options);
return stringWriter.toString();
} catch (IOException e) {
throw new RuntimeException(e); // should never happen
}
}
public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream)
throws IOException {
save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null);
}
public void save(DataObject dataObject,
String rootElementURI,
String rootElementName,
OutputStream outputStream,
Object options) throws IOException {
save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null);
}
public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException {
options = checkSetOptions(options);
((XMLDocumentImpl)xmlDocument).save(outputStream, options);
}
public void save(XMLDocument xmlDocument, Writer outputWriter, Object options) throws IOException {
options = checkSetOptions(options);
((XMLDocumentImpl)xmlDocument).save(outputWriter, options);
}
public void save(XMLDocument xmlDocument, Result outputResult, Object options) throws IOException {
options = checkSetOptions(options);
if (outputResult instanceof DOMResult) {
((XMLDocumentImpl)xmlDocument).save(((DOMResult)outputResult).getNode(), options);
} else if (outputResult instanceof SAXResult) {
throw new UnsupportedOperationException();
} else if (outputResult instanceof StreamResult) {
save(xmlDocument, ((StreamResult)outputResult).getOutputStream(), options);
} else {
throw new UnsupportedOperationException();
}
}
public XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName) {
XMLDocument xmlDocument = new XMLDocumentImpl(extendedMetaData, dataObject, rootElementURI, rootElementName);
xmlDocument.setEncoding("UTF-8");
return xmlDocument;
}
public HelperContext getHelperContext() {
return helperContext;
}
}

View file

@ -0,0 +1,26 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
/**
* @deprecated
*/
public interface XMLStreamHelper extends org.apache.tuscany.sdo.api.XMLStreamHelper {
}

View file

@ -0,0 +1,151 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.util.Map;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sdo.util.resource.DataObjectXMLStreamReader;
import org.apache.tuscany.sdo.util.resource.XMLDocumentStreamReader;
import org.apache.tuscany.sdo.util.resource.XMLStreamSerializer;
import org.eclipse.emf.ecore.resource.Resource;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLDocument;
/**
* @version $Rev$ $Date$
*/
public class XMLStreamHelperImpl implements XMLStreamHelper {
protected HelperContext helperContext;
public XMLStreamHelperImpl(HelperContext hc) {
this.helperContext = hc;
}
private Map checkSetOptions(Map options) {
if (helperContext != null) {
return ((HelperContextImpl)helperContext).getMergedOption(options);
} else {// null is acceptable as it will be ignored
return options;
}
}
public XMLDocument load(XMLStreamReader reader) throws XMLStreamException, IllegalStateException {
if (reader.getEventType() != XMLStreamConstants.START_DOCUMENT)
throw new IllegalStateException();
return loadDocument(reader, null);
}
public void save(XMLDocument document, XMLStreamWriter writer) throws XMLStreamException {
XMLStreamReader reader = createXMLStreamReader(document);
new XMLStreamSerializer().serialize(reader, writer);
}
public void save(XMLDocument document, XMLStreamWriter writer, Map options) throws XMLStreamException {
XMLStreamReader reader = createXMLStreamReader(document);
options = checkSetOptions(options);
new XMLStreamSerializer().serialize(reader, writer, options);
}
public XMLStreamReader createXMLStreamReader(XMLDocument document) throws XMLStreamException {
XMLStreamReader reader =
new DataObjectXMLStreamReader(document.getRootObject(), document.getRootElementURI(), document
.getRootElementName(), helperContext.getTypeHelper());
// Wrap the reader so that its position will be START_ELEMENT
return new XMLDocumentStreamReader(reader);
}
public final DataObject loadObject(XMLStreamReader reader, Map options) throws XMLStreamException,
IllegalStateException {
if (reader.getEventType() != XMLStreamConstants.START_ELEMENT)
throw new IllegalStateException();
// StAX2SAXAdapter won't produce START_DOCUMENT if the reader is
// posisitioned at START_ELEMENT and the EMF loader will fail
// Wrap the reader so it represents a document
reader = new XMLDocumentStreamReader(reader);
return loadDocument(reader, options).getRootObject();
}
public DataObject loadObject(XMLStreamReader reader) throws XMLStreamException, IllegalStateException {
return loadObject(reader, null);
}
public void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException {
XMLStreamReader reader = createXMLStreamReader(sdo);
new XMLStreamSerializer().serialize(new XMLDocumentStreamReader(reader), writer);
}
public void saveObject(DataObject sdo, XMLStreamWriter writer, Map options) throws XMLStreamException {
XMLStreamReader reader = createXMLStreamReader(sdo);
options = checkSetOptions(options);
new XMLStreamSerializer().serialize(new XMLDocumentStreamReader(reader), writer, options);
}
public XMLStreamReader createXMLStreamReader(DataObject dataObject) {
if (dataObject == null) {
return null;
}
String rootElementURI;
String rootElementName;
Property property = dataObject.getContainmentProperty();
if (property != null) {
rootElementName = property.getName();
rootElementURI = property.getType().getURI();
} else {
rootElementName = dataObject.getType().getName();
rootElementURI = dataObject.getType().getURI();
}
return new DataObjectXMLStreamReader(dataObject, rootElementURI, rootElementName, helperContext.getTypeHelper());
}
protected XMLDocument loadDocument(XMLStreamReader reader, Map options) throws XMLStreamException {
try {
XMLDocumentImpl document = new XMLDocumentImpl(((HelperContextImpl)helperContext).extendedMetaData, null);
options = checkSetOptions(options);
document.load(reader, options);
return document;
} catch (Exception e) {
if (e instanceof Resource.IOWrappedException) {
Resource.IOWrappedException ioe = (Resource.IOWrappedException)e;
if (ioe.getWrappedException() instanceof XMLStreamException) {
throw (XMLStreamException)ioe.getWrappedException();
}
}
throw new RuntimeException(e); // ????
}
}
public HelperContext getHelperContext() {
return helperContext;
}
}

View file

@ -0,0 +1,327 @@
/**
*
* 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
*
* http://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.tuscany.sdo.helper;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.ecore.XSDEcoreBuilder;
import org.eclipse.xsd.util.XSDResourceFactoryImpl;
import org.eclipse.xsd.util.XSDResourceImpl;
import org.xml.sax.InputSource;
import commonj.sdo.Property;
import commonj.sdo.Type;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
import commonj.sdo.helper.XSDHelper;
/**
* Provides access to additional information when the Type or Property is
* defined by an XML Schema (XSD). Methods return null/false otherwise or if the
* information is unavailable. Defines Types from an XSD.
*/
public class XSDHelperImpl implements XSDHelper {
protected boolean extensibleNamespaces = false;
protected HelperContext helperContext;
protected SDOXSDEcoreBuilder nondelegatingEcoreBuilder = null;
protected HashMap tcclToEcoreBuilderMap = null;
private ExtendedMetaData extendedMetaData;
public XSDHelperImpl(HelperContext hc, String redefineBuiltIn, boolean extensibleNamespaces) {
this.helperContext = hc;
this.extensibleNamespaces = extensibleNamespaces;
extendedMetaData = ((HelperContextImpl)helperContext).extendedMetaData;
SDOXSDEcoreBuilder ecoreBuilder = createEcoreBuilder();
if (extendedMetaData instanceof SDOExtendedMetaDataImpl && ((SDOExtendedMetaDataImpl)extendedMetaData)
.getRegistry() instanceof EPackageRegistryImpl.Delegator) {
tcclToEcoreBuilderMap = new HashMap();
putTCCLEcoreBuilder(ecoreBuilder);
} else {
nondelegatingEcoreBuilder = ecoreBuilder;
}
if (redefineBuiltIn != null) { // Redefining/regenerating this built-in
// model
ecoreBuilder.getTargetNamespaceToEPackageMap().remove(redefineBuiltIn);
}
}
public XSDHelperImpl(HelperContext hc) {
this(hc, null, false);
}
/**
* Redefine/regenerating the built-in model
* @param redefineBuiltIn
*/
public void setRedefineBuiltIn(String redefineBuiltIn) {
if (redefineBuiltIn != null) {
getEcoreBuilder().getTargetNamespaceToEPackageMap().remove(redefineBuiltIn);
}
}
public void setExtensibleNamespaces(boolean extensibleNamespaces) {
this.extensibleNamespaces = extensibleNamespaces;
}
protected SDOXSDEcoreBuilder createEcoreBuilder() {
SDOXSDEcoreBuilder ecoreBuilder = new SDOXSDEcoreBuilder(extendedMetaData, extensibleNamespaces);
// Add the built-in models to the targetNamespaceToEPackageMap so they
// can't be (re)defined/overridden
for (Iterator iter = TypeHelperImpl.getBuiltInModels().iterator(); iter.hasNext();) {
EPackage ePackage = (EPackage)iter.next();
ecoreBuilder.getTargetNamespaceToEPackageMap().put(ePackage.getNsURI(), ePackage);
}
return ecoreBuilder;
}
protected void putTCCLEcoreBuilder(XSDEcoreBuilder ecoreBuilder) {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
if (tcclToEcoreBuilderMap.get(tccl) == null) {
tcclToEcoreBuilderMap.put(tccl, ecoreBuilder);
}
}
protected SDOXSDEcoreBuilder getEcoreBuilder() {
if (nondelegatingEcoreBuilder != null)
return nondelegatingEcoreBuilder;
SDOXSDEcoreBuilder result = null;
try {
for (ClassLoader tccl = Thread.currentThread().getContextClassLoader(); tccl != null; tccl =
tccl.getParent()) {
result = (SDOXSDEcoreBuilder)tcclToEcoreBuilderMap.get(tccl);
if (result != null)
return result;
} // for
} catch (SecurityException exception) {
// exception.printStackTrace();
}
result = createEcoreBuilder();
putTCCLEcoreBuilder(result);
return result;
}
public String getLocalName(Type type) {
return extendedMetaData.getName((EClassifier)type);
}
public String getLocalName(Property property) {
return extendedMetaData.getName((EStructuralFeature)property);
}
public String getNamespaceURI(Property property) {
return extendedMetaData.getNamespace((EStructuralFeature)property);
}
public boolean isAttribute(Property property) {
return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ATTRIBUTE_FEATURE;
}
public boolean isElement(Property property) {
return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ELEMENT_FEATURE;
}
public boolean isMixed(Type type) {
if (type instanceof EClass) {
return extendedMetaData.getContentKind((EClass)type) == ExtendedMetaData.MIXED_CONTENT;
} else {
return false;
}
}
public boolean isXSD(Type type) {
return ((EModelElement)type).getEAnnotation(ExtendedMetaData.ANNOTATION_URI) != null;
}
public Property getGlobalProperty(String uri, String propertyName, boolean isElement) {
if (isElement) {
return (Property)extendedMetaData.getElement(uri, propertyName);
} else {
return (Property)extendedMetaData.getAttribute(uri, propertyName);
}
}
public String getAppinfo(Type type, String source) {
return getAppinfo((EModelElement)type, source);
}
public String getAppinfo(Property property, String source) {
return getAppinfo((EModelElement)property, source);
}
protected String getAppinfo(EModelElement eModelElement, String source) {
return (String)eModelElement.getEAnnotation(source).getDetails().get("appinfo");
}
public List /* Type */define(String xsd) {
InputStream inputStream = new ByteArrayInputStream(xsd.getBytes());
return define(inputStream, "*.xsd");
}
public List /* Type */define(Reader xsdReader, String schemaLocation) {
InputSource inputSource = new InputSource(xsdReader);
return define(inputSource, schemaLocation);
}
public List /* Type */define(InputStream xsdInputStream, String schemaLocation) {
InputSource inputSource = new InputSource(xsdInputStream);
return define(inputSource, schemaLocation);
}
protected List /* Type */define(InputSource inputSource, String schemaLocation) {
try {
SDOXSDEcoreBuilder ecoreBuilder = getEcoreBuilder();
ResourceSet resourceSet = ecoreBuilder.createResourceSet();
Resource model =
resourceSet.createResource(URI.createURI(schemaLocation != null ? schemaLocation : "null.xsd"));
((XSDResourceImpl)model).load(inputSource, null);
List newTypes = new ArrayList();
for (Iterator schemaIter = model.getContents().iterator(); schemaIter.hasNext();) {
XSDSchema schema = (XSDSchema)schemaIter.next();
String targetNamespace = schema.getTargetNamespace();
EPackage ePackage = extendedMetaData.getPackage(targetNamespace);
if (extensibleNamespaces || ePackage == null || TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
Map targetNamespaceToEPackageMap = ecoreBuilder.getTargetNamespaceToEPackageMap();
targetNamespaceToEPackageMap.remove(targetNamespace);
Collection originalEPackages = new HashSet(targetNamespaceToEPackageMap.values());
ecoreBuilder.generate(schema);
Collection newEPackages = ecoreBuilder.getTargetNamespaceToEPackageMap().values();
for (Iterator iter = newEPackages.iterator(); iter.hasNext();) {
EPackage currentPackage = (EPackage)iter.next();
if (!originalEPackages.contains(currentPackage)) {
currentPackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
EcoreUtil.freeze(currentPackage);
newTypes.addAll(currentPackage.getEClassifiers());
}
}
}
}
return newTypes;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e.getMessage());
}
}
public String generate(List /* Type */types) throws IllegalArgumentException {
return generate(types, new Hashtable());
}
public String generate(List /* Type */types, Map /* String, String */namespaceToSchemaLocation)
throws IllegalArgumentException {
if (types != null && !types.isEmpty()) {
Hashtable schemaMap = new Hashtable();
Hashtable nsPrefixMap = new Hashtable();
TypeTable typeTable = new TypeTable();
SchemaBuilder schemaBuilder =
new SchemaBuilder(schemaMap, nsPrefixMap, typeTable, namespaceToSchemaLocation);
Iterator iterator = types.iterator();
Type dataType = null;
try {
while (iterator.hasNext()) {
dataType = (Type)iterator.next();
schemaBuilder.buildSchema(dataType);
}
XSDSchema xmlSchema = null;
iterator = schemaMap.values().iterator();
StringWriter writer = new StringWriter();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
while (iterator.hasNext()) {
xmlSchema = (XSDSchema)iterator.next();
if (xmlSchema.getElement() == null) {
xmlSchema.updateElement();
}
transformer.transform(new DOMSource(xmlSchema.getElement().getOwnerDocument()),
new StreamResult(writer));
}
writer.close();
return writer.getBuffer().toString();
} catch (Exception e) {
// System.out.println("Unable to generate schema due to ..." +
// e);
// e.printStackTrace();
throw new IllegalArgumentException(e.getMessage());
}
} else {
// System.out.println("No SDO Types to generate schema ...");
return "";
}
}
public HelperContext getHelperContext() {
return helperContext;
}
}

View file

@ -0,0 +1,286 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.AnyTypeDataObject;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.util.BasicSequence;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EData Object Any Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getMixed <em>Mixed</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getAny <em>Any</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AnyTypeDataObjectImpl extends DataObjectImpl implements AnyTypeDataObject
{
/**
* The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMixed()
* @generated
* @ordered
*/
protected FeatureMap mixed;
/**
* The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnyAttribute()
* @generated
* @ordered
*/
protected FeatureMap anyAttribute;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AnyTypeDataObjectImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.ANY_TYPE_DATA_OBJECT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public FeatureMap getMixed()
{
if (mixed == null)
{
//mixed = new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED);
mixed = new BasicSequence(new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED)).featureMap();
}
return mixed;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public FeatureMap getAny()
{
//return (FeatureMap)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any());
return new BasicSequence((FeatureMap.Internal)(EList<?>)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any())).featureMap();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public FeatureMap getAnyAttribute()
{
if (anyAttribute == null)
{
//anyAttribute = new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE);
anyAttribute = new BasicSequence(new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE)).featureMap();
}
return anyAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED:
return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs);
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY:
return ((InternalEList)getAny()).basicRemove(otherEnd, msgs);
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE:
return ((InternalEList)getAnyAttribute()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED:
if (coreType) return getMixed();
return ((FeatureMap.Internal)getMixed()).getWrapper();
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY:
if (coreType) return getAny();
return ((FeatureMap.Internal)getAny()).getWrapper();
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE:
if (coreType) return getAnyAttribute();
return ((FeatureMap.Internal)getAnyAttribute()).getWrapper();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue)
{
switch (featureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED:
((FeatureMap.Internal)getMixed()).set(newValue);
return;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY:
((FeatureMap.Internal)getAny()).set(newValue);
return;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE:
((FeatureMap.Internal)getAnyAttribute()).set(newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID)
{
switch (featureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED:
getMixed().clear();
return;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY:
getAny().clear();
return;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE:
getAnyAttribute().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID)
{
switch (featureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED:
return mixed != null && !mixed.isEmpty();
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY:
return !getAny().isEmpty();
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE:
return anyAttribute != null && !anyAttribute.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass)
{
if (baseClass == AnyType.class) {
switch (derivedFeatureID) {
case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: return XMLTypePackage.ANY_TYPE__MIXED;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: return XMLTypePackage.ANY_TYPE__ANY;
case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: return XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass)
{
if (baseClass == AnyType.class) {
switch (baseFeatureID) {
case XMLTypePackage.ANY_TYPE__MIXED: return SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED;
case XMLTypePackage.ANY_TYPE__ANY: return SDOPackage.ANY_TYPE_DATA_OBJECT__ANY;
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: return SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (mixed: ");
result.append(mixed);
result.append(", anyAttribute: ");
result.append(anyAttribute);
result.append(')');
return result.toString();
}
} //EDataObjectAnyTypeImpl

View file

@ -0,0 +1,836 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.List;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
import org.apache.tuscany.sdo.model.internal.InternalFactory;
import org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl;
import org.apache.tuscany.sdo.util.BasicSequence;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.apache.tuscany.sdo.util.SDOUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EAttributeImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.util.FeatureMap;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Attribute</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class AttributeImpl extends EAttributeImpl implements Property
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AttributeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected EClass eStaticClass()
{
return SDOPackage.eINSTANCE.getAttribute();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Object getDefault()
{
return getDefaultValue();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isReadOnly()
{
//return "true".equals(EcoreUtil.getAnnotation(this, "commonj.sdo", "readOnly"));
return !isChangeable(); //TODO semantics don't exactly match?
}
/**
* Single-valued SDO properties behave as EMF unsettable, multi-valued properties as EMF !unsettable
*/
public boolean isUnsettable()
{
return !isMany();
}
public boolean isUnique()
{
return false;
}
protected List aliasNames = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getAliasNames()
{
if (aliasNames == null)
{
aliasNames = DataObjectUtil.getAliasNames(this);
}
return aliasNames;
}
public static Type INTERNAL_BASE64_BYTES = ((InternalFactoryImpl)InternalFactory.INSTANCE).getBase64Bytes();
public static Type INTERNAL_QNAME = ((InternalFactoryImpl)InternalFactory.INSTANCE).getQName();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Type getType()
{
EClassifier eType = getEType();
if (eType == INTERNAL_BASE64_BYTES)
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getBytes();
else if (eType == INTERNAL_QNAME)
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getURI();
return (Type)eType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Type getContainingType()
{
return (Type)getEContainingClass();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Property getOpposite()
{
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isContainment()
{
return false;
}
protected EStructuralFeature.Internal.SettingDelegate createFeatureMapSettingDelegate()
{
return new InternalSettingDelegateSequence(this);
}
public static class InternalSettingDelegateSequence extends InternalSettingDelegateMany
{
InternalSettingDelegateSequence(EStructuralFeature feature)
{
super(InternalSettingDelegateMany.FEATURE_MAP, feature);
}
protected EStructuralFeature.Setting createDynamicSetting(InternalEObject owner)
{
FeatureMap.Internal featureMap = (FeatureMap.Internal)super.createDynamicSetting(owner);
new BasicSequence(featureMap);
return featureMap;
}
}
public boolean isNullable()
{
String isNillable = EcoreUtil.getAnnotation(this, ExtendedMetaData.ANNOTATION_URI, "nillable");
return isNillable != null && "true".equals(isNillable);
}
public boolean isOpenContent()
{
return SDOUtil.isDocumentRoot(getContainingType());
}
public List getInstanceProperties() {
return DataObjectUtil.getMetaObjectInstanceProperties(this);
}
public Object get(Property property) {
return DataObjectUtil.getMetaObjectInstanceProperty(this, property);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// org.apache.tuscany.sdo.model.Property methods
/////////////////////////////////////////////////////////////////////////////////////////////////////////
public List getAliasName() {
return this.getAliasNames();
}
public Sequence getAny() {
throw new UnsupportedOperationException();
}
public void unsetContainment() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetContainment() {
return false;
}
public void setMany(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetMany() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetMany() {
return isMany();
}
public void setReadOnly(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetReadOnly() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetReadOnly() {
return isReadOnly();
}
public org.apache.tuscany.sdo.model.Type getType_() {
return (org.apache.tuscany.sdo.model.Type)getType();
}
public void setType(org.apache.tuscany.sdo.model.Type value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public Sequence getAnyAttribute() {
throw new UnsupportedOperationException();
}
public String getDefault_() {
return (String) this.getDefault();
}
public void setDefault_(String value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public org.apache.tuscany.sdo.model.Property getOpposite_() {
return (org.apache.tuscany.sdo.model.Property) getOpposite();
}
public void setOpposite_(org.apache.tuscany.sdo.model.Property value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void setContainment(boolean value) {
throw new UnsupportedOperationException();
}
public void setNullable(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetNullable() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetNullable() {
return isUnsettable();
}
public void unsetName()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetName()
{
return true;
}
public void unsetOpposite()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetOpposite()
{
return getOpposite() != null;
}
public void unsetType()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetType()
{
return true;
}
public void unsetDefault()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetDefault()
{
return getDefault() != null;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// DataObject method implementations
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
public Object get(int propertyIndex) {
return DataObjectUtil.get(this, propertyIndex);
}
public void set(int propertyIndex, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(int propertyIndex) {
return DataObjectUtil.isSet(this, propertyIndex);
}
public void unset(int propertyIndex) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public Object get(Property property) {
return DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID());
}
public void set(Property property, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(Property property) {
return DataObjectUtil.isSet(this, ((EStructuralFeature)property).getFeatureID());
}
public void unset(Property property) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject getContainer() {
return (DataObject)eContainer();
}
public Property getContainmentProperty() {
return (Property)eContainmentFeature();
}
// Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil
public Object get(String path) {
return DataObjectUtil.get(this, path);
}
public void set(String path, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(String path) {
return DataObjectUtil.isSet(this, path);
}
public void unset(String path) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean getBoolean(String path) {
return DataObjectUtil.getBoolean(get(path));
}
public byte getByte(String path) {
return DataObjectUtil.getByte(get(path));
}
public char getChar(String path) {
return DataObjectUtil.getChar(get(path));
}
public double getDouble(String path) {
return DataObjectUtil.getDouble(get(path));
}
public float getFloat(String path) {
return DataObjectUtil.getFloat(get(path));
}
public int getInt(String path) {
return DataObjectUtil.getInt(get(path));
}
public long getLong(String path) {
return DataObjectUtil.getLong(get(path));
}
public short getShort(String path) {
return DataObjectUtil.getShort(get(path));
}
public byte[] getBytes(String path) {
return DataObjectUtil.getBytes(get(path));
}
public BigDecimal getBigDecimal(String path) {
return DataObjectUtil.getBigDecimal(get(path));
}
public BigInteger getBigInteger(String path) {
return DataObjectUtil.getBigInteger(get(path));
}
public DataObject getDataObject(String path) {
return (DataObject)get(path);
}
public Date getDate(String path) {
return DataObjectUtil.getDate(get(path));
}
public String getString(String path) {
return DataObjectUtil.getString(get(path));
}
public List getList(String path) {
return (List)get(path);
}
public Sequence getSequence(String path) {
return (Sequence)get(path);
}
public void setBoolean(String path, boolean value) {
set(path, new Boolean(value));
}
public void setByte(String path, byte value) {
set(path, new Byte(value));
}
public void setChar(String path, char value) {
set(path, new Character(value));
}
public void setDouble(String path, double value) {
set(path, new Double(value));
}
public void setFloat(String path, float value) {
set(path, new Float(value));
}
public void setInt(String path, int value) {
set(path, new Integer(value));
}
public void setLong(String path, long value) {
set(path, new Long(value));
}
public void setShort(String path, short value) {
set(path, new Short(value));
}
public void setBytes(String path, byte[] value) {
set(path, value);
}
public void setBigDecimal(String path, BigDecimal value) {
set(path, value);
}
public void setBigInteger(String path, BigInteger value) {
set(path, value);
}
public void setDataObject(String path, DataObject value) {
set(path, value);
}
public void setDate(String path, Date value) {
set(path, value);
}
public void setString(String path, String value) {
set(path, value);
}
public void setList(String path, List value) {
set(path, value);
}
public boolean getBoolean(int propertyIndex) {
return DataObjectUtil.getBoolean(this, propertyIndex);
}
public byte getByte(int propertyIndex) {
return DataObjectUtil.getByte(this, propertyIndex);
}
public char getChar(int propertyIndex) {
return DataObjectUtil.getChar(this, propertyIndex);
}
public double getDouble(int propertyIndex) {
return DataObjectUtil.getDouble(this, propertyIndex);
}
public float getFloat(int propertyIndex) {
return DataObjectUtil.getFloat(this, propertyIndex);
}
public int getInt(int propertyIndex) {
return DataObjectUtil.getInt(this, propertyIndex);
}
public long getLong(int propertyIndex) {
return DataObjectUtil.getLong(this, propertyIndex);
}
public short getShort(int propertyIndex) {
return DataObjectUtil.getShort(this, propertyIndex);
}
public byte[] getBytes(int propertyIndex) {
return DataObjectUtil.getBytes(this, propertyIndex);
}
public BigDecimal getBigDecimal(int propertyIndex) {
return DataObjectUtil.getBigDecimal(this, propertyIndex);
}
public BigInteger getBigInteger(int propertyIndex) {
return DataObjectUtil.getBigInteger(this, propertyIndex);
}
public DataObject getDataObject(int propertyIndex) {
return DataObjectUtil.getDataObject(this, propertyIndex);
}
public Date getDate(int propertyIndex) {
return DataObjectUtil.getDate(this, propertyIndex);
}
public String getString(int propertyIndex) {
return DataObjectUtil.getString(this, propertyIndex);
}
public List getList(int propertyIndex) {
return DataObjectUtil.getList(this, propertyIndex);
}
public Sequence getSequence(int propertyIndex) {
return DataObjectUtil.getSequence(this, propertyIndex);
}
public void setBoolean(int propertyIndex, boolean value) {
set(propertyIndex, new Boolean(value));
}
public void setByte(int propertyIndex, byte value) {
set(propertyIndex, new Byte(value));
}
public void setChar(int propertyIndex, char value) {
set(propertyIndex, new Character(value));
}
public void setDouble(int propertyIndex, double value) {
set(propertyIndex, new Double(value));
}
public void setFloat(int propertyIndex, float value) {
set(propertyIndex, new Float(value));
}
public void setInt(int propertyIndex, int value) {
set(propertyIndex, new Integer(value));
}
public void setLong(int propertyIndex, long value) {
set(propertyIndex, new Long(value));
}
public void setShort(int propertyIndex, short value) {
set(propertyIndex, new Short(value));
}
public void setBytes(int propertyIndex, byte[] value) {
set(propertyIndex, value);
}
public void setBigDecimal(int propertyIndex, BigDecimal value) {
set(propertyIndex, value);
}
public void setBigInteger(int propertyIndex, BigInteger value) {
set(propertyIndex, value);
}
public void setDataObject(int propertyIndex, DataObject value) {
set(propertyIndex, value);
}
public void setDate(int propertyIndex, Date value) {
set(propertyIndex, value);
}
public void setString(int propertyIndex, String value) {
set(propertyIndex, value);
}
public void setList(int propertyIndex, List value) {
set(propertyIndex, value);
}
public boolean getBoolean(Property property) {
return DataObjectUtil.getBoolean(this, property);
}
public byte getByte(Property property) {
return DataObjectUtil.getByte(this, property);
}
public char getChar(Property property) {
return DataObjectUtil.getChar(this, property);
}
public double getDouble(Property property) {
return DataObjectUtil.getDouble(this, property);
}
public float getFloat(Property property) {
return DataObjectUtil.getFloat(this, property);
}
public int getInt(Property property) {
return DataObjectUtil.getInt(this, property);
}
public long getLong(Property property) {
return DataObjectUtil.getLong(this, property);
}
public short getShort(Property property) {
return DataObjectUtil.getShort(this, property);
}
public byte[] getBytes(Property property) {
return DataObjectUtil.getBytes(this, property);
}
public BigDecimal getBigDecimal(Property property) {
return DataObjectUtil.getBigDecimal(this, property);
}
public BigInteger getBigInteger(Property property) {
return DataObjectUtil.getBigInteger(this, property);
}
public DataObject getDataObject(Property property) {
return DataObjectUtil.getDataObject(this, property);
}
public Date getDate(Property property) {
return DataObjectUtil.getDate(this, property);
}
public String getString(Property property) {
return DataObjectUtil.getString(this, property);
}
public List getList(Property property) {
return DataObjectUtil.getList(this, property);
}
public Sequence getSequence(Property property) {
return DataObjectUtil.getSequence(this, property);
}
public void setBoolean(Property property, boolean value) {
set(property, new Boolean(value));
}
public void setByte(Property property, byte value) {
set(property, new Byte(value));
}
public void setChar(Property property, char value) {
set(property, new Character(value));
}
public void setDouble(Property property, double value) {
set(property, new Double(value));
}
public void setFloat(Property property, float value) {
set(property, new Float(value));
}
public void setInt(Property property, int value) {
set(property, new Integer(value));
}
public void setLong(Property property, long value) {
set(property, new Long(value));
}
public void setShort(Property property, short value) {
set(property, new Short(value));
}
public void setBytes(Property property, byte[] value) {
set(property, value);
}
public void setBigDecimal(Property property, BigDecimal value) {
set(property, value);
}
public void setBigInteger(Property property, BigInteger value) {
set(property, value);
}
public void setDataObject(Property property, DataObject value) {
set(property, value);
}
public void setDate(Property property, Date value) {
set(property, value);
}
public void setString(Property property, String value) {
set(property, value);
}
public void setList(Property property, List value) {
set(property, value);
}
public DataObject createDataObject(String propertyName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(Property property) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(Property property, Type type) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void delete() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataGraph getDataGraph() {
return DataObjectUtil.getDataGraph(this);
}
public Sequence getSequence() {
EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass());
return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null;
}
public List getInstanceProperties() {
return DataObjectUtil.getInstanceProperties(this);
}
public DataObject getRootObject() {
return DataObjectUtil.getRootObject(this);
}
public ChangeSummary getChangeSummary() {
// TODO: implement this method
throw new UnsupportedOperationException();
}
public void detach() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
//DataObjectUtil.detach(this);
}
public Property getProperty(String propertyName) {
return DataObjectUtil.getProperty(this, propertyName);
}
*/
} //AttributeImpl

View file

@ -0,0 +1,813 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.util.BasicSequence;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.change.ChangeDescription;
import org.eclipse.emf.ecore.change.FeatureChange;
import org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl;
import org.eclipse.emf.ecore.change.util.ChangeRecorder;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
import org.eclipse.emf.ecore.util.DelegatingFeatureMap;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import commonj.sdo.ChangeSummary;
import commonj.sdo.ChangeSummary.Setting;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EChange Summary</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.impl.ChangeSummaryImpl#getEDataGraph <em>EData Graph</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ChangeSummaryImpl extends ChangeDescriptionImpl implements ChangeSummary
{
/**
* The cached value of the '{@link #getEDataGraph() <em>EData Graph</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEDataGraph()
* @generated
* @ordered
*/
protected DataGraph eDataGraph;
protected DataObject dataObject = null;
protected SDOChangeRecorder changeRecorder = null;
protected Set cachedDeletedObjects = null;
protected List cachedCreatedObjects = null;
protected Map cachedSDOObjectChanges = null;
protected boolean isStale = false;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
protected ChangeSummaryImpl()
{
super();
cachedSDOObjectChanges = createThreadSafeMap();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.CHANGE_SUMMARY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isLogging()
{
return changeRecorder != null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataGraph getEDataGraph()
{
return eDataGraph;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetEDataGraph(DataGraph newEDataGraph, NotificationChain msgs)
{
DataGraph oldEDataGraph = eDataGraph;
eDataGraph = newEDataGraph;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, oldEDataGraph, newEDataGraph);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEDataGraph(DataGraph newEDataGraph)
{
if (newEDataGraph != eDataGraph) {
NotificationChain msgs = null;
if (eDataGraph != null)
msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs);
if (newEDataGraph != null)
msgs = ((InternalEObject)newEDataGraph).eInverseAdd(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs);
msgs = basicSetEDataGraph(newEDataGraph, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, newEDataGraph, newEDataGraph));
}
public DataObject getDataObject()
{
return dataObject;
}
public void setDataObject(DataObject newDataObject)
{
dataObject = newDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void beginLogging()
{
if (isLogging())
{
throw new IllegalStateException("Already logging");
}
getObjectsToAttach().clear();
getObjectChanges().clear();
getResourceChanges().clear();
oldContainmentInformation = null;
beginRecording();
// if (eNotificationRequired())
// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true));
}
/**
*
*/
private void beginRecording() {
changeRecorder = new SDOChangeRecorder();
if (eDataGraph != null)
{
changeRecorder.beginRecording(Collections.singleton(((DataGraphImpl)eDataGraph).getRootResource()));
}
else if (dataObject != null)
{
changeRecorder.beginRecording(Collections.singleton(dataObject));
}
else
{
throw new IllegalStateException("ChangeSummary not attached to any data objects");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void resumeLogging()
{
if (isLogging())
{
throw new IllegalStateException("Already logging");
}
oldContainmentInformation = null;
beginRecording();
// if (eNotificationRequired())
// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return getEDataGraph();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue)
{
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
setEDataGraph((DataGraph)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID)
{
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
setEDataGraph((DataGraph)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID)
{
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return eDataGraph != null;
}
return super.eIsSet(featureID);
}
protected void uncache()
{
cachedDeletedObjects = null;
cachedCreatedObjects = null;
cachedSDOObjectChanges.clear();
}
protected class SDOChangeRecorder extends ChangeRecorder
{
public SDOChangeRecorder()
{
super();
}
public void beginRecording(ChangeDescription changeDescription, Collection rootObjects)
{
uncache();
super.beginRecording(changeDescription, rootObjects);
}
protected ChangeDescription createChangeDescription()
{
return ChangeSummaryImpl.this;
}
protected FeatureChange createFeatureChange(EObject eObject, EStructuralFeature eStructuralFeature, Object value, boolean isSet)
{
Property property = (Property)eStructuralFeature;
if (property.isReadOnly())
{
if (((DataObject)eObject).getDataGraph() != null)
{
throw
new IllegalStateException
("The property '" + property.getName() + "' of type '" +
property.getContainingType().getName() + "' is read only");
}
}
return (FeatureChange)SDOFactory.eINSTANCE.createChangeSummarySetting(eStructuralFeature, value, isSet);
}
protected void consolidateChanges()
{
uncache();
isStale = false;
// TODO remove this fixup when https://bugs.eclipse.org/bugs/show_bug.cgi?id=177235 is
// available to us (i.e. we update to EMF 2.3) -- see Tuscany-1164
boolean isUncontainedRoot = dataObject != null
&& ((EObject)dataObject).eContainer() == null
&& ((EObject)dataObject).eResource() == null;
super.consolidateChanges();
if(isUncontainedRoot && changeDescription.getObjectsToAttach().contains(dataObject)) {
changeDescription.getObjectsToAttach().remove(dataObject);
}
}
protected void addAdapter(Notifier notifier)
{
if (!loadingTargets) return; // Optimize ChangeSummary to not record changes in newly created DOs
if (notifier instanceof DataObjectImpl)
((DataObjectImpl)notifier).setChangeRecorder(this);
else
super.addAdapter(notifier);
}
protected void removeAdapter(Notifier notifier)
{
if (notifier instanceof DataObjectImpl)
((DataObjectImpl)notifier).setChangeRecorder(null);
else
super.removeAdapter(notifier);
}
public void notifyChanged(Notification notification)
{
super.notifyChanged(notification);
Object notifier = notification.getNotifier();
if (notifier instanceof EObject)
{
cachedSDOObjectChanges.remove(notifier);
Object feature = notification.getFeature();
if (feature instanceof Property && ((Property)feature).isContainment())
{
cachedCreatedObjects = null;
cachedDeletedObjects = null;
oldContainmentInformation = null;
}
isStale = true;
}
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void endLogging()
{
if (!isLogging())
{
throw new IllegalStateException("Not currently logging");
}
changeRecorder.endRecording();
changeRecorder.dispose();
changeRecorder = null;
// if (eNotificationRequired())
// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, true, false));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isCreated(DataObject dataObject)
{
return getCachedCreatedObjects().contains(dataObject);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isDeleted(DataObject dataObject)
{
return getCachedDeletedObjects().contains(dataObject);
}
protected Set getCachedDeletedObjects()
{
if (cachedDeletedObjects == null)
{
if (isStale()) changeRecorder.consolidateChanges();
cachedDeletedObjects = new HashSet();
for (Iterator i = EcoreUtil.getAllContents(getObjectsToAttach()); i.hasNext(); )
{
cachedDeletedObjects.add(i.next());
}
}
return cachedDeletedObjects;
}
protected List getCachedCreatedObjects()
{
if (cachedCreatedObjects == null)
{
if (isStale()) changeRecorder.consolidateChanges();
cachedCreatedObjects = super.getObjectsToDetach();
}
return cachedCreatedObjects;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getChangedDataObjects()
{
EList result = new UniqueEList.FastCompare(getCachedDeletedObjects());
result.addAll(getCachedCreatedObjects());
for (Iterator i = getObjectChanges().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry)i.next();
result.add(entry.getKey());
}
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getOldValues(DataObject dataObject)
{
List sdoSettings = (List)cachedSDOObjectChanges.get(dataObject);
if (sdoSettings != null)
{
return sdoSettings;
}
if (isStale()) changeRecorder.consolidateChanges();
List settings = (List)getObjectChanges().get(dataObject);
if (settings == null)
{
settings = Collections.EMPTY_LIST;
}
else
{
for (int i = 0; i < settings.size(); i++)
{
FeatureChange change = (FeatureChange)settings.get(i);
EStructuralFeature feature = change.getFeature();
if (FeatureMapUtil.isFeatureMap(feature))
{
final List values = (List)change.getValue();
if (sdoSettings == null)
{
sdoSettings = new BasicEList(settings);
}
DelegatingFeatureMap featureMap = new DelegatingFeatureMap(((InternalEObject)dataObject), feature)
{
protected final List theList = values;
protected List delegateList()
{
return theList;
}
};
// create new settings and replace the setting for mixed feature
sdoSettings.set(i, SDOFactory.eINSTANCE.createChangeSummarySetting(feature, new BasicSequence(featureMap), change.isSet()));
// add all derived features
for (int k = 0; k < featureMap.size(); k++)
{
EStructuralFeature f = featureMap.getEStructuralFeature(k);
sdoSettings.add(SDOFactory.eINSTANCE.createChangeSummarySetting(f, featureMap.get(f, false), true));
}
}
}
}
sdoSettings = (sdoSettings != null) ? sdoSettings : settings;
cachedSDOObjectChanges.put(dataObject, sdoSettings);
return sdoSettings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isModified(DataObject dataObject)
{
return getObjectChanges().containsKey(dataObject) && !isDeleted(dataObject) && !isCreated(dataObject);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void summarize()
{
if (!isLogging())
{
throw new IllegalStateException("Not currently logging");
}
changeRecorder.summarize();
}
public Setting getOldValue(DataObject dataObject, Property property)
{
for (Iterator i = getOldValues(dataObject).iterator(); i.hasNext(); )
{
Setting setting = (Setting)i.next();
if (setting.getProperty() == property)
{
return setting;
}
}
return null;
}
public DataObject getOldContainer(DataObject dataObject)
{
return (DataObject)getOldContainer((EObject)dataObject);
}
public Property getOldContainmentProperty(DataObject dataObject)
{
return (Property)getOldContainmentFeature((EObject)dataObject);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Sequence getOldSequence(DataObject dataObject)
{
EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature((EClass)dataObject.getType());
if (mixedFeature != null)
{
return (Sequence)getOldValue(dataObject, (Property)mixedFeature).getValue();
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void undoChanges()
{
if (isLogging())
{
changeRecorder.summarize();
}
else
{
uncache();
}
apply();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DataGraph getDataGraph()
{
return getEDataGraph();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getChangedObjects() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
protected Map getOldContainmentInformation()
{
if (oldContainmentInformation == null)
{
if (isStale()) changeRecorder.consolidateChanges();
super.getOldContainmentInformation();
}
return oldContainmentInformation;
}
protected boolean isStale()
{
return isLogging() && isStale;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DataObject getRootObject()
{
if (eDataGraph != null)
{
return eDataGraph.getRootObject();
}
if (dataObject != null)
{
return dataObject;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
if (eDataGraph != null)
msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs);
return basicSetEDataGraph((DataGraph)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return basicSetEDataGraph(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
static protected boolean isContainmentReference(Object feature)
{
return feature instanceof EReference && ((EReference) feature).isContainment();
}
public DataObject getOldDataObject(DataObject dataObject)
{
//TODO: Fix this method. Currently, it has the side effect of undoing the unset of contained children references
// of root deleted objects - i.e., when featureChange.apply(oldDataObject) is called.
//
List changes = (List) getObjectChanges().get(dataObject);
if (changes == null)
return dataObject;
EObject oldDataObject = EcoreUtil.copy((EObject)dataObject);
for (Iterator fIter = changes.iterator(); fIter.hasNext(); )
{
FeatureChange featureChange = (FeatureChange)fIter.next();
featureChange.apply(oldDataObject);
EStructuralFeature feature = featureChange.getFeature();
if (FeatureMapUtil.isFeatureMap(feature))
{
FeatureMap featureMap = (FeatureMap) oldDataObject.eGet(feature);
for (int index = featureMap.size(); index != 0;)
if (isContainmentReference(featureMap.getEStructuralFeature(--index)))
featureMap.setValue(index, getOldDataObject((DataObject) featureMap.getValue(index)));
}
else if (isContainmentReference(feature))
{
Object value = oldDataObject.eGet(feature);
if (feature.isMany())
{
changes = (List) value;
for (int index = changes.size(); index != 0;)
changes.set(--index, getOldDataObject((DataObject) changes.get(index))); // Java pushes stack from left to right
}
else
oldDataObject.eSet(feature, getOldDataObject((DataObject) value));
}
}
return (DataObject)oldDataObject;
}
private static Class concurrentHashMapClazz = null;
private static boolean isThreadSafeMapClazzIdentified = false;
private Map createThreadSafeMap()
{
if (!isThreadSafeMapClazzIdentified)
{
concurrentHashMapClazz = loadConcurrentHashMapClazz();
isThreadSafeMapClazzIdentified = true;
}
Map threadSafeMap = null;
if (concurrentHashMapClazz == null)
{
threadSafeMap = Collections.synchronizedMap(new HashMap());
}
else
{
try
{
threadSafeMap = (Map)concurrentHashMapClazz.newInstance();
}
catch (InstantiationException e)
{
throw new RuntimeException(e);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
}
return threadSafeMap;
}
private static String[] concurrentHashMapClazzNames = new String[] {
"java.util.concurrent.ConcurrentHashMap",
"edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap"};
private static Class loadConcurrentHashMapClazz()
{
Class mapClazz = null;
for (int i = 0; i < concurrentHashMapClazzNames.length; i++)
{
String concurrentHashMapClazzName = concurrentHashMapClazzNames[i];
try
{
mapClazz = Class.forName(concurrentHashMapClazzName, true, Thread.currentThread().getContextClassLoader());
}
catch (Exception ignored) {}
if (mapClazz != null)
{
break;
}
try
{
mapClazz = Class.forName(concurrentHashMapClazzName);
}
catch (Exception ignored) {}
if (mapClazz != null)
{
break;
}
}
return mapClazz;
}
} //ChangeSummaryImpl

View file

@ -0,0 +1,113 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.Map;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.change.impl.FeatureChangeImpl;
import commonj.sdo.ChangeSummary;
import commonj.sdo.Property;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EChange Summary Setting</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class ChangeSummarySettingImpl extends FeatureChangeImpl implements ChangeSummary.Setting
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ChangeSummarySettingImpl()
{
super();
}
protected ChangeSummarySettingImpl(EStructuralFeature feature, Object value, boolean isSet)
{
super(feature, value, isSet);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.CHANGE_SUMMARY_SETTING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Object getValue()
{
EStructuralFeature feature = getFeature();
if (feature.isMany())
{
if (value == null)
{
EObject eObject = (EObject)((Map.Entry)eContainer()).getKey();
value = getListValue((EList)eObject.eGet(feature));
}
return value;
}
else
{
return super.getValue();
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Property getProperty()
{
return (Property)getFeature();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isSet()
{
return super.isSet();
}
} //EChangeSummarySettingImpl

View file

@ -0,0 +1,830 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.helper.TypeHelperImpl;
import org.apache.tuscany.sdo.lib.SDOObjectInputStream;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import commonj.sdo.ChangeSummary;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.helper.TypeHelper;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EData Graph</b></em>'.
* @extends DataGraph, Adapter, Serializable
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.impl.DataGraphImpl#getResourceSet <em>Resource Set</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.DataGraphImpl#getRootResource <em>Root Resource</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.DataGraphImpl#getEChangeSummary <em>EChange Summary</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.DataGraphImpl#getERootObject <em>ERoot Object</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DataGraphImpl extends EObjectImpl implements DataGraph, Adapter, Serializable
{
/**
* The default value of the '{@link #getResourceSet() <em>Resource Set</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResourceSet()
* @generated
* @ordered
*/
protected static final ResourceSet RESOURCE_SET_EDEFAULT = null;
/**
* The cached value of the '{@link #getResourceSet() <em>Resource Set</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResourceSet()
* @generated
* @ordered
*/
protected ResourceSet resourceSet = RESOURCE_SET_EDEFAULT;
/**
* The default value of the '{@link #getRootResource() <em>Root Resource</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRootResource()
* @generated
* @ordered
*/
protected static final Resource ROOT_RESOURCE_EDEFAULT = null;
/**
* The cached value of the '{@link #getEChangeSummary() <em>EChange Summary</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEChangeSummary()
* @generated
* @ordered
*/
protected ChangeSummary eChangeSummary;
/**
* The cached value of the '{@link #getERootObject() <em>ERoot Object</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getERootObject()
* @generated
* @ordered
*/
protected EObject eRootObject;
/**
* The cached extended metadata to wrap the resource set's package registry.
*/
protected ExtendedMetaData extendedMetaData;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataGraphImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.DATA_GRAPH;
}
public boolean isAdapterForType(Object type)
{
return type == DataGraph.class;
}
public void notifyChanged(Notification msg)
{
}
public Notifier getTarget()
{
return getResourceSet();
}
public void setTarget(Notifier newTarget)
{
}
protected ExtendedMetaData getExtendedMetaData()
{
if (extendedMetaData == null)
{
getResourceSet();
}
return extendedMetaData;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public ResourceSet getResourceSet()
{
if (resourceSet == null)
{
if (eResource() != null)
{
resourceSet = eResource().getResourceSet();
}
if (resourceSet == null)
{
resourceSet = createResourceSet();
}
initializeResourceSet(resourceSet);
}
return resourceSet;
}
protected ResourceSet createResourceSet()
{
return DataObjectUtil.createResourceSet();
}
protected Resource createRootResource()
{
Resource result = resourceSet.createResource(URI.createURI("root.xml"));
result.getContents().clear();
return result;
}
protected Resource createChangeSummaryResource()
{
Resource result = resourceSet.createResource(URI.createURI("change-summary.xml"));
result.getContents().clear();
return result;
}
protected void initializeResourceSet(ResourceSet resourceSet)
{
if (resourceSet == null)
{
extendedMetaData = null;
}
else
{
extendedMetaData = new BasicExtendedMetaData(resourceSet.getPackageRegistry());
resourceSet.eAdapters().add(this);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setResourceSetGen(ResourceSet newResourceSet)
{
ResourceSet oldResourceSet = resourceSet;
resourceSet = newResourceSet;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__RESOURCE_SET, oldResourceSet, resourceSet));
}
public void setResourceSet(ResourceSet newResourceSet)
{
if (resourceSet != null)
{
resourceSet.eAdapters().remove(this);
}
setResourceSetGen(newResourceSet);
initializeResourceSet(newResourceSet);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Resource getRootResource()
{
if (eRootObject == null)
{
Resource result = getResourceSet().getResource(URI.createURI("root.xml"), false);
if (result == null)
{
result = createRootResource();
}
return result;
}
else
{
return eRootObject.eResource();
}
}
public Resource getDataGraphResource()
{
Resource result = eResource();
if (result == null)
{
result = getResourceSet().createResource(URI.createURI("all.datagraph"));
result.getContents().add(this);
}
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeSummary getEChangeSummary()
{
return eChangeSummary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetEChangeSummary(ChangeSummary newEChangeSummary, NotificationChain msgs)
{
ChangeSummary oldEChangeSummary = eChangeSummary;
eChangeSummary = newEChangeSummary;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, oldEChangeSummary, newEChangeSummary);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEChangeSummary(ChangeSummary newEChangeSummary)
{
if (newEChangeSummary != eChangeSummary) {
NotificationChain msgs = null;
if (eChangeSummary != null)
msgs = ((InternalEObject)eChangeSummary).eInverseRemove(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs);
if (newEChangeSummary != null)
msgs = ((InternalEObject)newEChangeSummary).eInverseAdd(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs);
msgs = basicSetEChangeSummary(newEChangeSummary, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, newEChangeSummary, newEChangeSummary));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EObject getERootObject()
{
return eRootObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setERootObjectGen(EObject newERootObject)
{
EObject oldERootObject = eRootObject;
eRootObject = newERootObject;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__EROOT_OBJECT, oldERootObject, eRootObject));
}
public void setERootObject(EObject newERootObject)
{
// If there is a resource set already...
//
if (resourceSet != null)
{
// Get the root resource and if there's a root object in it already, clear it.
// Then set the root object and add it to the root resource.
//
List contents = getRootResource().getContents();
if (eRootObject != null)
{
contents.clear();
}
setERootObjectGen(newERootObject);
if (newERootObject != null)
{
contents.add(newERootObject);
}
}
else
{
// Set the root object and see if it has a resource we can reuse.
//
setERootObjectGen(newERootObject);
Resource rootResource = newERootObject.eResource();
if (rootResource != null)
{
// If there is no resource set
//
if (rootResource.getResourceSet() == null)
{
// Demand create one and add this resource to it.
//
getResourceSet().getResources().add(rootResource);
}
else
{
// Reuse the existing resource set.
//
setResourceSet(rootResource.getResourceSet());
}
}
else
{
// Demand create the resource set and the root resource, and add to it's contents.
//
getResourceSet();
createRootResource().getContents().add(newERootObject);
}
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EClassifier getEClassifier(String namespaceURI, String typeName)
{
ExtendedMetaData extendedMetaData = getExtendedMetaData();
EPackage ePackage = extendedMetaData.getPackage(namespaceURI);
if (ePackage != null)
{
EClassifier eClassifier = ePackage.getEClassifier(typeName);
if (eClassifier == null)
{
eClassifier = extendedMetaData.getType(ePackage, typeName);
}
return eClassifier;
}
else
{
return null;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Type getType(String namespaceURI, String typeName)
{
return TypeHelper.INSTANCE.getType(namespaceURI, typeName);
//EClassifier eClassifier = getEClassifier(namespaceURI, typeName);
//return eClassifier == null ? null : SDOUtil.getType(eClassifier);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID) {
case SDOPackage.DATA_GRAPH__RESOURCE_SET:
return getResourceSet();
case SDOPackage.DATA_GRAPH__ROOT_RESOURCE:
return getRootResource();
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
return getEChangeSummary();
case SDOPackage.DATA_GRAPH__EROOT_OBJECT:
return getERootObject();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue)
{
switch (featureID) {
case SDOPackage.DATA_GRAPH__RESOURCE_SET:
setResourceSet((ResourceSet)newValue);
return;
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
setEChangeSummary((ChangeSummary)newValue);
return;
case SDOPackage.DATA_GRAPH__EROOT_OBJECT:
setERootObject((EObject)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID)
{
switch (featureID) {
case SDOPackage.DATA_GRAPH__RESOURCE_SET:
setResourceSet(RESOURCE_SET_EDEFAULT);
return;
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
setEChangeSummary((ChangeSummary)null);
return;
case SDOPackage.DATA_GRAPH__EROOT_OBJECT:
setERootObject((EObject)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID)
{
switch (featureID) {
case SDOPackage.DATA_GRAPH__RESOURCE_SET:
return RESOURCE_SET_EDEFAULT == null ? resourceSet != null : !RESOURCE_SET_EDEFAULT.equals(resourceSet);
case SDOPackage.DATA_GRAPH__ROOT_RESOURCE:
return ROOT_RESOURCE_EDEFAULT == null ? getRootResource() != null : !ROOT_RESOURCE_EDEFAULT.equals(getRootResource());
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
return eChangeSummary != null;
case SDOPackage.DATA_GRAPH__EROOT_OBJECT:
return eRootObject != null;
}
return super.eIsSet(featureID);
}
public DataObject createEDataObject(Type type)
{
return DataObjectUtil.create(type);
}
public DataObject getRootObject()
{
return (DataObject)getERootObject();
}
public DataObject createRootObject(String namespaceURI, String typeName)
{
Type type = getType(namespaceURI, typeName);
if (type == null) {
throw new IllegalArgumentException(
"createRootObject given invalid parameters: getType("+
namespaceURI+", "+typeName+") returned null type");
}
if (getERootObject() != null) {
throw new IllegalStateException(
"createRootObject was called when a root object already exists");
}
DataObject dataObject = DataObjectUtil.create(type);
setERootObject((EObject)dataObject);
return dataObject;
}
public DataObject createRootObject(Type type)
{
if (type == null) {
throw new IllegalArgumentException(
"createRootObject must be provided a non-null type");
}
if (getERootObject() != null) {
throw new IllegalStateException(
"createRootObject was called when a root object already exists");
}
DataObject dataObject = DataObjectUtil.create(type);
setERootObject((EObject)dataObject);
return dataObject;
}
public ChangeSummary getChangeSummary()
{
//FB is this the right place to create the resources?
ChangeSummary changeSummary = getEChangeSummary();
if (changeSummary == null)
{
getRootResource();
changeSummary = createEChangeSummary();
setEChangeSummary(changeSummary);
}
if (((ChangeSummaryImpl)changeSummary).eResource() == null)
{
Resource changeSummaryResource = createChangeSummaryResource();
changeSummaryResource.getContents().add((EObject) changeSummary);
}
return changeSummary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
if (eChangeSummary != null)
msgs = ((InternalEObject)eChangeSummary).eInverseRemove(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs);
return basicSetEChangeSummary((ChangeSummary)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY:
return basicSetEChangeSummary(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
protected ChangeSummaryImpl createEChangeSummary()
{
return (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary();
}
public static class EDataGraphExternalizable implements Externalizable
{
protected DataGraphImpl eDataGraph;
//protected Map writeReplacements = new HashMap();
public EDataGraphExternalizable()
{
}
public EDataGraphExternalizable(DataGraphImpl eDataGraph)
{
this.eDataGraph = eDataGraph;
}
public void writeExternal(ObjectOutput objectOutput) throws IOException
{
ByteArrayOutputStream byteArrayOutputStream =
new ByteArrayOutputStream()
{
public byte [] toByteArray()
{
return super.toByteArray();
}
};
eDataGraph.getDataGraphResource().save(byteArrayOutputStream, null);
objectOutput.writeInt(byteArrayOutputStream.toByteArray().length);
objectOutput.write(byteArrayOutputStream.toByteArray());
}
public void readExternal(ObjectInput objectInput) throws IOException
{
int length = objectInput.readInt();
byte [] bytes = new byte [length];
objectInput.readFully(bytes);
ResourceSet resourceSet = createResourceSet();
Resource resource = resourceSet.createResource(URI.createURI("all.datagraph"));
HashMap map = null;
if(objectInput instanceof SDOObjectInputStream)
{
TypeHelperImpl th = (TypeHelperImpl)((SDOObjectInputStream)objectInput).getHelperContext().getTypeHelper();
map = new HashMap();
map.put("EXTENDED_META_DATA", th.getExtendedMetaData());
}
resource.load(new ByteArrayInputStream(bytes), map);
eDataGraph = (DataGraphImpl)resource.getContents().get(0);
}
protected ResourceSet createResourceSet()
{
return DataObjectUtil.createResourceSet();
}
/*
public Object getWriteReplacement(EObject eObject)
{
Object result = writeReplacements.get(eObject);
if (result == null)
{
result = new EDataObjectExternalizable(eDataGraph, eObject);
writeReplacements.put(eObject, result);
}
return result;
}
*/
protected Object readResolve()
{
return eDataGraph;
}
}
/*
public static class EDataObjectExternalizable implements Externalizable
{
protected EObject eObject;
protected DataGraphImpl eDataGraph;
public EDataObjectExternalizable()
{
}
public EDataObjectExternalizable(DataGraphImpl eDataGraph, EObject eObject)
{
this.eDataGraph = eDataGraph;
this.eObject = eObject;
}
public void writeExternal(ObjectOutput objectOutput) throws IOException
{
// Write the data object reference too.
String uri = eObject.eResource().getURIFragment(eObject);
objectOutput.writeUTF(uri);
objectOutput.writeObject(eDataGraph.getWriteReplacement());
}
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException
{
String uri = objectInput.readUTF();
eDataGraph = (DataGraphImpl)objectInput.readObject();
eObject = eDataGraph.getRootResource().getEObject(uri);
}
protected Object readResolve()
{
return eObject;
}
}
*/
protected EDataGraphExternalizable eDataGraphExternalizable;
//protected Adapter modificationTracker;
public Object getWriteReplacement()
{
if (eDataGraphExternalizable == null)
{
eDataGraphExternalizable = createEDataGraphExternalizable();
/*
getRootResource().setTrackingModification(true);
modificationTracker =
new AdapterImpl()
{
public void notifyChanged(Notification notification)
{
if (notification.getFeatureID(Resource.class) == Resource.RESOURCE__IS_MODIFIED && notification.getNewBooleanValue())
{
eDataGraphExternalizable = null;
modificationTracker = null;
((Resource)target).eAdapters().remove(this);
}
}
};
getRootResource().eAdapters().add(modificationTracker);
*/
}
return eDataGraphExternalizable;
}
protected EDataGraphExternalizable createEDataGraphExternalizable()
{
return new EDataGraphExternalizable(this);
}
/*
public Object getWriteReplacement(EObject eObject)
{
return ((EDataGraphExternalizable)getWriteReplacement()).getWriteReplacement(eObject);
}
*/
public Object writeReplace()
{
return getWriteReplacement();
}
public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
{
if (uriFragmentSegment.startsWith("@models."))
{
if (resourceSet != null)
{
int count = Integer.parseInt(uriFragmentSegment.substring(8));
for (Iterator i = resourceSet.getResources().iterator(); i.hasNext(); )
{
Resource ePackageResource = (Resource)i.next();
List resourceContents = ePackageResource.getContents();
if (resourceContents.size() == 1 && resourceContents.get(0) instanceof EPackage && count-- == 0)
{
return (EObject)resourceContents.get(0);
}
}
}
return null;
}
else
{
return super.eObjectForURIFragmentSegment(uriFragmentSegment);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (resourceSet: ");
result.append(resourceSet);
result.append(')');
return result.toString();
}
} //EDataGraphImpl

View file

@ -0,0 +1,537 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.List;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.helper.HelperContextImpl;
import org.apache.tuscany.sdo.util.BasicSequence;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.SettingDelegate;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
/**
* Base implementation of the SDO DataObject interface. Used as base class for generated (static) SDO classes
*/
public abstract class DataObjectBase extends ExtensibleDataObjectImpl
{
protected int OPPOSITE_FEATURE_BASE = EOPPOSITE_FEATURE_BASE;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Following methods should be proposed SPI for generated subclasses to use
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected boolean isNotifying()
{
return changeRecorder != null;
}
protected interface ChangeKind
{
int SET = Notification.SET;
int UNSET = Notification.UNSET;
int RESOLVE = Notification.RESOLVE;
}
/**
* notify methods for types: boolean, byte, char, double, float, int, long, short, and Object
*/
protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue));
}
protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue, isSetChange));
}
protected void notify(int changeKind, int property, byte oldByteValue, byte newByteValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldByteValue, newByteValue));
}
protected void notify(int changeKind, int property, byte oldByteValue, byte newByteValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldByteValue, newByteValue, isSetChange));
}
protected void notify(int changeKind, int property, char oldCharValue, char newCharValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldCharValue, newCharValue));
}
protected void notify(int changeKind, int property, char oldCharValue, char newCharValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldCharValue, newCharValue, isSetChange));
}
protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue));
}
protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue, isSetChange));
}
protected void notify(int changeKind, int property, float oldFloatValue, float newFloatValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldFloatValue, newFloatValue));
}
protected void notify(int changeKind, int property, float oldFloatValue, float newFloatValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldFloatValue, newFloatValue, isSetChange));
}
protected void notify(int changeKind, int property, int oldIntValue, int newIntValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue));
}
protected void notify(int changeKind, int property, int oldIntValue, int newIntValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue, isSetChange));
}
protected void notify(int changeKind, int property, long oldLongValue, long newLongValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldLongValue, newLongValue));
}
protected void notify(int changeKind, int property, long oldLongValue, long newLongValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldLongValue, newLongValue, isSetChange));
}
protected void notify(int changeKind, int property, short oldShortValue, short newShortValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldShortValue, newShortValue));
}
protected void notify(int changeKind, int property, short oldShortValue, short newShortValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldShortValue, newShortValue, isSetChange));
}
protected void notify(int changeKind, int property, Object oldValue, Object newValue)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue));
}
protected void notify(int changeKind, int property, Object oldValue, Object newValue, boolean isSetChange)
{
eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue, isSetChange));
}
public interface ListKind
{
int CONTAINMENT = 0;
int CONTAINMENT_UNSETTABLE = 1;
int CONTAINMENT_RESOLVING = 2;
int CONTAINMENT_RESOLVING_UNSETTABLE = 3;
int CONTAINMENT_INVERSE = 4;
int CONTAINMENT_INVERSE_UNSETTABLE = 5;
int CONTAINMENT_INVERSE_RESOLVING = 6;
int CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE = 7;
int NONCONTAINMENT = 8;
int NONCONTAINMENT_UNSETTABLE = 9;
int NONCONTAINMENT_RESOLVING = 10;
int NONCONTAINMENT_RESOLVING_UNSETTABLE = 11;
int NONCONTAINMENT_INVERSE = 12;
int NONCONTAINMENT_INVERSE_UNSETTABLE = 13;
int NONCONTAINMENT_MANYINVERSE = 14;
int NONCONTAINMENT_MANYINVERSE_UNSETTABLE = 15;
int NONCONTAINMENT_INVERSE_RESOLVING = 16;
int NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE = 17;
int NONCONTAINMENT_MANYINVERSE_RESOLVING = 18;
int NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE = 19;
int DATATYPE = 20;
int DATATYPE_UNSETTABLE = 21;
int DATATYPE_UNIQUE = 22;
int DATATYPE_UNIQUE_UNSETTABLE = 23;
int BASIC = 24;
}
/**
* @deprecated
*/
protected List createPropertyList(int listKind, Class dataClass, int property)
{
return createPropertyList(listKind, dataClass, property, 0);
}
protected List createPropertyList(int listKind, Class dataClass, int property, int reverseProperty)
{
switch (listKind)
{
case ListKind.CONTAINMENT:
return new EObjectContainmentEList(dataClass, this, property);
case ListKind.CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE:
return new EObjectContainmentWithInverseEList.Unsettable.Resolving(dataClass, this, property, reverseProperty);
case ListKind.CONTAINMENT_INVERSE_RESOLVING:
return new EObjectContainmentWithInverseEList.Resolving(dataClass, this, property, reverseProperty);
case ListKind.CONTAINMENT_INVERSE_UNSETTABLE:
return new EObjectContainmentWithInverseEList.Unsettable(dataClass, this, property, reverseProperty);
case ListKind.CONTAINMENT_INVERSE:
return new EObjectContainmentWithInverseEList(dataClass, this, property, reverseProperty);
case ListKind.CONTAINMENT_RESOLVING_UNSETTABLE:
return new EObjectContainmentEList.Unsettable.Resolving(dataClass, this, property);
case ListKind.CONTAINMENT_RESOLVING:
return new EObjectContainmentEList.Resolving(dataClass, this, property);
case ListKind.CONTAINMENT_UNSETTABLE:
return new EObjectContainmentEList.Unsettable(dataClass, this, property);
case ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE:
return new EObjectWithInverseResolvingEList.Unsettable.ManyInverse(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING:
return new EObjectWithInverseResolvingEList.ManyInverse(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE:
return new EObjectWithInverseResolvingEList.Unsettable(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_INVERSE_RESOLVING:
return new EObjectWithInverseResolvingEList(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_MANYINVERSE_UNSETTABLE:
return new EObjectWithInverseEList.Unsettable.ManyInverse(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_MANYINVERSE:
return new EObjectWithInverseEList.ManyInverse(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_INVERSE_UNSETTABLE:
return new EObjectWithInverseEList.Unsettable(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_INVERSE:
return new EObjectWithInverseEList(dataClass, this, property, reverseProperty);
case ListKind.NONCONTAINMENT_RESOLVING_UNSETTABLE:
return new EObjectResolvingEList.Unsettable(dataClass, this, property);
case ListKind.NONCONTAINMENT_RESOLVING:
return new EObjectResolvingEList(dataClass, this, property);
case ListKind.NONCONTAINMENT_UNSETTABLE:
return new EObjectEList.Unsettable(dataClass, this, property);
case ListKind.NONCONTAINMENT:
return new EObjectEList(dataClass, this, property);
case ListKind.DATATYPE_UNIQUE_UNSETTABLE:
return new EDataTypeUniqueEList.Unsettable(dataClass, this, property);
case ListKind.DATATYPE_UNIQUE:
return new EDataTypeUniqueEList(dataClass, this, property);
case ListKind.DATATYPE_UNSETTABLE:
return new EDataTypeEList.Unsettable(dataClass, this, property);
case ListKind.DATATYPE:
return new EDataTypeEList(dataClass, this, property);
}
return null;
}
protected BasicSequence createSequence(int property) {
return new BasicSequence(new BasicFeatureMap(this, property));
}
protected Sequence createSequence(Sequence sequence, Type type, int propertyIndex) {
return new BasicSequence((FeatureMap.Internal)(EList<?>)((FeatureMap.Internal.Wrapper)sequence).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex)));
}
protected void createChangeSummary(int property) {
ChangeSummaryImpl changeSummary = (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary();
set(property, changeSummary);
changeSummary.setDataObject(this);
}
/*
* get the value of the type's property at propertyIndex via the sequence
* @param seq
* @param type
* @param propertyIndex
* @return
*/
protected Object get(Sequence seq, Type type, int propertyIndex) {
return ((FeatureMap.Internal.Wrapper)seq).featureMap().get(((EClass)type).getEStructuralFeature(propertyIndex), true);
}
protected List getList(Sequence seq, Type type, int propertyIndex) {
return ((FeatureMap.Internal.Wrapper)seq).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex));
}
protected void set(Sequence seq, Type type, int propertyIndex, Object newValue) {
((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(((EClass)type).getEStructuralFeature(propertyIndex), newValue);
}
protected void unset(Sequence seq, Type type, int propertyIndex) {
((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).clear(((EClass)type).getEStructuralFeature(propertyIndex));
}
protected boolean isSet(Sequence seq, Type type, int propertyIndex) {
return !((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).isEmpty(((EClass)type).getEStructuralFeature(propertyIndex));
}
protected boolean isSequenceEmpty(Sequence sequence) {
return ((FeatureMap.Internal.Wrapper)sequence).featureMap().isEmpty();
}
protected void setSequence(Sequence seq, Object newValue) {
((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(newValue);
}
protected void unsetSequence(Sequence seq) {
((FeatureMap.Internal.Wrapper)seq).featureMap().clear();
}
protected ChangeContext basicAdd(Sequence seq, Type type, int propertyIndex, Object newValue, ChangeContext changeContext) {
ChangeContextImpl changeContextImpl = (ChangeContextImpl)changeContext;
changeContextImpl.notificationChain = ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).basicAdd(((EClass)type).getEStructuralFeature(propertyIndex), newValue, changeContextImpl.notificationChain);
return changeContextImpl;
}
private ChangeContextImpl initializeChangeContext(ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl;
if (changeContext == null)
{
changeContextImpl = new ChangeContextImpl(null);
} else
{
changeContextImpl = (ChangeContextImpl)changeContext;
}
return changeContextImpl;
}
protected interface ChangeContext {}
protected ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = super.eInverseRemove((InternalEObject)otherEnd, propertyIndex, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected ChangeContext inverseAdd(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = super.eInverseAdd((InternalEObject)otherEnd, propertyIndex, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected ChangeContext inverseRemove(Object thisEnd, Object otherEnd, int propertyIndex, Class baseClass, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = ((InternalEObject)thisEnd).eInverseRemove((InternalEObject)otherEnd, propertyIndex, baseClass, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected ChangeContext inverseAdd(Object thisEnd, Object otherEnd, int propertyIndex, Class baseClass, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = ((InternalEObject)thisEnd).eInverseAdd((InternalEObject)otherEnd, propertyIndex, baseClass, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected ChangeContext addNotification(Object notifier, int eventType, int featureID, Object oldValue, Object newValue, boolean isSetChanged, ChangeContext changeContext)
{
ENotificationImpl notification = new ENotificationImpl((InternalEObject)notifier, eventType, featureID, oldValue, newValue, isSetChanged );
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
if (changeContextImpl.notificationChain == null) changeContextImpl.notificationChain = notification; else changeContextImpl.notificationChain.add(notification);
return changeContextImpl;
}
protected ChangeContext addNotification(Object notifier, int eventType, int featureID, Object oldValue, Object newValue, ChangeContext changeContext)
{
ENotificationImpl notification = new ENotificationImpl((InternalEObject)notifier, eventType, featureID, oldValue, newValue);
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
if (changeContextImpl.notificationChain == null) changeContextImpl.notificationChain = notification; else changeContextImpl.notificationChain.add(notification);
return changeContextImpl;
}
protected ChangeContext removeFromList(List propertyList, Object objectToRemove, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = ((InternalEList)propertyList).basicRemove(objectToRemove, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected ChangeContext removeFromSequence(Sequence sequence, Object otherEnd, ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
changeContextImpl.notificationChain = ((InternalEList)((FeatureMap.Internal.Wrapper)sequence).featureMap()).basicRemove(otherEnd, changeContextImpl.notificationChain);
return changeContextImpl;
}
protected void dispatch(ChangeContext changeContext)
{
ChangeContextImpl changeContextImpl = initializeChangeContext(changeContext);
if (changeContextImpl.notificationChain != null)
{
changeContextImpl.notificationChain.dispatch();
}
}
protected boolean isProxy() // FB TODO : regen models and then remove this method
{
return eIsProxy();
}
protected boolean isProxy(Object object)
{
return ((EObject)object).eIsProxy();
}
protected Object resolveProxy(Object proxy)
{
Resource resource = this.eResource();
ResourceSet resourceSet = resource != null ? resource.getResourceSet() : null;
if (resourceSet != null) return EcoreUtil.resolve((EObject)proxy, resourceSet);
URI proxyURI = ((InternalEObject)proxy).eProxyURI();
if (proxyURI != null)
{
EPackage ePackage = HelperContextImpl.getBuiltInModelRegistry().getEPackage(proxyURI.trimFragment().toString());
if (ePackage != null)
{
resource = ePackage.eResource();
if (resource != null)
{
return resource.getEObject(proxyURI.fragment().toString());
}
}
}
return null;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Following methods override EMF methods to work with pure SDO generated subclasses
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public EClass eStaticClass()
{
return (EClass)getStaticType();
}
public Type getStaticType() // must be overridden in subclasses
{
throw new UnsupportedOperationException();
}
public int eStaticFeatureCount()
{
return getStaticPropertyCount();
}
public int getStaticPropertyCount() // must be overridden in subclasses
{
throw new UnsupportedOperationException();
}
protected int internalConvertIndex(int internalIndex)
{
return internalIndex;
}
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
Object result = get(internalConvertIndex(featureID), resolve);
if (coreType)
{
if (result instanceof FeatureMap.Internal.Wrapper) result = ((FeatureMap.Internal.Wrapper)result).featureMap();
}
return result;
}
public void eSet(int featureID, Object newValue)
{
set(internalConvertIndex(featureID), newValue);
}
public void eUnset(int featureID)
{
unset(internalConvertIndex(featureID));
}
public boolean eIsSet(int featureID)
{
return isSet(internalConvertIndex(featureID));
}
private class ChangeContextImpl implements ChangeContext
{
protected NotificationChain notificationChain;
public ChangeContextImpl(NotificationChain notificationChain) {
this.notificationChain = notificationChain;
}
}
//FB TODO ... review this? ... what about eInverseAdd?
public NotificationChain eInverseRemove(InternalEObject otherEnd, int internalIndex, NotificationChain msgs)
{
return ((ChangeContextImpl)inverseRemove(otherEnd, internalConvertIndex(internalIndex), new ChangeContextImpl(msgs))).notificationChain;
}
public String toString()
{
StringBuffer result = new StringBuffer(getClass().getName());
result.append('@');
result.append(Integer.toHexString(hashCode()));
if (eIsProxy())
{
result.append(" (proxyURI: ");
result.append(eProxyURI());
result.append(')');
}
return result.toString();
}
} //DataObjectBase

View file

@ -0,0 +1,791 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.Collections;
import java.util.List;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.impl.EDataTypeImpl;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import java.lang.Class;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class DataTypeImpl extends EDataTypeImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected EClass eStaticClass()
{
return SDOPackage.eINSTANCE.getDataType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String getURI()
{
return getEPackage().getNsURI();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
public Class getInstanceClass() {
// TODO: verify!
return super.getInstanceClass();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isDataType()
{
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isOpen()
{
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isSequenced()
{
return false;
}
protected List aliasNames = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getAliasNames()
{
if (aliasNames == null)
{
aliasNames = DataObjectUtil.getAliasNames(this);
}
return aliasNames;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getDeclaredProperties()
{
return Collections.EMPTY_LIST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getProperties()
{
return Collections.EMPTY_LIST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getBaseTypes()
{
EDataType dataType = ExtendedMetaData.INSTANCE.getBaseType(this);
if (dataType == null)
{
return Collections.EMPTY_LIST;
}
else
{
return Collections.singletonList(dataType);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Property getProperty(String propertyName)
{
return null;
}
public List getInstanceProperties() {
return DataObjectUtil.getMetaObjectInstanceProperties(this);
}
public Object get(Property property) {
return DataObjectUtil.getMetaObjectInstanceProperty(this, property);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// org.apache.tuscany.sdo.model.Type method implementations
/////////////////////////////////////////////////////////////////////////////////////////////////////////
public List getBaseType() {
return this.getBaseTypes();
}
public List getProperty() {
return this.getProperties();
}
public List getAliasName() {
return this.getAliasNames();
}
public Sequence getAny() {
throw new UnsupportedOperationException();
}
public Sequence getAnyAttribute() {
throw new UnsupportedOperationException();
}
public boolean isAbstract()
{
return false;
}
public void setAbstract(boolean value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetAbstract() {
return false;
}
public void unsetAbstract() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public void setDataType(boolean value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public void unsetDataType() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetDataType() {
return true;
}
public void setOpen(boolean value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public void unsetOpen() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetOpen() {
return false;
}
public void setSequenced(boolean value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public void unsetSequenced() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetSequenced() {
return false;
}
public void unsetName()
{
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetName()
{
return true;
}
public void unsetUri()
{
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSetUri()
{
return true;
}
public void setUri(String value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public String getUri() {
return getURI();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// DataObject method implementations
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
public Object get(int propertyIndex) {
Object ret = DataObjectUtil.get(this, propertyIndex);
return (ret != null) ?
ret : eGet(propertyIndex, true, false);
}
public void set(int propertyIndex, Object value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSet(int propertyIndex) {
return eIsSet(propertyIndex);
}
public void unset(int propertyIndex) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public Object get(Property property) {
Object ret = DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID());
return (ret != null) ?
ret : eGet((EStructuralFeature)property, true, false);
}
public void set(Property property, Object value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSet(Property property) {
return eIsSet((EStructuralFeature)property);
}
public void unset(Property property) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject getContainer() {
return (DataObject)eContainer();
}
public Property getContainmentProperty() {
return (Property)eContainmentFeature();
}
public Type getType() {
return (Type)ModelPackageImpl.eINSTANCE.getType();
}
// Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil
public Object get(String path) {
return DataObjectUtil.get(this, path);
}
public void set(String path, Object value) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean isSet(String path) {
return DataObjectUtil.isSet(this, path);
}
public void unset(String path) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public boolean getBoolean(String path) {
return DataObjectUtil.getBoolean(get(path));
}
public byte getByte(String path) {
return DataObjectUtil.getByte(get(path));
}
public char getChar(String path) {
return DataObjectUtil.getChar(get(path));
}
public double getDouble(String path) {
return DataObjectUtil.getDouble(get(path));
}
public float getFloat(String path) {
return DataObjectUtil.getFloat(get(path));
}
public int getInt(String path) {
return DataObjectUtil.getInt(get(path));
}
public long getLong(String path) {
return DataObjectUtil.getLong(get(path));
}
public short getShort(String path) {
return DataObjectUtil.getShort(get(path));
}
public byte[] getBytes(String path) {
return DataObjectUtil.getBytes(get(path));
}
public BigDecimal getBigDecimal(String path) {
return DataObjectUtil.getBigDecimal(get(path));
}
public BigInteger getBigInteger(String path) {
return DataObjectUtil.getBigInteger(get(path));
}
public DataObject getDataObject(String path) {
return (DataObject)get(path);
}
public Date getDate(String path) {
return DataObjectUtil.getDate(get(path));
}
public String getString(String path) {
return DataObjectUtil.getString(get(path));
}
public List getList(String path) {
return (List)get(path);
}
public Sequence getSequence(String path) {
return (Sequence)get(path);
}
public void setBoolean(String path, boolean value) {
set(path, new Boolean(value));
}
public void setByte(String path, byte value) {
set(path, new Byte(value));
}
public void setChar(String path, char value) {
set(path, new Character(value));
}
public void setDouble(String path, double value) {
set(path, new Double(value));
}
public void setFloat(String path, float value) {
set(path, new Float(value));
}
public void setInt(String path, int value) {
set(path, new Integer(value));
}
public void setLong(String path, long value) {
set(path, new Long(value));
}
public void setShort(String path, short value) {
set(path, new Short(value));
}
public void setBytes(String path, byte[] value) {
set(path, value);
}
public void setBigDecimal(String path, BigDecimal value) {
set(path, value);
}
public void setBigInteger(String path, BigInteger value) {
set(path, value);
}
public void setDataObject(String path, DataObject value) {
set(path, value);
}
public void setDate(String path, Date value) {
set(path, value);
}
public void setString(String path, String value) {
set(path, value);
}
public void setList(String path, List value) {
set(path, value);
}
public boolean getBoolean(int propertyIndex) {
return DataObjectUtil.getBoolean(this, propertyIndex);
}
public byte getByte(int propertyIndex) {
return DataObjectUtil.getByte(this, propertyIndex);
}
public char getChar(int propertyIndex) {
return DataObjectUtil.getChar(this, propertyIndex);
}
public double getDouble(int propertyIndex) {
return DataObjectUtil.getDouble(this, propertyIndex);
}
public float getFloat(int propertyIndex) {
return DataObjectUtil.getFloat(this, propertyIndex);
}
public int getInt(int propertyIndex) {
return DataObjectUtil.getInt(this, propertyIndex);
}
public long getLong(int propertyIndex) {
return DataObjectUtil.getLong(this, propertyIndex);
}
public short getShort(int propertyIndex) {
return DataObjectUtil.getShort(this, propertyIndex);
}
public byte[] getBytes(int propertyIndex) {
return DataObjectUtil.getBytes(this, propertyIndex);
}
public BigDecimal getBigDecimal(int propertyIndex) {
return DataObjectUtil.getBigDecimal(this, propertyIndex);
}
public BigInteger getBigInteger(int propertyIndex) {
return DataObjectUtil.getBigInteger(this, propertyIndex);
}
public DataObject getDataObject(int propertyIndex) {
return DataObjectUtil.getDataObject(this, propertyIndex);
}
public Date getDate(int propertyIndex) {
return DataObjectUtil.getDate(this, propertyIndex);
}
public String getString(int propertyIndex) {
return DataObjectUtil.getString(this, propertyIndex);
}
public List getList(int propertyIndex) {
return DataObjectUtil.getList(this, propertyIndex);
}
public Sequence getSequence(int propertyIndex) {
return DataObjectUtil.getSequence(this, propertyIndex);
}
public void setBoolean(int propertyIndex, boolean value) {
set(propertyIndex, new Boolean(value));
}
public void setByte(int propertyIndex, byte value) {
set(propertyIndex, new Byte(value));
}
public void setChar(int propertyIndex, char value) {
set(propertyIndex, new Character(value));
}
public void setDouble(int propertyIndex, double value) {
set(propertyIndex, new Double(value));
}
public void setFloat(int propertyIndex, float value) {
set(propertyIndex, new Float(value));
}
public void setInt(int propertyIndex, int value) {
set(propertyIndex, new Integer(value));
}
public void setLong(int propertyIndex, long value) {
set(propertyIndex, new Long(value));
}
public void setShort(int propertyIndex, short value) {
set(propertyIndex, new Short(value));
}
public void setBytes(int propertyIndex, byte[] value) {
set(propertyIndex, value);
}
public void setBigDecimal(int propertyIndex, BigDecimal value) {
set(propertyIndex, value);
}
public void setBigInteger(int propertyIndex, BigInteger value) {
set(propertyIndex, value);
}
public void setDataObject(int propertyIndex, DataObject value) {
set(propertyIndex, value);
}
public void setDate(int propertyIndex, Date value) {
set(propertyIndex, value);
}
public void setString(int propertyIndex, String value) {
set(propertyIndex, value);
}
public void setList(int propertyIndex, List value) {
set(propertyIndex, value);
}
public boolean getBoolean(Property property) {
return DataObjectUtil.getBoolean(this, property);
}
public byte getByte(Property property) {
return DataObjectUtil.getByte(this, property);
}
public char getChar(Property property) {
return DataObjectUtil.getChar(this, property);
}
public double getDouble(Property property) {
return DataObjectUtil.getDouble(this, property);
}
public float getFloat(Property property) {
return DataObjectUtil.getFloat(this, property);
}
public int getInt(Property property) {
return DataObjectUtil.getInt(this, property);
}
public long getLong(Property property) {
return DataObjectUtil.getLong(this, property);
}
public short getShort(Property property) {
return DataObjectUtil.getShort(this, property);
}
public byte[] getBytes(Property property) {
return DataObjectUtil.getBytes(this, property);
}
public BigDecimal getBigDecimal(Property property) {
return DataObjectUtil.getBigDecimal(this, property);
}
public BigInteger getBigInteger(Property property) {
return DataObjectUtil.getBigInteger(this, property);
}
public DataObject getDataObject(Property property) {
return DataObjectUtil.getDataObject(this, property);
}
public Date getDate(Property property) {
return DataObjectUtil.getDate(this, property);
}
public String getString(Property property) {
return DataObjectUtil.getString(this, property);
}
public List getList(Property property) {
return DataObjectUtil.getList(this, property);
}
public Sequence getSequence(Property property) {
return DataObjectUtil.getSequence(this, property);
}
public void setBoolean(Property property, boolean value) {
set(property, new Boolean(value));
}
public void setByte(Property property, byte value) {
set(property, new Byte(value));
}
public void setChar(Property property, char value) {
set(property, new Character(value));
}
public void setDouble(Property property, double value) {
set(property, new Double(value));
}
public void setFloat(Property property, float value) {
set(property, new Float(value));
}
public void setInt(Property property, int value) {
set(property, new Integer(value));
}
public void setLong(Property property, long value) {
set(property, new Long(value));
}
public void setShort(Property property, short value) {
set(property, new Short(value));
}
public void setBytes(Property property, byte[] value) {
set(property, value);
}
public void setBigDecimal(Property property, BigDecimal value) {
set(property, value);
}
public void setBigInteger(Property property, BigInteger value) {
set(property, value);
}
public void setDataObject(Property property, DataObject value) {
set(property, value);
}
public void setDate(Property property, Date value) {
set(property, value);
}
public void setString(Property property, String value) {
set(property, value);
}
public void setList(Property property, List value) {
set(property, value);
}
public DataObject createDataObject(String propertyName) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject createDataObject(Property property) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataObject createDataObject(Property property, Type type) {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public void delete() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
public DataGraph getDataGraph() {
return DataObjectUtil.getDataGraph(this);
}
public Sequence getSequence() {
EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass());
return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null;
}
public List getInstanceProperties() {
return DataObjectUtil.getInstanceProperties(this);
}
public DataObject getRootObject() {
return DataObjectUtil.getRootObject(this);
}
public ChangeSummary getChangeSummary() {
// TODO: implement this method
throw new UnsupportedOperationException();
}
public void detach() {
throw new UnsupportedOperationException("Type is frozen and cannot be modified");
}
*/
} //DataTypeImpl

View file

@ -0,0 +1,216 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Dynamic Data Object</b></em>'.
* @extends EStructuralFeature.Internal.DynamicValueHolder
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class DynamicDataObjectImpl extends DataObjectImpl implements DataObject, EStructuralFeature.Internal.DynamicValueHolder
{
protected EClass eClass;
protected Object [] eSettings;
protected static final Object [] ENO_SETTINGS = new Object [0];
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DynamicDataObjectImpl()
{
super();
}
/**
* Creates a dynamic DataObject.
*/
public DynamicDataObjectImpl(EClass eClass)
{
super();
eSetClass(eClass);
Property csp = ((ClassImpl)eClass).getChangeSummaryProperty();
if (csp != null)
{
ChangeSummaryImpl changeSummary = (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary();
set(csp, changeSummary);
changeSummary.setDataObject(this);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.DYNAMIC_DATA_OBJECT;
}
protected int eStaticFeatureCount()
{
return 0;
}
public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature)
{
return eClass().getFeatureID(eStructuralFeature);
}
protected boolean eHasSettings()
{
return eSettings != null;
}
protected EStructuralFeature.Internal.DynamicValueHolder eSettings()
{
if (eSettings == null)
{
int size = eClass().getFeatureCount() - eStaticFeatureCount();
eSettings = size == 0 ? ENO_SETTINGS : new Object [size];
}
return this;
}
protected EClass eDynamicClass()
{
return eClass;
}
public EClass eClass()
{
return eClass;
}
public void eSetClass(EClass eClass)
{
this.eClass = eClass;
}
public Object dynamicGet(int dynamicFeatureID)
{
return eSettings[dynamicFeatureID];
}
public void dynamicSet(int dynamicFeatureID, Object value)
{
eSettings[dynamicFeatureID] = value;
}
public void dynamicUnset(int dynamicFeatureID)
{
eSettings[dynamicFeatureID] = null;
}
public Object eDynamicGet(int featureID, boolean resolve, boolean coreType)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eSettingDelegate(eFeature).dynamicGet(this, eSettings(), featureID, resolve, coreType);
}
else
{
return super.eDynamicGet(featureID, resolve, coreType);
}
}
public void eDynamicSet(int featureID, Object newValue)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
try {
eDynamicSet(featureID, eFeature, newValue);
} catch (IllegalArgumentException e) {
throw new UnsupportedOperationException(e.getMessage());
}
}
else
{
super.eDynamicSet(featureID, newValue);
}
}
public void eDynamicUnset(int featureID)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
try {
eDynamicUnset(featureID, eFeature);
} catch (IllegalArgumentException e) {
throw new UnsupportedOperationException(e.getMessage());
}
}
else
{
super.eDynamicUnset(featureID);
}
}
public boolean eDynamicIsSet(int featureID)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), featureID);
}
else
{
return super.eDynamicIsSet(featureID);
}
}
/**
* An EFactoryImpl that creates DynamicEDataObjectImpl instances.
*/
public static class FactoryImpl extends EFactoryImpl
{
public FactoryImpl()
{
}
public EObject basicCreate(EClass eClass)
{
return new DynamicDataObjectImpl(eClass);
}
}
} //DynamicDataObjectImpl

View file

@ -0,0 +1,91 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import commonj.sdo.DataObject;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Dynamic Store Data Object</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class DynamicStoreDataObjectImpl extends StoreDataObjectImpl implements DataObject
{
protected EClass eClass;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DynamicStoreDataObjectImpl()
{
super();
}
public DynamicStoreDataObjectImpl(InternalEObject.EStore eStore)
{
super(eStore);
}
public DynamicStoreDataObjectImpl(EClass eClass)
{
super(eClass);
}
public DynamicStoreDataObjectImpl(EClass eClass, InternalEObject.EStore eStore)
{
super(eClass, eStore);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.DYNAMIC_STORE_DATA_OBJECT;
}
protected EClass eDynamicClass()
{
return eClass;
}
public EClass eClass()
{
return eClass;
}
public void eSetClass(EClass eClass)
{
this.eClass = eClass;
}
} //DynamicStoreDataObjectImpl

View file

@ -0,0 +1,194 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.Collections;
import java.util.List;
//import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EEnumImpl;
import commonj.sdo.Property;
import commonj.sdo.Type;
import java.lang.Class;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Enum</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class EnumImpl extends EEnumImpl implements Type
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EnumImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected EClass eStaticClass()
{
return EcorePackage.eINSTANCE.getEEnum();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String getURI()
{
return getEPackage().getNsURI();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Class getInstanceClass() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isDataType()
{
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isOpen()
{
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isSequenced()
{
return false;
}
protected List aliasNames = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getAliasNames()
{
if (aliasNames == null)
{
aliasNames = DataObjectUtil.getAliasNames(this);
}
return aliasNames;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getDeclaredProperties()
{
return Collections.EMPTY_LIST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getProperties()
{
return Collections.EMPTY_LIST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getBaseTypes()
{
return Collections.EMPTY_LIST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Property getProperty(String propertyName)
{
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isAbstract()
{
return false;
}
public List getInstanceProperties()
{
throw new UnsupportedOperationException();
}
public Object get(Property property)
{
throw new UnsupportedOperationException();
}
} //EnumTypeImpl

View file

@ -0,0 +1,78 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.api.Event;
import org.eclipse.emf.common.notify.Notification;
import commonj.sdo.Property;
public class EventImpl implements Event {
protected Notification emfEvent;
protected Object notifier;
public EventImpl(Notification notification)
{
this.emfEvent = notification;
}
public Object getNotifier()
{
return notifier == null ? emfEvent.getNotifier() : notifier;
}
public int getEventType()
{
return emfEvent.getEventType();
}
public Property getProperty()
{
return (Property)emfEvent.getFeature();
}
public Object getOldValue()
{
return emfEvent.getOldValue();
}
public Object getNewValue()
{
return emfEvent.getNewValue();
}
public boolean wasSet()
{
return emfEvent.wasSet();
}
public boolean isTouch()
{
return emfEvent.isTouch();
}
public int getPosition()
{
return emfEvent.getPosition();
}
}

View file

@ -0,0 +1,267 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Extensible Data Object</b></em>'.
* @extends EStructuralFeature.Internal.DynamicValueHolder
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class ExtensibleDataObjectImpl extends DataObjectImpl implements DataObject, EStructuralFeature.Internal.DynamicValueHolder
{
protected EClass eClass;
protected Object [] eSettings;
protected static final Object [] ENO_SETTINGS = new Object [0];
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ExtensibleDataObjectImpl()
{
super();
}
/**
* Creates an extensible DataObject.
*/
public ExtensibleDataObjectImpl(EClass eClass)
{
super();
eSetClass(eClass);
Property csp = ((ClassImpl)eClass).getChangeSummaryProperty();
if (csp != null)
{
ChangeSummaryImpl changeSummary = (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary();
set(csp, changeSummary);
changeSummary.setDataObject(this);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.EXTENSIBLE_DATA_OBJECT;
}
public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature)
{
return eClass().getFeatureID(eStructuralFeature);
}
protected boolean eHasSettings()
{
return eSettings != null;
}
protected EStructuralFeature.Internal.DynamicValueHolder eSettings()
{
if (eSettings == null)
{
int size = eClass().getFeatureCount() - eStaticFeatureCount();
eSettings = size == 0 ? ENO_SETTINGS : new Object [size];
}
return this;
}
protected EClass eDynamicClass()
{
return eClass;
}
protected boolean isDynamic()
{
return (eClass != null);
}
public Object get(int featureID, boolean resolve)
{
return get(featureID, resolve, true);
}
public Object get(int featureID, boolean resolve, boolean coreType)
{
Object result = null;
if (isDynamic() || featureID >= eStaticFeatureCount())
{
result = super.eGet(featureID, resolve, coreType);
}
else
{
result = super.get(featureID);
}
return result;
}
public void set(int featureID, Object newValue)
{
if (isDynamic() || featureID >= eStaticFeatureCount())
{
super.eSet(featureID, newValue);
}
else
{
super.set(featureID, newValue);
}
}
public void unset(int featureID)
{
if (isDynamic() || featureID >= eStaticFeatureCount())
{
super.eUnset(featureID);
}
else
{
super.unset(featureID);
}
}
public boolean isSet(int featureID)
{
if (isDynamic() || featureID >= eStaticFeatureCount())
{
return super.eIsSet(featureID);
}
else
{
return super.isSet(featureID);
}
}
public EClass eClass()
{
return isDynamic() ? eClass : eStaticClass();
}
public void eSetClass(EClass eClass)
{
this.eClass = eClass;
}
public Object dynamicGet(int dynamicFeatureID)
{
return eSettings[dynamicFeatureID];
}
public void dynamicSet(int dynamicFeatureID, Object value)
{
eSettings[dynamicFeatureID] = value;
}
public void dynamicUnset(int dynamicFeatureID)
{
eSettings[dynamicFeatureID] = null;
}
public Object eDynamicGet(int featureID, boolean resolve, boolean coreType)
{
int dynamicFeatureID = featureID - eStaticFeatureCount();
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eSettingDelegate(eFeature).dynamicGet(this, eSettings(), dynamicFeatureID, resolve, coreType);
}
else
{
return super.eDynamicGet(dynamicFeatureID, resolve, coreType);
}
}
public void eDynamicSet(int featureID, Object newValue)
{
int dynamicFeatureID = featureID - eStaticFeatureCount();
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
eDynamicSet(dynamicFeatureID, eFeature, newValue);
}
else
{
super.eDynamicSet(dynamicFeatureID, newValue);
}
}
public void eDynamicUnset(int featureID)
{
int dynamicFeatureID = featureID - eStaticFeatureCount();
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
eDynamicUnset(dynamicFeatureID, eFeature);
}
else
{
super.eDynamicUnset(dynamicFeatureID);
}
}
public boolean eDynamicIsSet(int featureID)
{
int dynamicFeatureID = featureID - eStaticFeatureCount();
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), dynamicFeatureID);
}
else
{
return super.eDynamicIsSet(dynamicFeatureID);
}
}
/**
* An EFactoryImpl that creates ExtensibleDataObjectImpl instances.
*/
public static class FactoryImpl extends EFactoryImpl
{
public FactoryImpl()
{
}
public EObject basicCreate(EClass eClass)
{
return new ExtensibleDataObjectImpl(eClass);
}
}
} //ExtensibleDataObjectImpl

View file

@ -0,0 +1,368 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.impl.SDOFactoryImpl.SDOEcoreFactory;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EClassImpl;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Type;
/**
* Base class for generated (static) SDO factories
*/
public class FactoryBase extends EPackageImpl
{
public static final boolean IS_ATTRIBUTE = true;
protected FactoryBase(String namespaceURI, String namespacePrefix)
{
super(new SDOEFactoryImpl());
ecoreFactory = new SDOEcoreFactory();
int index = namespacePrefix.lastIndexOf(".");
setName(index != -1 ? namespacePrefix.substring(index + 1) : namespacePrefix);
setNsPrefix(namespacePrefix);
createResource(namespaceURI);
setNsURI(namespaceURI);
((SDOEFactoryImpl)getEFactoryInstance()).sdoFactory = this;
}
protected FactoryBase(String namespaceURI, String namespacePrefix, String interfacePackage)
{
super(new SDOEFactoryImpl());
ecoreFactory = new SDOEcoreFactory();
int index = interfacePackage.lastIndexOf(".");
setName(index != -1 ? interfacePackage.substring(index + 1) : interfacePackage);
setNsPrefix(namespacePrefix);
createResource(namespaceURI);
setNsURI(namespaceURI);
((SDOEFactoryImpl)getEFactoryInstance()).sdoFactory = this;
}
public DataObject create(int typeNumber)
{
return null;
}
public Object createFromString(int typeNumber, String stringValue)
{
return ((SDOEFactoryImpl)getEFactoryInstance()).createFromString(typeNumber, stringValue);
}
public String convertToString(int typeNumber, Object objectValue)
{
return ((SDOEFactoryImpl)getEFactoryInstance()).convertToString(typeNumber, objectValue);
}
protected Type createType(boolean isDataType, int typeNumber)
{
if (isDataType)
return (Type)createEDataType(typeNumber);
else
return (Type)createEClass(typeNumber);
}
protected void createProperty(boolean isDataType, Type containingType, int internalPropertyNumber)
{
if (isDataType)
createEAttribute((EClass)containingType, internalPropertyNumber);
else
createEReference((EClass)containingType, internalPropertyNumber);
}
/**
* @deprecated - use getLocalProperty instead, since getProperty causes
* caching of structural features.
*/
protected Property getProperty(Type type, int internalPropertyNumber)
{
return (Property)((EClass)type).getEAllStructuralFeatures().get(internalPropertyNumber);
}
protected Property getLocalProperty(Type type, int localPropertyIndex)
{
return (Property)((EClass)type).getEStructuralFeatures().get(localPropertyIndex);
}
protected void initializeType(Type type, Class instanceClass, String name)
{
initEClass((EClass)type, instanceClass, name, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
}
protected void initializeType(Type type, Class instanceClass, String name, boolean isAbstract)
{
initEClass((EClass)type, instanceClass, name, isAbstract, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
}
protected void initializeType(Type type, Class instanceClass, String name, boolean isSerializable, boolean isGenerated)
{
initEDataType((EDataType)type, instanceClass, name, isSerializable, isGenerated);
}
protected void initializeProperty(Property property, Type type, String name, String defaultValue, int lower, int upper, Class containerClass, boolean isReadonly, boolean isUnsettable, boolean isDerived)
{
initEAttribute((EAttribute)property, type != sequence ? (EClassifier)type : ecorePackage.getEFeatureMapEntry(), name, defaultValue, lower, upper, containerClass, isDerived, isDerived, !isReadonly, isUnsettable, !IS_ID, !IS_UNIQUE, isDerived, IS_ORDERED);
}
protected void initializeProperty(Property property, Type type, String name, String defaultValue, int lower, int upper, Class containerClass, boolean isReadonly, boolean isUnsettable, boolean isDerived, boolean isComposite, Property oppositeProperty)
{
initEReference((EReference)property, (EClassifier)type, (EReference)oppositeProperty, name, defaultValue, lower, upper, containerClass, isDerived, isDerived, !isReadonly, isComposite, !isComposite /*resolve*/, isUnsettable, IS_UNIQUE, isDerived, IS_ORDERED);
}
protected void initXSD()
{
createDocumentRoot();
}
protected void addXSDMapping(String[] xsdMappings, String annotationSource)
{
addAnnotation((ENamedElement)this, annotationSource, xsdMappings);
}
protected void addXSDMapping(Type type, String[] xsdMappings)
{
addAnnotation((ENamedElement)type, ANNOTATION_SOURCE, xsdMappings);
}
protected void addXSDMapping(Property property, String[] xsdMappings)
{
addAnnotation((ENamedElement)property, ANNOTATION_SOURCE, xsdMappings);
}
protected void setInstanceProperty(Type type, String namespaceURI, String propertyName, String propertyValue)
{
setInstanceProperty((ENamedElement)type, namespaceURI, propertyName, propertyValue);
}
protected void setInstanceProperty(Property property, String namespaceURI, String propertyName, String propertyValue)
{
setInstanceProperty((ENamedElement)property, namespaceURI, propertyName, propertyValue);
}
private void setInstanceProperty(ENamedElement eNamedElement, String namespaceURI, String propertyName, String propertyValue)
{
EAnnotation annotation = eNamedElement.getEAnnotation(namespaceURI);
if (annotation == null)
{
addAnnotation(eNamedElement, namespaceURI, new String[]{propertyName, propertyValue});
} else
{
annotation.getDetails().put(propertyName, propertyValue);
}
}
protected Property createGlobalProperty(String name, Type type, String[] xsdMappings)
{
return createGlobalProperty(name, type, xsdMappings, false);
}
protected Property createGlobalProperty(String name, Type type, String[] xsdMappings, boolean asAttribute)
{
return createGlobalProperty(name, type, xsdMappings, asAttribute, ANNOTATION_SOURCE);
}
protected Property createGlobalProperty(String name, Type type, String[] xsdMappings, boolean asAttribute, String annotationSource)
{
int propertyNumber = documentRootEClass.getEStructuralFeatures().size();
EStructuralFeature globalProperty;
if(asAttribute) {
createEAttribute(documentRootEClass, propertyNumber);
EAttribute gatt = (EAttribute)documentRootEClass.getEStructuralFeatures().get(propertyNumber);
initEAttribute(gatt, (EDataType)type, name, null, 0, -2, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED);
globalProperty = gatt;
} else {
createEReference(documentRootEClass, propertyNumber);
EReference gref = (EReference)documentRootEClass.getEStructuralFeatures().get(propertyNumber);
initEReference(gref, (EClass)type, null, name, null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
globalProperty = gref;
}
addAnnotation((ENamedElement)globalProperty, annotationSource, xsdMappings);
return (Property) globalProperty;
}
private static final Type sequence = SDOFactory.eINSTANCE.createDataType(); // dummy type
protected Type getSequence()
{
return sequence;
}
protected void addSuperType(Type subType, Type superType)
{
((EClass)subType).getESuperTypes().add((EClass)superType);
}
/***
* @param namespaceURI
* @return Static factory (from the global scope) for the provided URI
*
* @deprecated - Use of the global scope is no longer encouraged. This method uses the
* global scope for retrieving the URI's factory. Instead, it is now possible to simply
* access SomeFactoryInterface.INSTANCE object directly.
*
*/
public static Object getStaticFactory(String namespaceURI)
{
EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(namespaceURI);
//return (FactoryBase)ePackage;
return ePackage instanceof FactoryBase ? (Object)ePackage : (Object)ePackage.getEFactoryInstance();
}
// private EMF-specific methods
private static class SDOEFactoryImpl extends DynamicDataObjectImpl.FactoryImpl
{
protected FactoryBase sdoFactory;
public SDOEFactoryImpl()
{
super();
}
public EObject create(EClass eClass)
{
DataObject result = sdoFactory.create(eClass.getClassifierID());
if (result == null) {
if (eClass.isAbstract()) {
Class instanceClass = eClass.getInstanceClass();
try {
Class concreteInstanceClass = DataObjectUtil.getImplementationClass(instanceClass, true);
return (EObject)concreteInstanceClass.newInstance();
}
catch (Exception e)
{
//System.out.println("Error: " + e);
}
}
return super.create(eClass);
}
return (EObject)result;
}
public Object createFromString(EDataType eDataType, String stringValue)
{
return sdoFactory.createFromString(eDataType.getClassifierID(), stringValue);
}
public String convertToString(EDataType eDataType, Object objectValue)
{
return sdoFactory.convertToString(eDataType.getClassifierID(), objectValue);
}
protected Object createFromString(int typeNumber, String stringValue)
{
return super.createFromString((EDataType)sdoFactory.getEClassifiers().get(typeNumber), stringValue);
}
protected String convertToString(int typeNumber, Object objectValue)
{
return super.convertToString((EDataType)sdoFactory.getEClassifiers().get(typeNumber), objectValue);
}
}
private static final int DOCUMENT_ROOT = 0;
private static final int DOCUMENT_ROOT__MIXED = 0;
private static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1;
private static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2;
private static final String ANNOTATION_SOURCE = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
private EClass documentRootEClass = null;
private void createDocumentRoot()
{
documentRootEClass = ecoreFactory.createEClass();
((EClassImpl)documentRootEClass).setClassifierID(DOCUMENT_ROOT);
getEClassifiers().add(DOCUMENT_ROOT, documentRootEClass);
createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED);
createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS);
initEAttribute((EAttribute)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__MIXED), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XMLNS_PREFIX_MAP), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XSI_SCHEMA_LOCATION), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
addAnnotation
(documentRootEClass,
ANNOTATION_SOURCE,
new String[]
{
"name", "",
"kind", "mixed"
});
addAnnotation
((EAttribute)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__MIXED),
ANNOTATION_SOURCE,
new String[]
{
"kind", "elementWildcard",
"name", ":mixed"
});
addAnnotation
((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XMLNS_PREFIX_MAP),
ANNOTATION_SOURCE,
new String[]
{
"kind", "attribute",
"name", "xmlns:prefix"
});
addAnnotation
((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XSI_SCHEMA_LOCATION),
ANNOTATION_SOURCE,
new String[]
{
"kind", "attribute",
"name", "xsi:schemaLocation"
});
}
/**
* Initialize SDO runtime.
*/
static
{
DataObjectUtil.initRuntime();
}
}

View file

@ -0,0 +1,33 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.api.Event;
import org.apache.tuscany.sdo.api.EventListener;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
public abstract class ListenerBase extends AdapterImpl implements EventListener {
public void notifyChanged(Notification msg) {
Event e = new EventImpl(msg);
eventNotification(e);
}
}

View file

@ -0,0 +1,785 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.List;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.apache.tuscany.sdo.util.SDOUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.EReferenceImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import commonj.sdo.Property;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Reference</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class ReferenceImpl extends EReferenceImpl implements Property
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ReferenceImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected EClass eStaticClass()
{
return SDOPackage.eINSTANCE.getReference();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Object getDefault()
{
return getDefaultValue();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isReadOnly()
{
//return "true".equals(EcoreUtil.getAnnotation(this, "commonj.sdo", "readOnly"));
return !isChangeable(); //TODO semantics don't exactly match?
}
/**
* Single-valued SDO properties behave as EMF unsettable, multi-valued properties as EMF !unsettable
*/
public boolean isUnsettable()
{
return !isMany();
}
protected List aliasNames = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public List getAliasNames()
{
if (aliasNames == null)
{
aliasNames = DataObjectUtil.getAliasNames(this);
}
return aliasNames;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Type getType()
{
return (Type)getEType();
/*
EClassifier eType = getEType();
//FB More temporary hacks
return eType instanceof Type ? (Type)getEType() : null;
*/
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Type getContainingType()
{
return (Type)getEContainingClass();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Property getOpposite()
{
return (Property)getEOpposite();
}
public boolean isNullable()
{
String isNillable = EcoreUtil.getAnnotation(this, ExtendedMetaData.ANNOTATION_URI, "nillable");
return isNillable != null && "true".equals(isNillable);
}
public boolean isOpenContent()
{
return SDOUtil.isDocumentRoot(getContainingType());
}
public List getInstanceProperties() {
return DataObjectUtil.getMetaObjectInstanceProperties(this);
}
public Object get(Property property) {
return DataObjectUtil.getMetaObjectInstanceProperty(this, property);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// org.apache.tuscany.sdo.model.Property methods
/////////////////////////////////////////////////////////////////////////////////////////////////////////
public List getAliasName() {
return this.getAliasNames();
}
public Sequence getAny() {
throw new UnsupportedOperationException();
}
public void setMany(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetMany() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetMany() {
return isMany();
}
public void setReadOnly(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetReadOnly() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetReadOnly() {
return isReadOnly();
}
public org.apache.tuscany.sdo.model.Type getType_() {
return (org.apache.tuscany.sdo.model.Type)getType();
}
public void setType(org.apache.tuscany.sdo.model.Type value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public Sequence getAnyAttribute() {
throw new UnsupportedOperationException();
}
public String getDefault_() {
return (String) this.getDefault();
}
public void setDefault_(String value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public org.apache.tuscany.sdo.model.Property getOpposite_() {
return (org.apache.tuscany.sdo.model.Property) getOpposite();
}
public void setOpposite_(org.apache.tuscany.sdo.model.Property value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetContainment() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetContainment() {
return isContainment();
}
public void setNullable(boolean value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void unsetNullable() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetNullable() {
return isNullable();
}
public void unsetName()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetName()
{
return true;
}
public void unsetOpposite()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetOpposite()
{
return getOpposite() != null;
}
public void unsetType()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetType()
{
return true;
}
public void unsetDefault()
{
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSetDefault()
{
return getDefault() != null;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// DataObject method implementations
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
public Object get(int propertyIndex) {
return DataObjectUtil.get(this, propertyIndex);
}
public void set(int propertyIndex, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(int propertyIndex) {
return DataObjectUtil.isSet(this, propertyIndex);
}
public void unset(int propertyIndex) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public Object get(Property property) {
return DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID());
}
public void set(Property property, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(Property property) {
return DataObjectUtil.isSet(this, ((EStructuralFeature)property).getFeatureID());
}
public void unset(Property property) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject getContainer() {
return (DataObject)eContainer();
}
public Property getContainmentProperty() {
return (Property)eContainmentFeature();
}
// Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil
public Object get(String path) {
return DataObjectUtil.get(this, path);
}
public void set(String path, Object value) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean isSet(String path) {
return DataObjectUtil.isSet(this, path);
}
public void unset(String path) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public boolean getBoolean(String path) {
return DataObjectUtil.getBoolean(get(path));
}
public byte getByte(String path) {
return DataObjectUtil.getByte(get(path));
}
public char getChar(String path) {
return DataObjectUtil.getChar(get(path));
}
public double getDouble(String path) {
return DataObjectUtil.getDouble(get(path));
}
public float getFloat(String path) {
return DataObjectUtil.getFloat(get(path));
}
public int getInt(String path) {
return DataObjectUtil.getInt(get(path));
}
public long getLong(String path) {
return DataObjectUtil.getLong(get(path));
}
public short getShort(String path) {
return DataObjectUtil.getShort(get(path));
}
public byte[] getBytes(String path) {
return DataObjectUtil.getBytes(get(path));
}
public BigDecimal getBigDecimal(String path) {
return DataObjectUtil.getBigDecimal(get(path));
}
public BigInteger getBigInteger(String path) {
return DataObjectUtil.getBigInteger(get(path));
}
public DataObject getDataObject(String path) {
return (DataObject)get(path);
}
public Date getDate(String path) {
return DataObjectUtil.getDate(get(path));
}
public String getString(String path) {
return DataObjectUtil.getString(get(path));
}
public List getList(String path) {
return (List)get(path);
}
public Sequence getSequence(String path) {
return (Sequence)get(path);
}
public void setBoolean(String path, boolean value) {
set(path, new Boolean(value));
}
public void setByte(String path, byte value) {
set(path, new Byte(value));
}
public void setChar(String path, char value) {
set(path, new Character(value));
}
public void setDouble(String path, double value) {
set(path, new Double(value));
}
public void setFloat(String path, float value) {
set(path, new Float(value));
}
public void setInt(String path, int value) {
set(path, new Integer(value));
}
public void setLong(String path, long value) {
set(path, new Long(value));
}
public void setShort(String path, short value) {
set(path, new Short(value));
}
public void setBytes(String path, byte[] value) {
set(path, value);
}
public void setBigDecimal(String path, BigDecimal value) {
set(path, value);
}
public void setBigInteger(String path, BigInteger value) {
set(path, value);
}
public void setDataObject(String path, DataObject value) {
set(path, value);
}
public void setDate(String path, Date value) {
set(path, value);
}
public void setString(String path, String value) {
set(path, value);
}
public void setList(String path, List value) {
set(path, value);
}
public boolean getBoolean(int propertyIndex) {
return DataObjectUtil.getBoolean(this, propertyIndex);
}
public byte getByte(int propertyIndex) {
return DataObjectUtil.getByte(this, propertyIndex);
}
public char getChar(int propertyIndex) {
return DataObjectUtil.getChar(this, propertyIndex);
}
public double getDouble(int propertyIndex) {
return DataObjectUtil.getDouble(this, propertyIndex);
}
public float getFloat(int propertyIndex) {
return DataObjectUtil.getFloat(this, propertyIndex);
}
public int getInt(int propertyIndex) {
return DataObjectUtil.getInt(this, propertyIndex);
}
public long getLong(int propertyIndex) {
return DataObjectUtil.getLong(this, propertyIndex);
}
public short getShort(int propertyIndex) {
return DataObjectUtil.getShort(this, propertyIndex);
}
public byte[] getBytes(int propertyIndex) {
return DataObjectUtil.getBytes(this, propertyIndex);
}
public BigDecimal getBigDecimal(int propertyIndex) {
return DataObjectUtil.getBigDecimal(this, propertyIndex);
}
public BigInteger getBigInteger(int propertyIndex) {
return DataObjectUtil.getBigInteger(this, propertyIndex);
}
public DataObject getDataObject(int propertyIndex) {
return DataObjectUtil.getDataObject(this, propertyIndex);
}
public Date getDate(int propertyIndex) {
return DataObjectUtil.getDate(this, propertyIndex);
}
public String getString(int propertyIndex) {
return DataObjectUtil.getString(this, propertyIndex);
}
public List getList(int propertyIndex) {
return DataObjectUtil.getList(this, propertyIndex);
}
public Sequence getSequence(int propertyIndex) {
return DataObjectUtil.getSequence(this, propertyIndex);
}
public void setBoolean(int propertyIndex, boolean value) {
set(propertyIndex, new Boolean(value));
}
public void setByte(int propertyIndex, byte value) {
set(propertyIndex, new Byte(value));
}
public void setChar(int propertyIndex, char value) {
set(propertyIndex, new Character(value));
}
public void setDouble(int propertyIndex, double value) {
set(propertyIndex, new Double(value));
}
public void setFloat(int propertyIndex, float value) {
set(propertyIndex, new Float(value));
}
public void setInt(int propertyIndex, int value) {
set(propertyIndex, new Integer(value));
}
public void setLong(int propertyIndex, long value) {
set(propertyIndex, new Long(value));
}
public void setShort(int propertyIndex, short value) {
set(propertyIndex, new Short(value));
}
public void setBytes(int propertyIndex, byte[] value) {
set(propertyIndex, value);
}
public void setBigDecimal(int propertyIndex, BigDecimal value) {
set(propertyIndex, value);
}
public void setBigInteger(int propertyIndex, BigInteger value) {
set(propertyIndex, value);
}
public void setDataObject(int propertyIndex, DataObject value) {
set(propertyIndex, value);
}
public void setDate(int propertyIndex, Date value) {
set(propertyIndex, value);
}
public void setString(int propertyIndex, String value) {
set(propertyIndex, value);
}
public void setList(int propertyIndex, List value) {
set(propertyIndex, value);
}
public boolean getBoolean(Property property) {
return DataObjectUtil.getBoolean(this, property);
}
public byte getByte(Property property) {
return DataObjectUtil.getByte(this, property);
}
public char getChar(Property property) {
return DataObjectUtil.getChar(this, property);
}
public double getDouble(Property property) {
return DataObjectUtil.getDouble(this, property);
}
public float getFloat(Property property) {
return DataObjectUtil.getFloat(this, property);
}
public int getInt(Property property) {
return DataObjectUtil.getInt(this, property);
}
public long getLong(Property property) {
return DataObjectUtil.getLong(this, property);
}
public short getShort(Property property) {
return DataObjectUtil.getShort(this, property);
}
public byte[] getBytes(Property property) {
return DataObjectUtil.getBytes(this, property);
}
public BigDecimal getBigDecimal(Property property) {
return DataObjectUtil.getBigDecimal(this, property);
}
public BigInteger getBigInteger(Property property) {
return DataObjectUtil.getBigInteger(this, property);
}
public DataObject getDataObject(Property property) {
return DataObjectUtil.getDataObject(this, property);
}
public Date getDate(Property property) {
return DataObjectUtil.getDate(this, property);
}
public String getString(Property property) {
return DataObjectUtil.getString(this, property);
}
public List getList(Property property) {
return DataObjectUtil.getList(this, property);
}
public Sequence getSequence(Property property) {
return DataObjectUtil.getSequence(this, property);
}
public void setBoolean(Property property, boolean value) {
set(property, new Boolean(value));
}
public void setByte(Property property, byte value) {
set(property, new Byte(value));
}
public void setChar(Property property, char value) {
set(property, new Character(value));
}
public void setDouble(Property property, double value) {
set(property, new Double(value));
}
public void setFloat(Property property, float value) {
set(property, new Float(value));
}
public void setInt(Property property, int value) {
set(property, new Integer(value));
}
public void setLong(Property property, long value) {
set(property, new Long(value));
}
public void setShort(Property property, short value) {
set(property, new Short(value));
}
public void setBytes(Property property, byte[] value) {
set(property, value);
}
public void setBigDecimal(Property property, BigDecimal value) {
set(property, value);
}
public void setBigInteger(Property property, BigInteger value) {
set(property, value);
}
public void setDataObject(Property property, DataObject value) {
set(property, value);
}
public void setDate(Property property, Date value) {
set(property, value);
}
public void setString(Property property, String value) {
set(property, value);
}
public void setList(Property property, List value) {
set(property, value);
}
public DataObject createDataObject(String propertyName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(Property property) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataObject createDataObject(Property property, Type type) {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public void delete() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
}
public DataGraph getDataGraph() {
return DataObjectUtil.getDataGraph(this);
}
public Sequence getSequence() {
EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass());
return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null;
}
public List getInstanceProperties() {
return DataObjectUtil.getInstanceProperties(this);
}
public DataObject getRootObject() {
return DataObjectUtil.getRootObject(this);
}
public ChangeSummary getChangeSummary() {
// TODO: implement this method
throw new UnsupportedOperationException();
}
public void detach() {
throw new UnsupportedOperationException("Property is frozen and cannot be modified");
//DataObjectUtil.detach(this);
}
public Property getProperty(String propertyName) {
return DataObjectUtil.getProperty(this, propertyName);
}
*/
} //ReferenceImpl

View file

@ -0,0 +1,334 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.AnyTypeDataObject;
import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.impl.EcoreFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import commonj.sdo.ChangeSummary;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Type;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class SDOFactoryImpl extends EFactoryImpl implements SDOFactory
{
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public static SDOFactory init()
{
try
{
SDOFactory theSDOFactory = (SDOFactory)EPackage.Registry.INSTANCE.getEFactory(SDOPackage.eNS_URI);
if (theSDOFactory != null)
{
return theSDOFactory;
}
}
catch (Exception exception)
{
EcorePlugin.INSTANCE.log(exception);
}
return new SDOFactoryImpl();
}
public static class SDOEcoreFactory extends EcoreFactoryImpl
{
public EClass createEClass() { return new ClassImpl(); }
public EDataType createEDataType() { return new DataTypeImpl(); }
//public EEnum createEEnum() { return new EnumImpl(); }
public EAttribute createEAttribute() { return new AttributeImpl(); }
public EReference createEReference() { return new ReferenceImpl(); }
// public EFactory createEFactory()
// {
// EFactoryImpl eFactory = new EFactoryImpl() { OVERRIDE basicCreate(); } // TODO think about doing this
// return eFactory;
// }
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SDOFactoryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EObject create(EClass eClass)
{
switch (eClass.getClassifierID()) {
case SDOPackage.CHANGE_SUMMARY: return (EObject)createChangeSummary();
case SDOPackage.CHANGE_SUMMARY_SETTING: return (EObject)createChangeSummarySetting();
case SDOPackage.DATA_GRAPH: return (EObject)createDataGraph();
case SDOPackage.ANY_TYPE_DATA_OBJECT: return createAnyTypeDataObject();
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT: return createSimpleAnyTypeDataObject();
case SDOPackage.CLASS: return (EObject)createClass();
case SDOPackage.DATA_TYPE: return (EObject)createDataType();
case SDOPackage.ATTRIBUTE: return (EObject)createAttribute();
case SDOPackage.REFERENCE: return (EObject)createReference();
case SDOPackage.ENUM: return (EObject)createEnum();
case SDOPackage.DYNAMIC_DATA_OBJECT: return (EObject)createDynamicDataObject();
case SDOPackage.STORE_DATA_OBJECT: return (EObject)createStoreDataObject();
case SDOPackage.DYNAMIC_STORE_DATA_OBJECT: return (EObject)createDynamicStoreDataObject();
case SDOPackage.EXTENSIBLE_DATA_OBJECT: return (EObject)createExtensibleDataObject();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object createFromString(EDataType eDataType, String initialValue)
{
switch (eDataType.getClassifierID()) {
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertToString(EDataType eDataType, Object instanceValue)
{
switch (eDataType.getClassifierID()) {
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeSummary createChangeSummary()
{
ChangeSummaryImpl changeSummary = new ChangeSummaryImpl();
return changeSummary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeSummary.Setting createChangeSummarySetting()
{
ChangeSummarySettingImpl changeSummarySetting = new ChangeSummarySettingImpl();
return changeSummarySetting;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataGraph createDataGraph()
{
DataGraphImpl dataGraph = new DataGraphImpl();
return dataGraph;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AnyTypeDataObject createAnyTypeDataObject()
{
AnyTypeDataObjectImpl anyTypeDataObject = new AnyTypeDataObjectImpl();
return anyTypeDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SimpleAnyTypeDataObject createSimpleAnyTypeDataObject()
{
SimpleAnyTypeDataObjectImpl simpleAnyTypeDataObject = new SimpleAnyTypeDataObjectImpl();
return simpleAnyTypeDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type createClass()
{
ClassImpl class_ = new ClassImpl();
return class_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type createDataType()
{
DataTypeImpl dataType = new DataTypeImpl();
return dataType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property createAttribute()
{
AttributeImpl attribute = new AttributeImpl();
return attribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property createReference()
{
ReferenceImpl reference = new ReferenceImpl();
return reference;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type createEnum()
{
EnumImpl enum_ = new EnumImpl();
return enum_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject createDynamicDataObject()
{
DynamicDataObjectImpl dynamicDataObject = new DynamicDataObjectImpl();
return dynamicDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject createStoreDataObject()
{
StoreDataObjectImpl storeDataObject = new StoreDataObjectImpl();
return storeDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject createDynamicStoreDataObject()
{
DynamicStoreDataObjectImpl dynamicStoreDataObject = new DynamicStoreDataObjectImpl();
return dynamicStoreDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject createExtensibleDataObject()
{
ExtensibleDataObjectImpl extensibleDataObject = new ExtensibleDataObjectImpl();
return extensibleDataObject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SDOPackage getSDOPackage()
{
return (SDOPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
public static SDOPackage getPackage()
{
return SDOPackage.eINSTANCE;
}
public ChangeSummary.Setting createChangeSummarySetting(EStructuralFeature eStructuralFeature, Object value, boolean isSet)
{
ChangeSummarySettingImpl eChangeSummarySetting = new ChangeSummarySettingImpl(eStructuralFeature, value, isSet);
return eChangeSummarySetting;
}
} //SDOFactoryImpl

View file

@ -0,0 +1,292 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import java.util.Iterator;
import org.apache.tuscany.sdo.SDOPackage;
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.xml.type.SimpleAnyType;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EData Object Simple Any Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getRawValue <em>Raw Value</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getValue <em>Value</em>}</li>
* <li>{@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getInstanceType <em>Instance Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SimpleAnyTypeDataObjectImpl extends AnyTypeDataObjectImpl implements SimpleAnyTypeDataObject
{
/**
* The default value of the '{@link #getRawValue() <em>Raw Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRawValue()
* @generated
* @ordered
*/
protected static final String RAW_VALUE_EDEFAULT = null;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final Object VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getInstanceType() <em>Instance Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInstanceType()
* @generated
* @ordered
*/
protected EDataType instanceType;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SimpleAnyTypeDataObjectImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.SIMPLE_ANY_TYPE_DATA_OBJECT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String getRawValue()
{
StringBuffer value = new StringBuffer();
for (Iterator i = getMixed().iterator(); i.hasNext(); )
{
FeatureMap.Entry entry = (FeatureMap.Entry)i.next();
if (entry.getEStructuralFeature() == XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text())
{
value.append(entry.getValue());
}
}
return value.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setRawValue(String newRawValue)
{
getMixed().clear();
if (newRawValue != null)
{
getMixed().add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text(), newRawValue);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Object getValue()
{
return EcoreUtil.createFromString(instanceType, getRawValue());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setValue(Object newValue)
{
setRawValue(EcoreUtil.convertToString(instanceType, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EDataType getInstanceType()
{
return instanceType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInstanceType(EDataType newInstanceType)
{
EDataType oldInstanceType = instanceType;
instanceType = newInstanceType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE, oldInstanceType, instanceType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID) {
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE:
return getRawValue();
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE:
return getValue();
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE:
return getInstanceType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue)
{
switch (featureID) {
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE:
setRawValue((String)newValue);
return;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE:
setValue(newValue);
return;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE:
setInstanceType((EDataType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID)
{
switch (featureID) {
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE:
setRawValue(RAW_VALUE_EDEFAULT);
return;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE:
setValue(VALUE_EDEFAULT);
return;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE:
setInstanceType((EDataType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID)
{
switch (featureID) {
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE:
return RAW_VALUE_EDEFAULT == null ? getRawValue() != null : !RAW_VALUE_EDEFAULT.equals(getRawValue());
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE:
return VALUE_EDEFAULT == null ? getValue() != null : !VALUE_EDEFAULT.equals(getValue());
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE:
return instanceType != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass)
{
if (baseClass == SimpleAnyType.class) {
switch (derivedFeatureID) {
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: return XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: return XMLTypePackage.SIMPLE_ANY_TYPE__VALUE;
case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: return XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass)
{
if (baseClass == SimpleAnyType.class) {
switch (baseFeatureID) {
case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE;
case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE;
case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
} //EDataObjectSimpleAnyTypeImpl

View file

@ -0,0 +1,314 @@
/**
*
* 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
*
* http://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.tuscany.sdo.impl;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl.EStoreEList;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl.EStoreFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import commonj.sdo.DataObject;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Store Data Object</b></em>'.
* @extends EStructuralFeature.Internal.DynamicValueHolder
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class StoreDataObjectImpl extends DataObjectImpl implements DataObject, EStructuralFeature.Internal.DynamicValueHolder
{
//TODO consider factoring the eSettings code into a new base class that this and DynamicDataObjectImpl could extend
protected static final Object [] ENO_SETTINGS = new Object [0];
protected static final InternalEObject EUNINITIALIZED_CONTAINER = new DynamicDataObjectImpl();
protected Object [] eSettings;
protected InternalEObject.EStore eStore;
/**
* Creates a store-based DataObject.
*/
public StoreDataObjectImpl()
{
super();
eContainer = EUNINITIALIZED_CONTAINER;
}
/**
* Creates a store-based DataObject.
*/
public StoreDataObjectImpl(InternalEObject.EStore eStore)
{
super();
eSetStore(eStore);
eContainer = EUNINITIALIZED_CONTAINER;
}
/**
* Creates a store-based DataObject.
*/
public StoreDataObjectImpl(EClass eClass)
{
super();
eSetClass(eClass);
eContainer = EUNINITIALIZED_CONTAINER;
}
/**
* Creates a store-based DataObject.
*/
public StoreDataObjectImpl(EClass eClass, InternalEObject.EStore eStore)
{
super();
eSetClass(eClass);
eSetStore(eStore);
eContainer = EUNINITIALIZED_CONTAINER;
}
protected boolean eIsCaching()
{
return true;
}
public Object dynamicGet(int dynamicFeatureID)
{
Object result = eSettings[dynamicFeatureID];
if (result == null)
{
EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID);
if (!eStructuralFeature.isTransient())
{
if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
{
eSettings[dynamicFeatureID] = result = createFeatureMap(eStructuralFeature);
}
else if (eStructuralFeature.isMany())
{
eSettings[dynamicFeatureID] = result = createList(eStructuralFeature);
}
else
{
result = eStore().get(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX);
if (eIsCaching())
{
eSettings[dynamicFeatureID] = result;
}
}
}
}
return result;
}
public void dynamicSet(int dynamicFeatureID, Object value)
{
EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID);
if (eStructuralFeature.isTransient())
{
eSettings[dynamicFeatureID] = value;
}
else
{
eStore().set(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX, value == NIL ? null : value);
if (eIsCaching())
{
eSettings[dynamicFeatureID] = value;
}
}
}
public void dynamicUnset(int dynamicFeatureID)
{
eStore().unset(this, eDynamicFeature(dynamicFeatureID));
eSettings[dynamicFeatureID] = null;
}
public Object eDynamicGet(int featureID, boolean resolve, boolean coreType)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eSettingDelegate(eFeature).dynamicGet(this, eSettings(), featureID, resolve, coreType);
}
else
{
return super.eDynamicGet(featureID, resolve, coreType);
}
}
public void eDynamicSet(int featureID, Object newValue)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
eDynamicSet(featureID, eFeature, newValue);
}
else
{
super.eDynamicSet(featureID, newValue);
}
}
public void eDynamicUnset(int featureID)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
eDynamicUnset(featureID, eFeature);
}
else
{
super.eDynamicUnset(featureID);
}
}
public boolean eDynamicIsSet(int featureID)
{
if (featureID < eClass().getFeatureCount())
{
EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID);
return eFeature.isTransient() ?
eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), featureID) :
eStore().isSet(this, eFeature);
}
else
{
return super.eDynamicIsSet(featureID);
}
}
/*
public boolean eDynamicIsSet(EStructuralFeature eStructuralFeature)
{
return
eStructuralFeature.isTransient() ?
super.eDynamicIsSet(eStructuralFeature) :
eStore().isSet(this, eStructuralFeature);
}
*/
protected EList createList(EStructuralFeature eStructuralFeature)
{
return new EStoreEList(this, eStructuralFeature, eStore());
}
protected FeatureMap createFeatureMap(EStructuralFeature eStructuralFeature)
{
return new EStoreFeatureMap(this, eStructuralFeature, eStore());
}
public EObject eContainer()
{
if (eContainer == EUNINITIALIZED_CONTAINER)
{
eInitializeContainer();
}
return eContainer;
}
public int eContainerFeatureID()
{
if (eContainer == EUNINITIALIZED_CONTAINER)
{
eInitializeContainer();
}
return eContainerFeatureID;
}
protected void eInitializeContainer()
{
eContainer = eStore().getContainer(this);
if (eContainer != null)
{
EStructuralFeature eContainingFeature = eStore().getContainingFeature(this);
if (eContainingFeature instanceof EReference)
{
EReference eContainingReference = (EReference)eContainingFeature;
EReference eOpposite = eContainingReference.getEOpposite();
if (eOpposite != null)
{
eContainerFeatureID = eClass().getFeatureID(eOpposite);
return;
}
}
eContainerFeatureID = EOPPOSITE_FEATURE_BASE - eContainer.eClass().getFeatureID(eContainingFeature);
}
}
public InternalEObject.EStore eStore()
{
return eStore;
}
public void eSetStore(InternalEObject.EStore store)
{
this.eStore = store;
}
protected int eStaticFeatureCount()
{
return 0;
}
public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature)
{
return eClass().getFeatureID(eStructuralFeature);
}
protected boolean eHasSettings()
{
return eSettings != null;
}
protected EStructuralFeature.Internal.DynamicValueHolder eSettings()
{
if (eSettings == null)
{
int size = eClass().getFeatureCount() - eStaticFeatureCount();
eSettings = size == 0 ? ENO_SETTINGS : new Object [size];
}
return this;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass()
{
return SDOPackage.Literals.STORE_DATA_OBJECT;
}
} //StoreDataObjectImpl

View file

@ -0,0 +1,213 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.ChangeSummary;
import commonj.sdo.Sequence;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Base Data Graph Type</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels <em>Models</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd <em>Xsd</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary <em>Change Summary</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface BaseDataGraphType extends Serializable
{
/**
* Returns the value of the '<em><b>Models</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Models</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Models</em>' containment reference.
* @see #isSetModels()
* @see #unsetModels()
* @see #setModels(ModelsType)
* @generated
*/
ModelsType getModels();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels <em>Models</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Models</em>' containment reference.
* @see #isSetModels()
* @see #unsetModels()
* @see #getModels()
* @generated
*/
void setModels(ModelsType value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels <em>Models</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetModels()
* @see #getModels()
* @see #setModels(ModelsType)
* @generated
*/
void unsetModels();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels <em>Models</em>}' containment reference is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Models</em>' containment reference is set.
* @see #unsetModels()
* @see #getModels()
* @see #setModels(ModelsType)
* @generated
*/
boolean isSetModels();
/**
* Returns the value of the '<em><b>Xsd</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Xsd</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Xsd</em>' containment reference.
* @see #isSetXsd()
* @see #unsetXsd()
* @see #setXsd(XSDType)
* @generated
*/
XSDType getXsd();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd <em>Xsd</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Xsd</em>' containment reference.
* @see #isSetXsd()
* @see #unsetXsd()
* @see #getXsd()
* @generated
*/
void setXsd(XSDType value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd <em>Xsd</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetXsd()
* @see #getXsd()
* @see #setXsd(XSDType)
* @generated
*/
void unsetXsd();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd <em>Xsd</em>}' containment reference is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Xsd</em>' containment reference is set.
* @see #unsetXsd()
* @see #getXsd()
* @see #setXsd(XSDType)
* @generated
*/
boolean isSetXsd();
/**
* Returns the value of the '<em><b>Change Summary</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Change Summary</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Change Summary</em>' attribute.
* @see #isSetChangeSummary()
* @see #unsetChangeSummary()
* @see #setChangeSummary(ChangeSummary)
* @generated
*/
ChangeSummary getChangeSummary();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary <em>Change Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Change Summary</em>' attribute.
* @see #isSetChangeSummary()
* @see #unsetChangeSummary()
* @see #getChangeSummary()
* @generated
*/
void setChangeSummary(ChangeSummary value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary <em>Change Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetChangeSummary()
* @see #getChangeSummary()
* @see #setChangeSummary(ChangeSummary)
* @generated
*/
void unsetChangeSummary();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary <em>Change Summary</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Change Summary</em>' attribute is set.
* @see #unsetChangeSummary()
* @see #getChangeSummary()
* @see #setChangeSummary(ChangeSummary)
* @generated
*/
boolean isSetChangeSummary();
/**
* Returns the value of the '<em><b>Any Attribute</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any Attribute</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any Attribute</em>' attribute list.
* @generated
*/
Sequence getAnyAttribute();
} // BaseDataGraphType

View file

@ -0,0 +1,53 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.Sequence;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Data Graph Type</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.DataGraphType#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public interface DataGraphType extends BaseDataGraphType
{
/**
* Returns the value of the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any</em>' attribute list.
* @generated
*/
Sequence getAny();
} // DataGraphType

View file

@ -0,0 +1,35 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Data Object</b></em>'.
* <!-- end-user-doc -->
*
*
* @extends Serializable
* @generated
*/
public interface DataObject extends Serializable
{
} // DataObject

View file

@ -0,0 +1,106 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.helper.HelperContext;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @generated
*/
public interface ModelFactory
{
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
ModelFactory INSTANCE = org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init();
/**
* Returns a new object of class '<em>Data Graph Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Data Graph Type</em>'.
* @generated
*/
DataGraphType createDataGraphType();
/**
* Returns a new object of class '<em>Models Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Models Type</em>'.
* @generated
*/
ModelsType createModelsType();
/**
* Returns a new object of class '<em>Property</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Property</em>'.
* @generated
*/
Property createProperty();
/**
* Returns a new object of class '<em>Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Type</em>'.
* @generated
*/
Type createType();
/**
* Returns a new object of class '<em>Types</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Types</em>'.
* @generated
*/
Types createTypes();
/**
* Returns a new object of class '<em>XSD Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>XSD Type</em>'.
* @generated
*/
XSDType createXSDType();
/**
* Registers the types supported by this Factory within the supplied scope.argument
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param scope an instance of HelperContext used to manage the scoping of types.
* @generated
*/
public void register(HelperContext scope);
} //ModelFactory

View file

@ -0,0 +1,62 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.Sequence;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Models Type</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
*
* Expected type is emof:Package.
*
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.ModelsType#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface ModelsType extends Serializable
{
/**
* Returns the value of the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any</em>' attribute list.
* @generated
*/
Sequence getAny();
} // ModelsType

View file

@ -0,0 +1,503 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.Sequence;
import java.io.Serializable;
import java.util.List;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Property</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.Property#getAliasName <em>Alias Name</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getAny <em>Any</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getName <em>Name</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#isMany <em>Many</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#isContainment <em>Containment</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getDefault <em>Default</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#isReadOnly <em>Read Only</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getType_ <em>Type</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getOpposite <em>Opposite</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#isNullable <em>Nullable</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Property#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface Property extends Serializable
{
/**
* Returns the value of the '<em><b>Alias Name</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Alias Name</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Alias Name</em>' attribute list.
* @generated
*/
List getAliasName();
/**
* Returns the value of the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any</em>' attribute list.
* @generated
*/
Sequence getAny();
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #isSetName()
* @see #unsetName()
* @see #setName(String)
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #isSetName()
* @see #unsetName()
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetName()
* @see #getName()
* @see #setName(String)
* @generated
*/
void unsetName();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getName <em>Name</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Name</em>' attribute is set.
* @see #unsetName()
* @see #getName()
* @see #setName(String)
* @generated
*/
boolean isSetName();
/**
* Returns the value of the '<em><b>Many</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Many</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Many</em>' attribute.
* @see #isSetMany()
* @see #unsetMany()
* @see #setMany(boolean)
* @generated
*/
boolean isMany();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Many</em>' attribute.
* @see #isSetMany()
* @see #unsetMany()
* @see #isMany()
* @generated
*/
void setMany(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetMany()
* @see #isMany()
* @see #setMany(boolean)
* @generated
*/
void unsetMany();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany <em>Many</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Many</em>' attribute is set.
* @see #unsetMany()
* @see #isMany()
* @see #setMany(boolean)
* @generated
*/
boolean isSetMany();
/**
* Returns the value of the '<em><b>Containment</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Containment</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Containment</em>' attribute.
* @see #isSetContainment()
* @see #unsetContainment()
* @see #setContainment(boolean)
* @generated
*/
boolean isContainment();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment <em>Containment</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Containment</em>' attribute.
* @see #isSetContainment()
* @see #unsetContainment()
* @see #isContainment()
* @generated
*/
void setContainment(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment <em>Containment</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetContainment()
* @see #isContainment()
* @see #setContainment(boolean)
* @generated
*/
void unsetContainment();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment <em>Containment</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Containment</em>' attribute is set.
* @see #unsetContainment()
* @see #isContainment()
* @see #setContainment(boolean)
* @generated
*/
boolean isSetContainment();
/**
* Returns the value of the '<em><b>Default</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Default</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Default</em>' attribute.
* @see #isSetDefault()
* @see #unsetDefault()
* @see #setDefault_(String)
* @generated
*/
String getDefault_();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Default</em>' attribute.
* @see #isSetDefault()
* @see #unsetDefault()
* @see #getDefault_()
* @generated
*/
void setDefault_(String value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetDefault()
* @see #getDefault_()
* @see #setDefault_(String)
* @generated
*/
void unsetDefault();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault <em>Default</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Default</em>' attribute is set.
* @see #unsetDefault()
* @see #getDefault_()
* @see #setDefault_(String)
* @generated
*/
boolean isSetDefault();
/**
* Returns the value of the '<em><b>Read Only</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Read Only</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Read Only</em>' attribute.
* @see #isSetReadOnly()
* @see #unsetReadOnly()
* @see #setReadOnly(boolean)
* @generated
*/
boolean isReadOnly();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly <em>Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Read Only</em>' attribute.
* @see #isSetReadOnly()
* @see #unsetReadOnly()
* @see #isReadOnly()
* @generated
*/
void setReadOnly(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly <em>Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetReadOnly()
* @see #isReadOnly()
* @see #setReadOnly(boolean)
* @generated
*/
void unsetReadOnly();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly <em>Read Only</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Read Only</em>' attribute is set.
* @see #unsetReadOnly()
* @see #isReadOnly()
* @see #setReadOnly(boolean)
* @generated
*/
boolean isSetReadOnly();
/**
* Returns the value of the '<em><b>Type</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' reference.
* @see #isSetType()
* @see #unsetType()
* @see #setType(Type)
* @generated
*/
Type getType_();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getType_ <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' reference.
* @see #isSetType()
* @see #unsetType()
* @see #getType_()
* @generated
*/
void setType(Type value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#getType_ <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetType()
* @see #getType_()
* @see #setType(Type)
* @generated
*/
void unsetType();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getType_ <em>Type</em>}' reference is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Type</em>' reference is set.
* @see #unsetType()
* @see #getType_()
* @see #setType(Type)
* @generated
*/
boolean isSetType();
/**
* Returns the value of the '<em><b>Opposite</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Opposite</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Opposite</em>' reference.
* @see #isSetOpposite()
* @see #unsetOpposite()
* @see #setOpposite_(Property)
* @generated
*/
Property getOpposite_();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite <em>Opposite</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Opposite</em>' reference.
* @see #isSetOpposite()
* @see #unsetOpposite()
* @see #getOpposite_()
* @generated
*/
void setOpposite_(Property value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite <em>Opposite</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetOpposite()
* @see #getOpposite_()
* @see #setOpposite_(Property)
* @generated
*/
void unsetOpposite();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite <em>Opposite</em>}' reference is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Opposite</em>' reference is set.
* @see #unsetOpposite()
* @see #getOpposite_()
* @see #setOpposite_(Property)
* @generated
*/
boolean isSetOpposite();
/**
* Returns the value of the '<em><b>Nullable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Nullable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Nullable</em>' attribute.
* @see #isSetNullable()
* @see #unsetNullable()
* @see #setNullable(boolean)
* @generated
*/
boolean isNullable();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isNullable <em>Nullable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Nullable</em>' attribute.
* @see #isSetNullable()
* @see #unsetNullable()
* @see #isNullable()
* @generated
*/
void setNullable(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isNullable <em>Nullable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetNullable()
* @see #isNullable()
* @see #setNullable(boolean)
* @generated
*/
void unsetNullable();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isNullable <em>Nullable</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Nullable</em>' attribute is set.
* @see #unsetNullable()
* @see #isNullable()
* @see #setNullable(boolean)
* @generated
*/
boolean isSetNullable();
/**
* Returns the value of the '<em><b>Any Attribute</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any Attribute</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any Attribute</em>' attribute list.
* @generated
*/
Sequence getAnyAttribute();
} // Property

View file

@ -0,0 +1,57 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import java.io.Serializable;
import java.util.List;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Text Type</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.TextType#getText <em>Text</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface TextType extends Serializable
{
/**
* Returns the value of the '<em><b>Text</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Text</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Text</em>' attribute list.
* @generated
*/
List getText();
} // TextType

View file

@ -0,0 +1,431 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.Sequence;
import java.io.Serializable;
import java.util.List;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Type</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.Type#getBaseType <em>Base Type</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getProperty <em>Property</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getAliasName <em>Alias Name</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getAny <em>Any</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getName <em>Name</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getUri <em>Uri</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#isDataType <em>Data Type</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#isOpen <em>Open</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#isSequenced <em>Sequenced</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#isAbstract <em>Abstract</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.Type#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface Type extends Serializable
{
/**
* Returns the value of the '<em><b>Base Type</b></em>' reference list.
* The list contents are of type {@link org.apache.tuscany.sdo.model.Type}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Base Type</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Base Type</em>' reference list.
* @generated
*/
List getBaseType();
/**
* Returns the value of the '<em><b>Property</b></em>' containment reference list.
* The list contents are of type {@link org.apache.tuscany.sdo.model.Property}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Property</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Property</em>' containment reference list.
* @generated
*/
List getProperty();
/**
* Returns the value of the '<em><b>Alias Name</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Alias Name</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Alias Name</em>' attribute list.
* @generated
*/
List getAliasName();
/**
* Returns the value of the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any</em>' attribute list.
* @generated
*/
Sequence getAny();
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #isSetName()
* @see #unsetName()
* @see #setName(String)
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #isSetName()
* @see #unsetName()
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetName()
* @see #getName()
* @see #setName(String)
* @generated
*/
void unsetName();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#getName <em>Name</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Name</em>' attribute is set.
* @see #unsetName()
* @see #getName()
* @see #setName(String)
* @generated
*/
boolean isSetName();
/**
* Returns the value of the '<em><b>Uri</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Uri</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Uri</em>' attribute.
* @see #isSetUri()
* @see #unsetUri()
* @see #setUri(String)
* @generated
*/
String getUri();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri <em>Uri</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Uri</em>' attribute.
* @see #isSetUri()
* @see #unsetUri()
* @see #getUri()
* @generated
*/
void setUri(String value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri <em>Uri</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetUri()
* @see #getUri()
* @see #setUri(String)
* @generated
*/
void unsetUri();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri <em>Uri</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Uri</em>' attribute is set.
* @see #unsetUri()
* @see #getUri()
* @see #setUri(String)
* @generated
*/
boolean isSetUri();
/**
* Returns the value of the '<em><b>Data Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Data Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Data Type</em>' attribute.
* @see #isSetDataType()
* @see #unsetDataType()
* @see #setDataType(boolean)
* @generated
*/
boolean isDataType();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Data Type</em>' attribute.
* @see #isSetDataType()
* @see #unsetDataType()
* @see #isDataType()
* @generated
*/
void setDataType(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetDataType()
* @see #isDataType()
* @see #setDataType(boolean)
* @generated
*/
void unsetDataType();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType <em>Data Type</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Data Type</em>' attribute is set.
* @see #unsetDataType()
* @see #isDataType()
* @see #setDataType(boolean)
* @generated
*/
boolean isSetDataType();
/**
* Returns the value of the '<em><b>Open</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Open</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Open</em>' attribute.
* @see #isSetOpen()
* @see #unsetOpen()
* @see #setOpen(boolean)
* @generated
*/
boolean isOpen();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen <em>Open</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Open</em>' attribute.
* @see #isSetOpen()
* @see #unsetOpen()
* @see #isOpen()
* @generated
*/
void setOpen(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen <em>Open</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetOpen()
* @see #isOpen()
* @see #setOpen(boolean)
* @generated
*/
void unsetOpen();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen <em>Open</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Open</em>' attribute is set.
* @see #unsetOpen()
* @see #isOpen()
* @see #setOpen(boolean)
* @generated
*/
boolean isSetOpen();
/**
* Returns the value of the '<em><b>Sequenced</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Sequenced</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sequenced</em>' attribute.
* @see #isSetSequenced()
* @see #unsetSequenced()
* @see #setSequenced(boolean)
* @generated
*/
boolean isSequenced();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced <em>Sequenced</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Sequenced</em>' attribute.
* @see #isSetSequenced()
* @see #unsetSequenced()
* @see #isSequenced()
* @generated
*/
void setSequenced(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced <em>Sequenced</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetSequenced()
* @see #isSequenced()
* @see #setSequenced(boolean)
* @generated
*/
void unsetSequenced();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced <em>Sequenced</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Sequenced</em>' attribute is set.
* @see #unsetSequenced()
* @see #isSequenced()
* @see #setSequenced(boolean)
* @generated
*/
boolean isSetSequenced();
/**
* Returns the value of the '<em><b>Abstract</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Abstract</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Abstract</em>' attribute.
* @see #isSetAbstract()
* @see #unsetAbstract()
* @see #setAbstract(boolean)
* @generated
*/
boolean isAbstract();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract <em>Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Abstract</em>' attribute.
* @see #isSetAbstract()
* @see #unsetAbstract()
* @see #isAbstract()
* @generated
*/
void setAbstract(boolean value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract <em>Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetAbstract()
* @see #isAbstract()
* @see #setAbstract(boolean)
* @generated
*/
void unsetAbstract();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract <em>Abstract</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Abstract</em>' attribute is set.
* @see #unsetAbstract()
* @see #isAbstract()
* @see #setAbstract(boolean)
* @generated
*/
boolean isSetAbstract();
/**
* Returns the value of the '<em><b>Any Attribute</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any Attribute</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any Attribute</em>' attribute list.
* @generated
*/
Sequence getAnyAttribute();
String getInstanceClassName();
} // Type

View file

@ -0,0 +1,59 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import java.io.Serializable;
import java.util.List;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Types</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.Types#getType_ <em>Type</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface Types extends Serializable
{
/**
* Returns the value of the '<em><b>Type</b></em>' containment reference list.
* The list contents are of type {@link org.apache.tuscany.sdo.model.Type}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' containment reference list.
* @generated
*/
List getType_();
List getTypeList();
} // Types

View file

@ -0,0 +1,62 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model;
import commonj.sdo.Sequence;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>XSD Type</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
*
* Expected type is xsd:schema.
*
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.XSDType#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface XSDType extends Serializable
{
/**
* Returns the value of the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Any</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Any</em>' attribute list.
* @generated
*/
Sequence getAny();
} // XSDType

View file

@ -0,0 +1,625 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.ChangeSummary;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.BaseDataGraphType;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.ModelsType;
import org.apache.tuscany.sdo.model.XSDType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Base Data Graph Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getModels <em>Models</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getXsd <em>Xsd</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getChangeSummary <em>Change Summary</em>}</li>
* <li>{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class BaseDataGraphTypeImpl extends DataObjectBase implements BaseDataGraphType
{
public final static int MODELS = 0;
public final static int XSD = 1;
public final static int CHANGE_SUMMARY = 2;
public final static int ANY_ATTRIBUTE = -1;
public final static int SDO_PROPERTY_COUNT = 3;
public final static int EXTENDED_PROPERTY_COUNT = -1;
/**
* The internal feature id for the '<em><b>Models</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_MODELS = 0;
/**
* The internal feature id for the '<em><b>Xsd</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_XSD = 1;
/**
* The internal feature id for the '<em><b>Change Summary</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_CHANGE_SUMMARY = 2;
/**
* The internal feature id for the '<em><b>Any Attribute</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY_ATTRIBUTE = 3;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 4;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_MODELS: return MODELS;
case INTERNAL_XSD: return XSD;
case INTERNAL_CHANGE_SUMMARY: return CHANGE_SUMMARY;
case INTERNAL_ANY_ATTRIBUTE: return ANY_ATTRIBUTE;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getModels() <em>Models</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModels()
* @generated
* @ordered
*/
protected ModelsType models = null;
/**
* This is true if the Models containment reference has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean models_set_ = false;
/**
* The cached value of the '{@link #getXsd() <em>Xsd</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getXsd()
* @generated
* @ordered
*/
protected XSDType xsd = null;
/**
* This is true if the Xsd containment reference has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean xsd_set_ = false;
/**
* The default value of the '{@link #getChangeSummary() <em>Change Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChangeSummary()
* @generated
* @ordered
*/
protected static final ChangeSummary CHANGE_SUMMARY_DEFAULT_ = null;
/**
* The cached value of the '{@link #getChangeSummary() <em>Change Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChangeSummary()
* @generated
* @ordered
*/
protected ChangeSummary changeSummary = CHANGE_SUMMARY_DEFAULT_;
/**
* This is true if the Change Summary attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean changeSummary_set_ = false;
/**
* The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnyAttribute()
* @generated
* @ordered
*/
protected Sequence anyAttribute = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BaseDataGraphTypeImpl()
{
super();
createChangeSummary(CHANGE_SUMMARY);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getBaseDataGraphType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelsType getModels()
{
return models;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext basicSetModels(ModelsType newModels, ChangeContext changeContext)
{
ModelsType oldModels = models;
models = newModels;
boolean oldModels_set_ = models_set_;
models_set_ = true;
if (isNotifying())
{
addNotification(this, ChangeKind.SET, INTERNAL_MODELS, oldModels, newModels, !oldModels_set_, changeContext);
}
return changeContext;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModels(ModelsType newModels)
{
if (newModels != models)
{
ChangeContext changeContext = null;
if (models != null)
changeContext = inverseRemove(models, this, OPPOSITE_FEATURE_BASE - INTERNAL_MODELS, null, changeContext);
if (newModels != null)
changeContext = inverseAdd(newModels, this, OPPOSITE_FEATURE_BASE - INTERNAL_MODELS, null, changeContext);
changeContext = basicSetModels(newModels, changeContext);
if (changeContext != null) dispatch(changeContext);
}
else
{
boolean oldModels_set_ = models_set_;
models_set_ = true;
if (isNotifying())
notify(ChangeKind.SET, INTERNAL_MODELS, newModels, newModels, !oldModels_set_);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext basicUnsetModels(ChangeContext changeContext)
{
ModelsType oldModels = models;
models = null;
boolean oldModels_set_ = models_set_;
models_set_ = false;
if (isNotifying())
{
addNotification(this, ChangeKind.UNSET, INTERNAL_MODELS, oldModels, null, !oldModels_set_, changeContext);
}
return changeContext;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetModels()
{
if (models != null)
{
ChangeContext changeContext = null;
changeContext = inverseRemove(models, this, EOPPOSITE_FEATURE_BASE - INTERNAL_MODELS, null, changeContext);
changeContext = basicUnsetModels(changeContext);
if (changeContext != null) dispatch(changeContext);
}
else
{
boolean oldModels_set_ = models_set_;
models_set_ = false;
if (isNotifying())
notify(ChangeKind.UNSET, INTERNAL_MODELS, null, null, oldModels_set_);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetModels()
{
return models_set_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XSDType getXsd()
{
return xsd;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext basicSetXsd(XSDType newXsd, ChangeContext changeContext)
{
XSDType oldXsd = xsd;
xsd = newXsd;
boolean oldXsd_set_ = xsd_set_;
xsd_set_ = true;
if (isNotifying())
{
addNotification(this, ChangeKind.SET, INTERNAL_XSD, oldXsd, newXsd, !oldXsd_set_, changeContext);
}
return changeContext;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setXsd(XSDType newXsd)
{
if (newXsd != xsd)
{
ChangeContext changeContext = null;
if (xsd != null)
changeContext = inverseRemove(xsd, this, OPPOSITE_FEATURE_BASE - INTERNAL_XSD, null, changeContext);
if (newXsd != null)
changeContext = inverseAdd(newXsd, this, OPPOSITE_FEATURE_BASE - INTERNAL_XSD, null, changeContext);
changeContext = basicSetXsd(newXsd, changeContext);
if (changeContext != null) dispatch(changeContext);
}
else
{
boolean oldXsd_set_ = xsd_set_;
xsd_set_ = true;
if (isNotifying())
notify(ChangeKind.SET, INTERNAL_XSD, newXsd, newXsd, !oldXsd_set_);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext basicUnsetXsd(ChangeContext changeContext)
{
XSDType oldXsd = xsd;
xsd = null;
boolean oldXsd_set_ = xsd_set_;
xsd_set_ = false;
if (isNotifying())
{
addNotification(this, ChangeKind.UNSET, INTERNAL_XSD, oldXsd, null, !oldXsd_set_, changeContext);
}
return changeContext;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetXsd()
{
if (xsd != null)
{
ChangeContext changeContext = null;
changeContext = inverseRemove(xsd, this, EOPPOSITE_FEATURE_BASE - INTERNAL_XSD, null, changeContext);
changeContext = basicUnsetXsd(changeContext);
if (changeContext != null) dispatch(changeContext);
}
else
{
boolean oldXsd_set_ = xsd_set_;
xsd_set_ = false;
if (isNotifying())
notify(ChangeKind.UNSET, INTERNAL_XSD, null, null, oldXsd_set_);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetXsd()
{
return xsd_set_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeSummary getChangeSummary()
{
return changeSummary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setChangeSummary(ChangeSummary newChangeSummary)
{
ChangeSummary oldChangeSummary = changeSummary;
changeSummary = newChangeSummary;
boolean oldChangeSummary_set_ = changeSummary_set_;
changeSummary_set_ = true;
if (isNotifying())
notify(ChangeKind.SET, INTERNAL_CHANGE_SUMMARY, oldChangeSummary, changeSummary, !oldChangeSummary_set_);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetChangeSummary()
{
ChangeSummary oldChangeSummary = changeSummary;
boolean oldChangeSummary_set_ = changeSummary_set_;
changeSummary = CHANGE_SUMMARY_DEFAULT_;
changeSummary_set_ = false;
if (isNotifying())
notify(ChangeKind.UNSET, INTERNAL_CHANGE_SUMMARY, oldChangeSummary, CHANGE_SUMMARY_DEFAULT_, oldChangeSummary_set_);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetChangeSummary()
{
return changeSummary_set_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Sequence getAnyAttribute()
{
if (anyAttribute == null)
{
anyAttribute = createSequence(INTERNAL_ANY_ATTRIBUTE);
}
return anyAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
switch (propertyIndex)
{
case MODELS:
return basicUnsetModels(changeContext);
case XSD:
return basicUnsetXsd(changeContext);
case ANY_ATTRIBUTE:
return removeFromSequence(getAnyAttribute(), otherEnd, changeContext);
}
return super.inverseRemove(otherEnd, propertyIndex, changeContext);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case MODELS:
return getModels();
case XSD:
return getXsd();
case CHANGE_SUMMARY:
return getChangeSummary();
case ANY_ATTRIBUTE:
// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
//if (coreType)
return getAnyAttribute();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case MODELS:
setModels((ModelsType)newValue);
return;
case XSD:
setXsd((XSDType)newValue);
return;
case CHANGE_SUMMARY:
setChangeSummary((ChangeSummary)newValue);
return;
case ANY_ATTRIBUTE:
setSequence(getAnyAttribute(), newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case MODELS:
unsetModels();
return;
case XSD:
unsetXsd();
return;
case CHANGE_SUMMARY:
unsetChangeSummary();
return;
case ANY_ATTRIBUTE:
unsetSequence(getAnyAttribute());
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case MODELS:
return isSetModels();
case XSD:
return isSetXsd();
case CHANGE_SUMMARY:
return isSetChangeSummary();
case ANY_ATTRIBUTE:
return anyAttribute != null && !isSequenceEmpty(getAnyAttribute());
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (changeSummary: ");
if (changeSummary_set_) result.append(changeSummary); else result.append("<unset>");
result.append(", anyAttribute: ");
result.append(anyAttribute);
result.append(')');
return result.toString();
}
} //BaseDataGraphTypeImpl

View file

@ -0,0 +1,258 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.model.DataGraphType;
import org.apache.tuscany.sdo.model.ModelFactory;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Graph Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DataGraphTypeImpl extends BaseDataGraphTypeImpl implements DataGraphType
{
public final static int ANY = BaseDataGraphTypeImpl.EXTENDED_PROPERTY_COUNT + -1;
public final static int SDO_PROPERTY_COUNT = BaseDataGraphTypeImpl.SDO_PROPERTY_COUNT + 0;
public final static int EXTENDED_PROPERTY_COUNT = BaseDataGraphTypeImpl.EXTENDED_PROPERTY_COUNT - 1;
/**
* The internal feature id for the '<em><b>Models</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_MODELS = BaseDataGraphTypeImpl.INTERNAL_MODELS;
/**
* The internal feature id for the '<em><b>Xsd</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_XSD = BaseDataGraphTypeImpl.INTERNAL_XSD;
/**
* The internal feature id for the '<em><b>Change Summary</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_CHANGE_SUMMARY = BaseDataGraphTypeImpl.INTERNAL_CHANGE_SUMMARY;
/**
* The internal feature id for the '<em><b>Any Attribute</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY_ATTRIBUTE = BaseDataGraphTypeImpl.INTERNAL_ANY_ATTRIBUTE;
/**
* The internal feature id for the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY = BaseDataGraphTypeImpl.INTERNAL_PROPERTY_COUNT + 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = BaseDataGraphTypeImpl.INTERNAL_PROPERTY_COUNT + 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_MODELS: return MODELS;
case INTERNAL_XSD: return XSD;
case INTERNAL_CHANGE_SUMMARY: return CHANGE_SUMMARY;
case INTERNAL_ANY_ATTRIBUTE: return ANY_ATTRIBUTE;
case INTERNAL_ANY: return ANY;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAny()
* @generated
* @ordered
*/
protected Sequence any = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataGraphTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getDataGraphType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Sequence getAny()
{
if (any == null)
{
any = createSequence(INTERNAL_ANY);
}
return any;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
switch (propertyIndex)
{
case ANY:
return removeFromSequence(getAny(), otherEnd, changeContext);
}
return super.inverseRemove(otherEnd, propertyIndex, changeContext);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case ANY:
// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
//if (coreType)
return getAny();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case ANY:
setSequence(getAny(), newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
unsetSequence(getAny());
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
return any != null && !isSequenceEmpty(getAny());
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (any: ");
result.append(any);
result.append(')');
return result.toString();
}
} //DataGraphTypeImpl

View file

@ -0,0 +1,84 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.DataObject;
import org.apache.tuscany.sdo.model.ModelFactory;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Object</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public abstract class DataObjectImpl extends DataObjectBase implements DataObject
{
public final static int SDO_PROPERTY_COUNT = 0;
public final static int EXTENDED_PROPERTY_COUNT = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 0;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
}
return super.internalConvertIndex(internalIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObjectImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getDataObject();
}
} //DataObjectImpl

View file

@ -0,0 +1,220 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.ModelsType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Models Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.ModelsTypeImpl#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ModelsTypeImpl extends DataObjectBase implements ModelsType
{
public final static int ANY = -1;
public final static int SDO_PROPERTY_COUNT = 0;
public final static int EXTENDED_PROPERTY_COUNT = -1;
/**
* The internal feature id for the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_ANY: return ANY;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAny()
* @generated
* @ordered
*/
protected Sequence any = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelsTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getModelsType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Sequence getAny()
{
if (any == null)
{
any = createSequence(INTERNAL_ANY);
}
return any;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
switch (propertyIndex)
{
case ANY:
return removeFromSequence(getAny(), otherEnd, changeContext);
}
return super.inverseRemove(otherEnd, propertyIndex, changeContext);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case ANY:
// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
//if (coreType)
return getAny();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case ANY:
setSequence(getAny(), newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
unsetSequence(getAny());
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
return any != null && !isSequenceEmpty(getAny());
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (any: ");
result.append(any);
result.append(')');
return result.toString();
}
} //ModelsTypeImpl

View file

@ -0,0 +1,206 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Type;
import java.util.Collection;
import java.util.List;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.TextType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Text Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.TextTypeImpl#getText <em>Text</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class TextTypeImpl extends DataObjectBase implements TextType
{
public final static int TEXT = 0;
public final static int SDO_PROPERTY_COUNT = 1;
public final static int EXTENDED_PROPERTY_COUNT = 0;
/**
* The internal feature id for the '<em><b>Text</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_TEXT = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_TEXT: return TEXT;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getText() <em>Text</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected List text = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TextTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getTextType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getText()
{
if (text == null)
{
text = createPropertyList(ListKind.DATATYPE, String.class, TEXT, 0);
}
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case TEXT:
return getText();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case TEXT:
getText().clear();
getText().addAll((Collection)newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case TEXT:
getText().clear();
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case TEXT:
return text != null && !text.isEmpty();
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (text: ");
result.append(text);
result.append(')');
return result.toString();
}
} //TextTypeImpl

View file

@ -0,0 +1,210 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Type;
import java.util.Collection;
import java.util.List;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.Types;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Types</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.TypesImpl#getType_ <em>Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TypesImpl extends DataObjectBase implements Types
{
public final static int TYPE = 0;
public final static int SDO_PROPERTY_COUNT = 1;
public final static int EXTENDED_PROPERTY_COUNT = 0;
/**
* The internal feature id for the '<em><b>Type</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_TYPE = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_TYPE: return TYPE;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getType_() <em>Type</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType_()
* @generated
* @ordered
*/
protected List type = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypesImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getTypes();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getType_()
{
if (type == null)
{
type = createPropertyList(ListKind.CONTAINMENT, org.apache.tuscany.sdo.model.Type.class, TYPE, 0);
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
switch (propertyIndex)
{
case TYPE:
return removeFromList(getType_(), otherEnd, changeContext);
}
return super.inverseRemove(otherEnd, propertyIndex, changeContext);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case TYPE:
return getType_();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case TYPE:
getType_().clear();
getType_().addAll((Collection)newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case TYPE:
getType_().clear();
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case TYPE:
return type != null && !type.isEmpty();
}
return super.isSet(propertyIndex);
}
public List getTypeList()
{
return getType_();
}
} //TypesImpl

View file

@ -0,0 +1,220 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.impl;
import commonj.sdo.Sequence;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.XSDType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>XSD Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.impl.XSDTypeImpl#getAny <em>Any</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class XSDTypeImpl extends DataObjectBase implements XSDType
{
public final static int ANY = -1;
public final static int SDO_PROPERTY_COUNT = 0;
public final static int EXTENDED_PROPERTY_COUNT = -1;
/**
* The internal feature id for the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_ANY: return ANY;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAny()
* @generated
* @ordered
*/
protected Sequence any = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XSDTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((ModelFactoryImpl)ModelFactory.INSTANCE).getXSDType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Sequence getAny()
{
if (any == null)
{
any = createSequence(INTERNAL_ANY);
}
return any;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
{
switch (propertyIndex)
{
case ANY:
return removeFromSequence(getAny(), otherEnd, changeContext);
}
return super.inverseRemove(otherEnd, propertyIndex, changeContext);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case ANY:
// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
//if (coreType)
return getAny();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case ANY:
setSequence(getAny(), newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
unsetSequence(getAny());
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case ANY:
return any != null && !isSequenceEmpty(getAny());
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (any: ");
result.append(any);
result.append(')');
return result.toString();
}
} //XSDTypeImpl

View file

@ -0,0 +1,52 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.internal;
import commonj.sdo.helper.HelperContext;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @generated
*/
public interface InternalFactory
{
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
InternalFactory INSTANCE = org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init();
/**
* Registers the types supported by this Factory within the supplied scope.argument
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param scope an instance of HelperContext used to manage the scoping of types.
* @generated
*/
public void register(HelperContext scope);
} //InternalFactory

View file

@ -0,0 +1,296 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.internal.impl;
import commonj.sdo.helper.HelperContext;
import org.apache.tuscany.sdo.helper.TypeHelperImpl;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.FactoryBase;
import org.apache.tuscany.sdo.model.internal.*;
import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;
/**
* <!-- begin-user-doc -->
* An implementation of the commonj.sdo.internal model factory.
* This model is generated from sdoInternal.xsd, in the tuscany-sdo-impl project.
* Until the SDO code generator supports regen/merge, follow the following steps to regenerate this model:
* 1. Regenerate the model into a temporary directory:
* XSD2JavaGenerator -generateBuiltIn http://www.apache.org/tuscany/commonj.sdo.internal -targetDirectory <temp-dir> -javaPackage org.apache.tuscany.sdo.model.internal <tuscany-sdo-impl-dir>/src/main/resources/xml/sdoInternal.xsd
* 2. Delete all the createXXXFromString() and convertXXXToString() methods in the newly generated InternalFactoryImpl and
* replace them with the ones from this file (resolve any missing imports).
* 3. Comment out all simple depedencies (SDOUtil.registerStaticTypes calls) in the init() method.
* 4. Make sure the top of each generated file contains the ASF License.
* 5. Move this JavaDoc comment into the newly generated ModelFactoryImpl class.
* <!-- end-user-doc -->
* @generated
*/
public class InternalFactoryImpl extends FactoryBase implements InternalFactory
{
/**
* The package namespace URI.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String NAMESPACE_URI = "http://www.apache.org/tuscany/commonj.sdo.internal";
/**
* The package namespace name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String NAMESPACE_PREFIX = "internal";
/**
* The version of the generator pattern used to generate this class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String PATTERN_VERSION = "1.2";
public static final int BASE64_BYTES = 1;
public static final int QNAME = 2;
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InternalFactoryImpl()
{
super(NAMESPACE_URI, NAMESPACE_PREFIX, "org.apache.tuscany.sdo.model.internal");
}
/**
* Registers the Factory instance so that it is available within the supplied scope.
* @argument scope a HelperContext instance that will make the types supported by this Factory available.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void register(HelperContext scope)
{
if(scope == null) {
throw new IllegalArgumentException("Scope can not be null");
}
//Register dependent packages with provided scope
// Initialize this package
TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper();
th.getExtendedMetaData().putPackage(NAMESPACE_URI, this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject create(int typeNumber)
{
switch (typeNumber)
{
default:
return super.create(typeNumber);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object createFromString(int typeNumber, String initialValue)
{
switch (typeNumber)
{
case BASE64_BYTES:
return createBase64BytesFromString(initialValue);
case QNAME:
return createQNameFromString(initialValue);
default:
throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertToString(int typeNumber, Object instanceValue)
{
switch (typeNumber)
{
case BASE64_BYTES:
return convertBase64BytesToString(instanceValue);
case QNAME:
return convertQNameToString(instanceValue);
default:
throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");
}
}
// Following creates and initializes SDO metadata for the supported types.
protected Type base64BytesType = null;
public Type getBase64Bytes()
{
return base64BytesType;
}
protected Type qNameType = null;
public Type getQName()
{
return qNameType;
}
private static InternalFactoryImpl instance = null;
public static InternalFactoryImpl init()
{
if (instance != null ) return instance;
instance = new InternalFactoryImpl();
// Initialize dependent packages
// Create package meta-data objects
instance.createMetaData();
// Initialize created meta-data
instance.initializeMetaData();
// Mark meta-data to indicate it can't be changed
//theInternalFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
return instance;
}
private boolean isCreated = false;
public void createMetaData()
{
if (isCreated) return;
isCreated = true;
// Create data types
base64BytesType = createType(true, BASE64_BYTES );
qNameType = createType(true, QNAME );
}
private boolean isInitialized = false;
public void initializeMetaData()
{
if (isInitialized) return;
isInitialized = true;
Property property = null;
// Add supertypes to types
// Initialize types and properties
// Initialize data types
initializeType(base64BytesType, byte[].class, "Base64Bytes", true, false);
setInstanceProperty (base64BytesType, "commonj.sdo/java", "instanceClass", "byte[]");
initializeType(qNameType, String.class, "QName", true, false);
setInstanceProperty (qNameType, "commonj.sdo/java", "instanceClass", "java.lang.String");
createXSDMetaData();
}
protected void createXSDMetaData()
{
super.initXSD();
Property property = null;
addXSDMapping
(base64BytesType,
new String[]
{
"name", "Base64Bytes"
});
addXSDMapping
(qNameType,
new String[]
{
"name", "QName"
});
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public byte[] createBase64BytesFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createBase64Binary(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertBase64BytesToString(Object instanceValue)
{
if (instanceValue instanceof byte[]) {
return XMLTypeFactory.eINSTANCE.convertBase64Binary((byte[])instanceValue);
} else {
return XMLTypeFactory.eINSTANCE.convertBase64Binary(instanceValue.toString().getBytes());
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String createQNameFromString(String initialValue)
{
return (String)super.createFromString(QNAME, initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertQNameToString(Object instanceValue)
{
return super.convertToString(QNAME, instanceValue);
}
} //InternalFactoryImpl

View file

@ -0,0 +1,61 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.java;
import commonj.sdo.helper.HelperContext;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @generated
*/
public interface JavaFactory
{
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
JavaFactory INSTANCE = org.apache.tuscany.sdo.model.java.impl.JavaFactoryImpl.init();
/**
* Returns a new object of class '<em>Info</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Info</em>'.
* @generated
*/
JavaInfo createJavaInfo();
/**
* Registers the types supported by this Factory within the supplied scope.argument
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param scope an instance of HelperContext used to manage the scoping of types.
* @generated
*/
public void register(HelperContext scope);
} //JavaFactory

View file

@ -0,0 +1,92 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.java;
import java.io.Serializable;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Info</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass <em>Java Class</em>}</li>
* </ul>
* </p>
*
* @extends Serializable
* @generated
*/
public interface JavaInfo extends Serializable
{
/**
* Returns the value of the '<em><b>Java Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Java Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Java Class</em>' attribute.
* @see #isSetJavaClass()
* @see #unsetJavaClass()
* @see #setJavaClass(String)
* @generated
*/
String getJavaClass();
/**
* Sets the value of the '{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass <em>Java Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Java Class</em>' attribute.
* @see #isSetJavaClass()
* @see #unsetJavaClass()
* @see #getJavaClass()
* @generated
*/
void setJavaClass(String value);
/**
* Unsets the value of the '{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass <em>Java Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetJavaClass()
* @see #getJavaClass()
* @see #setJavaClass(String)
* @generated
*/
void unsetJavaClass();
/**
* Returns whether the value of the '{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass <em>Java Class</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Java Class</em>' attribute is set.
* @see #unsetJavaClass()
* @see #getJavaClass()
* @see #setJavaClass(String)
* @generated
*/
boolean isSetJavaClass();
} // JavaInfo

View file

@ -0,0 +1,659 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.java.impl;
import commonj.sdo.helper.HelperContext;
import org.apache.tuscany.sdo.helper.TypeHelperImpl;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.FactoryBase;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
import org.apache.tuscany.sdo.model.java.*;
import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;
import org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the commonj.sdo/java model factory.
* This model is generated from sdoJava.xsd, in the sdo-api project.
* Until the SDO code generator supports name conflicts and regen/merge, follow the following steps to regenerate this model:
* 1. Regenerate the model into a temporary directory:
* XSD2JavaGenerator -generateBuiltIn commonj.sdo/java -targetDirectory <temp-dir> -javaPackage org.apache.tuscany.sdo.model.java <sdo-api-dir>/src/main/resources/xml/sdoJava.xsd
* 2. Delete all the createXXXFromString() and convertXXXToString() methods in the newly generated JavaFactoryImpl and
* replace them with the ones from this file.
* 3. Make sure the top of each generated file contains the ASF License.
* 4. Move this JavaDoc comment into the newly generated JavaFactoryImpl class.
* <!-- end-user-doc -->
* @generated
*/
public class JavaFactoryImpl extends FactoryBase implements JavaFactory
{
/**
* The package namespace URI.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String NAMESPACE_URI = "commonj.sdo/java";
/**
* The package namespace name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String NAMESPACE_PREFIX = "sdoJava";
/**
* The version of the generator pattern used to generate this class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String PATTERN_VERSION = "1.2";
public static final int JAVA_INFO = 1;
public static final int BOOLEAN_OBJECT = 2;
public static final int BYTE_OBJECT = 3;
public static final int CHARACTER_OBJECT = 4;
public static final int DOUBLE_OBJECT = 5;
public static final int FLOAT_OBJECT = 6;
public static final int INT_OBJECT = 7;
public static final int LONG_OBJECT = 8;
public static final int SHORT_OBJECT = 9;
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JavaFactoryImpl()
{
super(NAMESPACE_URI, NAMESPACE_PREFIX, "org.apache.tuscany.sdo.model.java");
}
/**
* Registers the Factory instance so that it is available within the supplied scope.
* @argument scope a HelperContext instance that will make the types supported by this Factory available.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void register(HelperContext scope)
{
if(scope == null) {
throw new IllegalArgumentException("Scope can not be null");
}
//Register dependent packages with provided scope
ModelFactory.INSTANCE.register(scope);
// Initialize this package
TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper();
th.getExtendedMetaData().putPackage(NAMESPACE_URI, this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataObject create(int typeNumber)
{
switch (typeNumber)
{
case JAVA_INFO: return (DataObject)createJavaInfo();
default:
return super.create(typeNumber);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object createFromString(int typeNumber, String initialValue)
{
switch (typeNumber)
{
case BOOLEAN_OBJECT:
return createBooleanObjectFromString(initialValue);
case BYTE_OBJECT:
return createByteObjectFromString(initialValue);
case CHARACTER_OBJECT:
return createCharacterObjectFromString(initialValue);
case DOUBLE_OBJECT:
return createDoubleObjectFromString(initialValue);
case FLOAT_OBJECT:
return createFloatObjectFromString(initialValue);
case INT_OBJECT:
return createIntObjectFromString(initialValue);
case LONG_OBJECT:
return createLongObjectFromString(initialValue);
case SHORT_OBJECT:
return createShortObjectFromString(initialValue);
default:
throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertToString(int typeNumber, Object instanceValue)
{
switch (typeNumber)
{
case BOOLEAN_OBJECT:
return convertBooleanObjectToString(instanceValue);
case BYTE_OBJECT:
return convertByteObjectToString(instanceValue);
case CHARACTER_OBJECT:
return convertCharacterObjectToString(instanceValue);
case DOUBLE_OBJECT:
return convertDoubleObjectToString(instanceValue);
case FLOAT_OBJECT:
return convertFloatObjectToString(instanceValue);
case INT_OBJECT:
return convertIntObjectToString(instanceValue);
case LONG_OBJECT:
return convertLongObjectToString(instanceValue);
case SHORT_OBJECT:
return convertShortObjectToString(instanceValue);
default:
throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JavaInfo createJavaInfo()
{
JavaInfoImpl javaInfo = new JavaInfoImpl();
return javaInfo;
}
// Following creates and initializes SDO metadata for the supported types.
protected Type javaInfoType = null;
public Type getJavaInfo()
{
return javaInfoType;
}
protected Type booleanObjectType = null;
public Type getBooleanObject()
{
return booleanObjectType;
}
protected Type byteObjectType = null;
public Type getByteObject()
{
return byteObjectType;
}
protected Type characterObjectType = null;
public Type getCharacterObject()
{
return characterObjectType;
}
protected Type doubleObjectType = null;
public Type getDoubleObject()
{
return doubleObjectType;
}
protected Type floatObjectType = null;
public Type getFloatObject()
{
return floatObjectType;
}
protected Type intObjectType = null;
public Type getIntObject()
{
return intObjectType;
}
protected Type longObjectType = null;
public Type getLongObject()
{
return longObjectType;
}
protected Type shortObjectType = null;
public Type getShortObject()
{
return shortObjectType;
}
private static JavaFactoryImpl instance = null;
public static JavaFactoryImpl init()
{
if (instance != null ) return instance;
instance = new JavaFactoryImpl();
// Initialize dependent packages
ModelFactory ModelFactoryInstance = ModelFactory.INSTANCE;
// Create package meta-data objects
instance.createMetaData();
// Initialize created meta-data
instance.initializeMetaData();
// Mark meta-data to indicate it can't be changed
//theJavaFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
return instance;
}
private boolean isCreated = false;
public void createMetaData()
{
if (isCreated) return;
isCreated = true;
// Create types and their properties
javaInfoType = createType(false, JAVA_INFO);
createProperty(true, javaInfoType,JavaInfoImpl.INTERNAL_JAVA_CLASS);
// Create data types
booleanObjectType = createType(true, BOOLEAN_OBJECT );
byteObjectType = createType(true, BYTE_OBJECT );
characterObjectType = createType(true, CHARACTER_OBJECT );
doubleObjectType = createType(true, DOUBLE_OBJECT );
floatObjectType = createType(true, FLOAT_OBJECT );
intObjectType = createType(true, INT_OBJECT );
longObjectType = createType(true, LONG_OBJECT );
shortObjectType = createType(true, SHORT_OBJECT );
}
private boolean isInitialized = false;
public void initializeMetaData()
{
if (isInitialized) return;
isInitialized = true;
// Obtain other dependent packages
ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)ModelFactory.INSTANCE;
Property property = null;
// Add supertypes to types
// Initialize types and properties
initializeType(javaInfoType, JavaInfo.class, "JavaInfo", false);
property = getLocalProperty(javaInfoType, 0);
initializeProperty(property, theModelPackageImpl.getString(), "javaClass", null, 0, 1, JavaInfo.class, false, true, false);
// Initialize data types
initializeType(booleanObjectType, Boolean.class, "BooleanObject", true, false);
setInstanceProperty (booleanObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Boolean");
initializeType(byteObjectType, Byte.class, "ByteObject", true, false);
setInstanceProperty (byteObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Byte");
initializeType(characterObjectType, Character.class, "CharacterObject", true, false);
setInstanceProperty (characterObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Character");
initializeType(doubleObjectType, Double.class, "DoubleObject", true, false);
setInstanceProperty (doubleObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Double");
initializeType(floatObjectType, Float.class, "FloatObject", true, false);
setInstanceProperty (floatObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Float");
initializeType(intObjectType, Integer.class, "IntObject", true, false);
setInstanceProperty (intObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Integer");
initializeType(longObjectType, Long.class, "LongObject", true, false);
setInstanceProperty (longObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Long");
initializeType(shortObjectType, Short.class, "ShortObject", true, false);
setInstanceProperty (shortObjectType, "commonj.sdo/java", "instanceClass", "java.lang.Short");
createXSDMetaData(theModelPackageImpl);
}
protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
{
super.initXSD();
Property property = null;
property = createGlobalProperty
("extendedInstanceClass",
theModelPackageImpl.getString(),
new String[]
{
"kind", "attribute",
"name", "extendedInstanceClass",
"namespace", "##targetNamespace"
},
IS_ATTRIBUTE);
property = createGlobalProperty
("instanceClass",
theModelPackageImpl.getString(),
new String[]
{
"kind", "attribute",
"name", "instanceClass",
"namespace", "##targetNamespace"
},
IS_ATTRIBUTE);
property = createGlobalProperty
("javaClass",
theModelPackageImpl.getString(),
new String[]
{
"kind", "attribute",
"name", "javaClass",
"namespace", "##targetNamespace"
},
IS_ATTRIBUTE);
property = createGlobalProperty
("nestedInterfaces",
theModelPackageImpl.getBoolean(),
new String[]
{
"kind", "attribute",
"name", "nestedInterfaces",
"namespace", "##targetNamespace"
},
IS_ATTRIBUTE);
property = createGlobalProperty
("package",
theModelPackageImpl.getString(),
new String[]
{
"kind", "attribute",
"name", "package",
"namespace", "##targetNamespace"
},
IS_ATTRIBUTE);
addXSDMapping
(javaInfoType,
new String[]
{
"name", "JavaInfo",
"kind", "empty"
});
addXSDMapping
(getProperty(javaInfoType, JavaInfoImpl.INTERNAL_JAVA_CLASS),
new String[]
{
"kind", "attribute",
"name", "javaClass"
});
addXSDMapping
(booleanObjectType,
new String[]
{
"name", "BooleanObject"
});
addXSDMapping
(byteObjectType,
new String[]
{
"name", "ByteObject"
});
addXSDMapping
(characterObjectType,
new String[]
{
"name", "CharacterObject"
});
addXSDMapping
(doubleObjectType,
new String[]
{
"name", "DoubleObject"
});
addXSDMapping
(floatObjectType,
new String[]
{
"name", "FloatObject"
});
addXSDMapping
(intObjectType,
new String[]
{
"name", "IntObject"
});
addXSDMapping
(longObjectType,
new String[]
{
"name", "LongObject"
});
addXSDMapping
(shortObjectType,
new String[]
{
"name", "ShortObject"
});
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Boolean createBooleanObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createBooleanObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertBooleanObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertBooleanObject((Boolean)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Byte createByteObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createByteObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertByteObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertByteObject((Byte)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Character createCharacterObjectFromString(String initialValue)
{
return (initialValue == null && initialValue.length() > 0)
? null : (new Character(XMLTypeUtil.normalize(initialValue, true).charAt(0)));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertCharacterObjectToString(Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Double createDoubleObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createDoubleObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertDoubleObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertDoubleObject((Double)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Float createFloatObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createFloatObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertFloatObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertFloatObject((Float)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Integer createIntObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createIntObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertIntObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertIntObject((Integer)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Long createLongObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createLongObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertLongObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertLongObject((Long)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Short createShortObjectFromString(String initialValue)
{
return XMLTypeFactory.eINSTANCE.createShortObject(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertShortObjectToString(Object instanceValue)
{
return XMLTypeFactory.eINSTANCE.convertShortObject((Short)instanceValue);
}
} //JavaFactoryImpl

View file

@ -0,0 +1,256 @@
/**
*
* 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
*
* http://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.tuscany.sdo.model.java.impl;
import commonj.sdo.Type;
import org.apache.tuscany.sdo.impl.DataObjectBase;
import org.apache.tuscany.sdo.model.java.JavaFactory;
import org.apache.tuscany.sdo.model.java.JavaInfo;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Info</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl#getJavaClass <em>Java Class</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class JavaInfoImpl extends DataObjectBase implements JavaInfo
{
public final static int JAVA_CLASS = 0;
public final static int SDO_PROPERTY_COUNT = 1;
public final static int EXTENDED_PROPERTY_COUNT = 0;
/**
* The internal feature id for the '<em><b>Java Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_JAVA_CLASS = 0;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 1;
protected int internalConvertIndex(int internalIndex)
{
switch (internalIndex)
{
case INTERNAL_JAVA_CLASS: return JAVA_CLASS;
}
return super.internalConvertIndex(internalIndex);
}
/**
* The default value of the '{@link #getJavaClass() <em>Java Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJavaClass()
* @generated
* @ordered
*/
protected static final String JAVA_CLASS_DEFAULT_ = null;
/**
* The cached value of the '{@link #getJavaClass() <em>Java Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJavaClass()
* @generated
* @ordered
*/
protected String javaClass = JAVA_CLASS_DEFAULT_;
/**
* This is true if the Java Class attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean javaClass_set_ = false;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JavaInfoImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getStaticType()
{
return ((JavaFactoryImpl)JavaFactory.INSTANCE).getJavaInfo();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getJavaClass()
{
return javaClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setJavaClass(String newJavaClass)
{
String oldJavaClass = javaClass;
javaClass = newJavaClass;
boolean oldJavaClass_set_ = javaClass_set_;
javaClass_set_ = true;
if (isNotifying())
notify(ChangeKind.SET, INTERNAL_JAVA_CLASS, oldJavaClass, javaClass, !oldJavaClass_set_);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetJavaClass()
{
String oldJavaClass = javaClass;
boolean oldJavaClass_set_ = javaClass_set_;
javaClass = JAVA_CLASS_DEFAULT_;
javaClass_set_ = false;
if (isNotifying())
notify(ChangeKind.UNSET, INTERNAL_JAVA_CLASS, oldJavaClass, JAVA_CLASS_DEFAULT_, oldJavaClass_set_);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetJavaClass()
{
return javaClass_set_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object get(int propertyIndex, boolean resolve)
{
switch (propertyIndex)
{
case JAVA_CLASS:
return getJavaClass();
}
return super.get(propertyIndex, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void set(int propertyIndex, Object newValue)
{
switch (propertyIndex)
{
case JAVA_CLASS:
setJavaClass((String)newValue);
return;
}
super.set(propertyIndex, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unset(int propertyIndex)
{
switch (propertyIndex)
{
case JAVA_CLASS:
unsetJavaClass();
return;
}
super.unset(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSet(int propertyIndex)
{
switch (propertyIndex)
{
case JAVA_CLASS:
return isSetJavaClass();
}
return super.isSet(propertyIndex);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString()
{
if (isProxy(this)) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (javaClass: ");
if (javaClass_set_) result.append(javaClass); else result.append("<unset>");
result.append(')');
return result.toString();
}
} //JavaInfoImpl

Some files were not shown because too many files have changed in this diff Show more