diff --git a/sdo-java/branches/emf-2.5/BUILDING b/sdo-java/branches/emf-2.5/BUILDING
new file mode 100644
index 0000000000..ff5e3a29f9
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/BUILDING
@@ -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.
+
+
diff --git a/sdo-java/branches/emf-2.5/LICENSE b/sdo-java/branches/emf-2.5/LICENSE
new file mode 100644
index 0000000000..e05521b589
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/LICENSE
@@ -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
+=================================================================================================================
diff --git a/sdo-java/branches/emf-2.5/NOTICE b/sdo-java/branches/emf-2.5/NOTICE
new file mode 100644
index 0000000000..1df9707552
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/NOTICE
@@ -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.
diff --git a/sdo-java/branches/emf-2.5/README b/sdo-java/branches/emf-2.5/README
new file mode 100644
index 0000000000..d8178f7a37
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/README
@@ -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
+
+
+
+
diff --git a/sdo-java/branches/emf-2.5/RELEASE_NOTES b/sdo-java/branches/emf-2.5/RELEASE_NOTES
new file mode 100644
index 0000000000..4d409118c3
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/RELEASE_NOTES
@@ -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
+.....
diff --git a/sdo-java/branches/emf-2.5/distribution/pom.xml b/sdo-java/branches/emf-2.5/distribution/pom.xml
new file mode 100644
index 0000000000..cc8df2d3ee
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/distribution/pom.xml
@@ -0,0 +1,137 @@
+
+
+
+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.
+ * The following features are implemented: + *
+ *
+ * + * @generated + */ +public class AttributeImpl extends EAttributeImpl implements Property +{ + /** + * + * + * @generated + */ + protected AttributeImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getAttribute(); + } + + /** + * + * + * @generated NOT + */ + public Object getDefault() + { + return getDefaultValue(); + } + + /** + * + * + * @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; + + /** + * + * + * @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(); + + /** + * + * + * @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; + } + + /** + * + * + * @generated NOT + */ + public Type getContainingType() + { + return (Type)getEContainingClass(); + } + + /** + * + * + * @generated NOT + */ + public Property getOpposite() + { + return null; + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java new file mode 100644 index 0000000000..bbf85ecab6 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java @@ -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; + + +/** + * + * An implementation of the model object 'EChange Summary'. + * + *+ * The following features are implemented: + *
+ *
+ * + * @generated + */ +public class ChangeSummarySettingImpl extends FeatureChangeImpl implements ChangeSummary.Setting +{ + /** + * + * + * @generated + */ + protected ChangeSummarySettingImpl() + { + super(); + } + + protected ChangeSummarySettingImpl(EStructuralFeature feature, Object value, boolean isSet) + { + super(feature, value, isSet); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.Literals.CHANGE_SUMMARY_SETTING; + } + + /** + * + * + * @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(); + } + } + + /** + * + * + * @generated NOT + */ + public Property getProperty() + { + return (Property)getFeature(); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet() + { + return super.isSet(); + } + +} //EChangeSummarySettingImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java new file mode 100644 index 0000000000..d49ba2bf19 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java @@ -0,0 +1,1049 @@ +/** + * + * 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.ArrayList; +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.model.ModelFactory; +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; +import org.apache.tuscany.sdo.util.BasicSequence; +import org.apache.tuscany.sdo.util.DataObjectUtil; +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.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EClassImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.FeatureMapUtil; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; +import java.lang.Class; + +/** + * An implementation of the model object ' + * Class'. + *+ *
+ * + * @generated + */ +public class ClassImpl extends EClassImpl implements Type, + org.apache.tuscany.sdo.model.Type/* , DataObject */ +{ + private static final long serialVersionUID = 1L; + + private static final Property UNINITIALIZED_PROPERTY = SDOFactory.eINSTANCE + .createAttribute(); + + private Property changeSummaryPropertyCache = UNINITIALIZED_PROPERTY; + + /** + * + * + * @generated + */ + protected ClassImpl() { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() { + return SDOPackage.eINSTANCE.getClass_(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() { + return getEPackage().getNsURI(); + } + + /** + * + */ + public Class getInstanceClass() { + // TODO verify!!! + return super.getInstanceClass(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() { + final List properties = getExtendedProperties(); + if (properties != Collections.EMPTY_LIST) { + for (int i = 0, count = properties.size(); i < count; ++i) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) properties + .get(i); + if (isOpenFeatureMap(eStructuralFeature)) + return true; + } + } + + for (final Iterator iterator = getBaseTypes().iterator(); iterator + .hasNext();) { + Type baseType = (Type) iterator.next(); + if (baseType.isOpen()) + return true; + } + + return false; + } + + private static final EStructuralFeature UNINITIALIZED_SEQUENCE_FEATURE = (EAttribute) SDOFactory.eINSTANCE + .createAttribute(); + protected static final EStructuralFeature VIRTUAL_SEQUENCE_FEATURE = (EAttribute) SDOFactory.eINSTANCE + .createAttribute(); + + private EStructuralFeature sequenceFeature = UNINITIALIZED_SEQUENCE_FEATURE; + + public EStructuralFeature getSequenceFeature() { + if (sequenceFeature == UNINITIALIZED_SEQUENCE_FEATURE) { + EStructuralFeature sequenceFeatureCandidate = null; + boolean hasNonDerivedFeatures = false; + + for (Iterator iterator = getEAllStructuralFeatures().iterator(); iterator + .hasNext();) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) iterator + .next(); + if (!eStructuralFeature.isDerived()) { + if (sequenceFeatureCandidate == null + && isSequenceFeatureMap(eStructuralFeature)) + sequenceFeatureCandidate = eStructuralFeature; + else if (isElementFeature(eStructuralFeature) + && !DataObjectUtil + .isInternalProperty(eStructuralFeature)) + hasNonDerivedFeatures = true; + } + } + + sequenceFeature = sequenceFeatureCandidate != null + && hasNonDerivedFeatures ? VIRTUAL_SEQUENCE_FEATURE + : sequenceFeatureCandidate; + } + + return sequenceFeature; + } + + protected boolean isSequenceFeatureMap(EStructuralFeature eStructuralFeature) { + switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature)) { + case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE: + return eStructuralFeature.getUpperBound() != 1; + case ExtendedMetaData.GROUP_FEATURE: + return true; + } + return false; + } + + protected boolean isElementFeature(EStructuralFeature eStructuralFeature) { + switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature)) { + case ExtendedMetaData.ATTRIBUTE_FEATURE: + case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE: + return false; + } + return true; + } + + public List getVirtualSequenceProperties() { + List result = new ArrayList(); + for (Iterator iterator = getEAllStructuralFeatures().iterator(); iterator + .hasNext();) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) iterator + .next(); + if (!eStructuralFeature.isDerived() + && isElementFeature(eStructuralFeature)) + result.add(eStructuralFeature); + } + return result; + } + + public void setSequenceFeature(EAttribute sequenceFeature) { + getEStructuralFeatures().add(sequenceFeature); + this.sequenceFeature = sequenceFeature; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() { + return getSequenceFeature() != null; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() { + if (aliasNames == null) { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + protected List declaredProperties = null; + + public List getDeclaredProperties() { + if (declaredProperties == null) { + initPropertyLists(); + } + return declaredProperties; + } + + protected List extendedProperties = null; + + public List getExtendedProperties() { + if (extendedProperties == null) { + initPropertyLists(); + } + return extendedProperties; + } + + protected List getTypeFeatures() { + return getEStructuralFeatures(); + } + + protected void initPropertyLists() { + List declaredProperties = new ArrayList(); + List extendedProperties = Collections.EMPTY_LIST; + + for (Iterator i = getTypeFeatures().iterator(); i.hasNext();) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) i + .next(); + boolean isExtendedProperty = DataObjectUtil + .isInternalProperty(eStructuralFeature); + if (isExtendedProperty) { + if (extendedProperties == Collections.EMPTY_LIST) + extendedProperties = new ArrayList(); + extendedProperties.add(eStructuralFeature); + } else + declaredProperties.add(eStructuralFeature); + } + this.declaredProperties = declaredProperties; + this.extendedProperties = extendedProperties; + } + + public EList getEStructuralFeatures() { + if (eStructuralFeatures == null) { + eStructuralFeatures = new EObjectContainmentWithInverseEList( + EStructuralFeature.class, this, + EcorePackage.ECLASS__ESTRUCTURAL_FEATURES, + EcorePackage.ESTRUCTURAL_FEATURE__ECONTAINING_CLASS) { + protected void didChange() { + declaredProperties = extendedProperties = null; + } + }; + } + return eStructuralFeatures; + } + + protected List allProperties = null; + protected List allExtendedProperties = null; + protected EList allFeaturesCache = null; + + /** + * + * + * @generated NOT + */ + public List getProperties() { + final EList allFeatures = getEAllStructuralFeatures(); + if (allFeatures != allFeaturesCache) { + allFeaturesCache = allFeatures; + allProperties = allExtendedProperties = null; + } + if (allProperties == null) { + List allProperties = new UniqueEList(); + for (final Iterator iterator = getBaseTypes().iterator(); iterator + .hasNext();) { + Type baseType = (Type) iterator.next(); + allProperties.addAll(baseType.getProperties()); + } + allProperties.addAll(getDeclaredProperties()); + this.allProperties = allProperties; + } + return allProperties; + } + + public List getAllExtendedProperties() { + final EList allFeatures = getEAllStructuralFeatures(); + if (allFeatures != allFeaturesCache) { + allFeaturesCache = allFeatures; + allProperties = allExtendedProperties = null; + } + if (allExtendedProperties == null) { + List allExtendedProperties = new UniqueEList(); + for (final Iterator iterator = getBaseTypes().iterator(); iterator + .hasNext();) { + Type baseType = (Type) iterator.next(); + allExtendedProperties.addAll(((ClassImpl) baseType) + .getAllExtendedProperties()); + } + allExtendedProperties.addAll(getExtendedProperties()); + this.allExtendedProperties = allExtendedProperties; + } + return allExtendedProperties; + } + + protected boolean isOpenFeatureMap(EStructuralFeature eStructuralFeature) { + switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature)) { + case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE: + return eStructuralFeature != ExtendedMetaData.INSTANCE + .getMixedFeature(this); + case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE: + // FB I think this is wrong ... case ExtendedMetaData.GROUP_FEATURE: + return true; + } + return false; + } + + public void addOpenProperties(EObject dataObject, Collection propertyList) { + for (final Iterator iterator = getBaseTypes().iterator(); iterator + .hasNext();) { + ClassImpl baseType = (ClassImpl) iterator.next(); + baseType.addOpenProperties(dataObject, propertyList); + } + + for (final Iterator iter = getExtendedProperties().iterator(); iter + .hasNext();) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) iter + .next(); + if (isOpenFeatureMap(eStructuralFeature)) { + List features = (List) dataObject.eGet(eStructuralFeature); + for (int j = 0, size = features.size(); j < size; ++j) { + FeatureMap.Entry entry = (FeatureMap.Entry) features.get(j); + EStructuralFeature entryFeature = entry + .getEStructuralFeature(); + Property property = BasicSequence + .getFeatureProperty(entryFeature); + if (property != null) + propertyList.add(entryFeature); + } + } + } + } + + public Property getOpenProperty(EObject dataObject, String featureName) { + for (final Iterator iterator = getBaseTypes().iterator(); iterator + .hasNext();) { + ClassImpl baseType = (ClassImpl) iterator.next(); + Property result = baseType.getOpenProperty(dataObject, featureName); + if (result != null) + return result; + } + + Set openFeatureSet = new HashSet(); + for (final Iterator iter = getExtendedProperties().iterator(); iter + .hasNext();) { + EStructuralFeature eStructuralFeature = (EStructuralFeature) iter + .next(); + // if (isOpenFeatureMap(eStructuralFeature)) + // FB The above check excludes subsitition groups - i.e., doesn't + // support dObj.get("element.substitution") + if (FeatureMapUtil.isFeatureMap(eStructuralFeature)) { + List features = (List) dataObject.eGet(eStructuralFeature); + for (int j = 0, size = features.size(); j < size; ++j) { + FeatureMap.Entry entry = (FeatureMap.Entry) features.get(j); + EStructuralFeature entryFeature = entry + .getEStructuralFeature(); + if (openFeatureSet.add(entryFeature)) { + Property property = BasicSequence + .getFeatureProperty(entryFeature); + if (property != null) { + if (property.getName().equals(featureName)) + return (Property) entryFeature; + List aliasNames = property.getAliasNames(); + for (int aliasCount = aliasNames.size(); aliasCount > 0;) { + if (aliasNames.get(--aliasCount).equals( + featureName)) + return (Property) entryFeature; + } + } + } + } + } + } + + return null; + } + + /* + * public Property getOpenProperty(DataObject dataObject, String + * featureName) { EObject eObject = (EObject)dataObject; EClass eClass = + * eObject.eClass(); Set openFeatureSet = new HashSet(); for (int i = 0, + * count = eClass.getEAllStructuralFeatures().size(); i < count; ++i) { + * EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); + * if (FeatureMapUtil.isFeatureMap(eStructuralFeature)) { List features = + * (List)eObject.eGet(eStructuralFeature); for (int j = 0, size = + * features.size(); j < size; ++j) { FeatureMap.Entry entry = + * (FeatureMap.Entry)features.get(j); EStructuralFeature entryFeature = + * entry.getEStructuralFeature(); if (openFeatureSet.add(entryFeature)) { + * Property property = (Property)entryFeature; if + * (property.getName().equals(featureName)) return (Property)entryFeature; + * + * List aliasNames = property.getAliasNames(); for (int aliasCount = + * aliasNames.size(); aliasCount > 0; ) { if + * (aliasNames.get(--aliasCount).equals(featureName)) return + * (Property)entryFeature; } } } } } return null; } + */ + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() { + return getESuperTypes(); + } + + private void initAliasNames() { + Map result = new HashMap(); + for (Iterator i = getProperties().iterator(); i.hasNext();) { + Property property = (Property) i.next(); + result.put(property.getName(), property); + + List aliasNames = property.getAliasNames(); + for (int count = aliasNames.size(); count > 0;) { + result.put(aliasNames.get(--count), property); + } + } + propertyNameToPropertyMap = result; + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) { + if (propertyNameToPropertyMap == null) + initAliasNames(); + Property property = (Property) propertyNameToPropertyMap + .get(propertyName); + if (property == null && !isOpen()) { + initAliasNames(); + property = (Property) propertyNameToPropertyMap.get(propertyName); + } + return property; + } + + protected Map propertyNameToPropertyMap; + + 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 void unsetAbstract() { + eUnset(EcorePackage.eINSTANCE.getEClass_Abstract()); + } + + public boolean isSetAbstract() { + return eIsSet(EcorePackage.eINSTANCE.getEClass_Abstract()); + } + + public Sequence getAny() { + throw new UnsupportedOperationException(); + } + + public Sequence getAnyAttribute() { + throw new UnsupportedOperationException(); + } + + 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 false; + } + + 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 isOpen(); + } + + 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 isSequenced(); + } + + 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(); + } + + public Property getChangeSummaryProperty() { + if (changeSummaryPropertyCache == UNINITIALIZED_PROPERTY) { + changeSummaryPropertyCache = null; + + // Find property of type ChangeSummaryType, if one exists + Type csType = ((ModelFactoryImpl) ModelFactory.INSTANCE) + .getChangeSummaryType(); + for (Iterator props = getProperties().iterator(); props.hasNext();) { + Property p = (Property) props.next(); + if (csType == p.getType()) { + changeSummaryPropertyCache = p; + break; + } + } + } + + return changeSummaryPropertyCache; + } + + /** + * Returns whether the object is an instance of this classifier. + * Overridden because it does not use dynamicInstance check in Tuscany. + * @param object the object in question. + * @return whether the object is an instance. + * @see Class#isInstance + */ + public boolean isInstance(Object object) + { + if (object != null) + { + Class> instanceClass = getInstanceClass(); + if (instanceClass != null) + { + if (instanceClass.isPrimitive()) + { + if (instanceClass == Boolean.TYPE) + { + return object instanceof Boolean; + } + else if (instanceClass == Integer.TYPE) + { + return object instanceof Integer; + } + else if (instanceClass == Float.TYPE) + { + return object instanceof Float; + } + else if (instanceClass == Byte.TYPE) + { + return object instanceof Byte; + } + else if (instanceClass == Character.TYPE) + { + return object instanceof Character; + } + else if (instanceClass == Double.TYPE) + { + return object instanceof Double; + } + else if (instanceClass == Short.TYPE) + { + return object instanceof Short; + } + else if (instanceClass == Long.TYPE) + { + return object instanceof Long; + } + } + else + { + return instanceClass.isInstance(object); + } + } + else if (object instanceof EObject) + { + return dynamicIsInstance((EObject)object); + } + } + + return false; + } + + // /////////////////////////////////////////////////////////////////////////////////////////////////////// + // DataObject method implementations + // /////////////////////////////////////////////////////////////////////////////////////////////////////// + /* + * public Object get(int propertyIndex) { return DataObjectUtil.get(this, + * propertyIndex); } + * + * public void set(int propertyIndex, Object value) { throw new + * UnsupportedOperationException("Type is frozen and cannot be modified"); } + * + * public boolean isSet(int propertyIndex) { return + * DataObjectUtil.isSet(this, propertyIndex); } + * + * public void unset(int propertyIndex) { throw new + * UnsupportedOperationException("Type 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("Type 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("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"); + * //DataObjectUtil.detach(this); } + */ + +} // ClassTypeImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java new file mode 100644 index 0000000000..55124e6593 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java @@ -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; + + +/** + * + * An implementation of the model object 'EData Graph'. + * @extends DataGraph, Adapter, Serializable + * + *+ * The following features are implemented: + *
+ *
+ * + * @generated + */ +public abstract class DataObjectImpl extends BasicEObjectImpl implements DataObject +{ + protected InternalEObject eContainer; + protected int eContainerFeatureID; + protected SDOChangeRecorder changeRecorder; + protected Object location; // Resource.Internal (if object is directly contained in a resource) or URI (if it is a proxy) + protected BasicEList eAdapters; + + /** + * + * + * @generated + */ + protected DataObjectImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + public Object get(int propertyIndex) + { + return get(DataObjectUtil.getProperty(this, propertyIndex)); + } + + /** + * + * + * @generated NOT + */ + public void set(int propertyIndex, Object value) + { + set(DataObjectUtil.getProperty(this, propertyIndex), value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(int propertyIndex) + { + return isSet(DataObjectUtil.getProperty(this, propertyIndex)); + } + + /** + * + * + * @generated NOT + */ + public void unset(int propertyIndex) + { + unset(DataObjectUtil.getProperty(this, propertyIndex)); + } + + /** + * + * + * @generated NOT + */ + public Object get(Property property) + { + return eGet((EStructuralFeature)property, true, false); + } + + /** + * + * + * @generated NOT + */ + public void set(Property property, Object value) + { + eSet((EStructuralFeature)property, value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(Property property) + { + return eIsSet((EStructuralFeature)property); + } + + /** + * + * + * @generated NOT + */ + public void unset(Property property) + { + eUnset((EStructuralFeature)property); + } + + /** + * + * + * @generated NOT + */ + public DataObject getContainer() + { + return (DataObject)eContainer(); + } + + /** + * + * + * @generated NOT + */ + public Property getContainmentProperty() + { + return (Property)eContainmentFeature(); + } + + /** + * + * + * @generated NOT + */ + public Type getType() + { + return (Type)eClass(); + } + + /** + * + * + * @generated NOT + */ + public Object writeReplace() throws ObjectStreamException + { + return new ExternalizableDelegator(this); + } + + + // Remaining DataObject methods are implemented as straight delegation to DataObjectUtil + + /** + * + * + * @generated NOT + */ + public Object get(String path) + { + return DataObjectUtil.get(this, path); + } + + /** + * + * + * @generated NOT + */ + public void set(String path, Object value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(String path) + { + return DataObjectUtil.isSet(this, path); + } + + /** + * + * + * @generated NOT + */ + public void unset(String path) + { + DataObjectUtil.unset(this, path); + } + + /** + * + * + * @generated NOT + */ + public DataGraph getDataGraph() + { + return DataObjectUtil.getDataGraph(this); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(String path) + { + return DataObjectUtil.getBigDecimal(get(path)); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(String path) + { + return DataObjectUtil.getBigInteger(get(path)); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(String path) + { + return DataObjectUtil.getBoolean(get(path)); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(String path) + { + return DataObjectUtil.getByte(get(path)); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(String path) + { + return DataObjectUtil.getBytes(get(path)); + } + + /** + * + * + * @generated NOT + */ + public char getChar(String path) + { + return DataObjectUtil.getChar(get(path)); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(String path) + { + return (DataObject)get(path); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(String path) + { + return DataObjectUtil.getDate(get(path)); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(String path) + { + return DataObjectUtil.getDouble(get(path)); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(String path) + { + return DataObjectUtil.getFloat(get(path)); + } + + /** + * + * + * @generated NOT + */ + public int getInt(String path) + { + return DataObjectUtil.getInt(get(path)); + } + + /** + * + * + * @generated NOT + */ + public List getList(String path) + { + List result = (List)get(path); + if (result == null) { + result = new UnknownPropertyList(this, path); + } + + return result; + } + + /** + * + * + * @generated NOT + */ + public long getLong(String path) + { + return DataObjectUtil.getLong(get(path)); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(String path) + { + return (Sequence)get(path); + } + + /** + * + * + * @generated NOT + */ + public short getShort(String path) + { + return DataObjectUtil.getShort(get(path)); + } + + /** + * + * + * @generated NOT + */ + public String getString(String path) + { + return DataObjectUtil.getString(get(path)); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(String path, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(String path, BigInteger value) + { + DataObjectUtil.setBigInteger(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(String path, boolean value) + { + DataObjectUtil.setBoolean(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(String path, byte value) + { + DataObjectUtil.setByte(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(String path, byte[] value) + { + DataObjectUtil.setBytes(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(String path, char value) + { + DataObjectUtil.setChar(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(String path, DataObject value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(String path, Date value) + { + DataObjectUtil.setDate(this,path,value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(String path, double value) + { + DataObjectUtil.setDouble(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(String path, float value) + { + DataObjectUtil.setFloat(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(String path, int value) + { + DataObjectUtil.setInt(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(String path, List value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(String path, long value) + { + DataObjectUtil.setLong(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(String path, short value) + { + DataObjectUtil.setShort(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(String path, String value) + { + DataObjectUtil.setString(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(int propertyIndex) + { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(int propertyIndex) + { + return DataObjectUtil.getBigInteger(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(int propertyIndex) + { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(int propertyIndex) + { + return DataObjectUtil.getByte(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(int propertyIndex) + { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public char getChar(int propertyIndex) + { + return DataObjectUtil.getChar(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(int propertyIndex) + { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(int propertyIndex) + { + return DataObjectUtil.getDate(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(int propertyIndex) + { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(int propertyIndex) + { + return DataObjectUtil.getFloat(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public int getInt(int propertyIndex) + { + return DataObjectUtil.getInt(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public List getList(int propertyIndex) + { + return DataObjectUtil.getList(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public long getLong(int propertyIndex) + { + return DataObjectUtil.getLong(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(int propertyIndex) + { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public short getShort(int propertyIndex) + { + return DataObjectUtil.getShort(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public String getString(int propertyIndex) + { + return DataObjectUtil.getString(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(int propertyIndex, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(int propertyIndex, BigInteger value) + { + DataObjectUtil.setBigInteger(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(int propertyIndex, boolean value) + { + DataObjectUtil.setBoolean(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(int propertyIndex, byte value) + { + DataObjectUtil.setByte(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(int propertyIndex, byte[] value) + { + DataObjectUtil.setBytes(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(int propertyIndex, char value) + { + DataObjectUtil.setChar(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(int propertyIndex, DataObject value) + { + DataObjectUtil.setDataObject(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(int propertyIndex, Date value) + { + DataObjectUtil.setDate(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(int propertyIndex, double value) + { + DataObjectUtil.setDouble(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(int propertyIndex, float value) + { + DataObjectUtil.setFloat(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(int propertyIndex, int value) + { + DataObjectUtil.setInt(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(int propertyIndex, List value) + { + DataObjectUtil.setList(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(int propertyIndex, long value) + { + DataObjectUtil.setLong(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(int propertyIndex, short value) + { + DataObjectUtil.setShort(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(int propertyIndex, String value) + { + DataObjectUtil.setString(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(Property property) + { + return DataObjectUtil.getBigDecimal(this, property); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(Property property) + { + return DataObjectUtil.getBigInteger(this, property); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(Property property) + { + return DataObjectUtil.getBoolean(this, property); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(Property property) + { + return DataObjectUtil.getByte(this, property); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(Property property) + { + return DataObjectUtil.getBytes(this, property); + } + + /** + * + * + * @generated NOT + */ + public char getChar(Property property) + { + return DataObjectUtil.getChar(this, property); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(Property property) + { + return (DataObject)DataObjectUtil.getDataObject(this,property); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(Property property) + { + return DataObjectUtil.getDate(this, property); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(Property property) + { + return DataObjectUtil.getDouble(this, property); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(Property property) + { + return DataObjectUtil.getFloat(this, property); + } + + /** + * + * + * @generated NOT + */ + public int getInt(Property property) + { + return DataObjectUtil.getInt(this, property); + } + + /** + * + * + * @generated NOT + */ + public List getList(Property property) + { + return (List)DataObjectUtil.getList(this, property); + } + + /** + * + * + * @generated NOT + */ + public long getLong(Property property) + { + return DataObjectUtil.getLong(this, property); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(Property property) + { + return (Sequence)DataObjectUtil.getSequence(this, property); + } + + /** + * + * + * @generated NOT + */ + public short getShort(Property property) + { + return DataObjectUtil.getShort(this, property); + } + + /** + * + * + * @generated NOT + */ + public String getString(Property property) + { + return DataObjectUtil.getString(this, property); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(Property property, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(Property property, BigInteger value) + { + DataObjectUtil.setBigInteger(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(Property property, boolean value) + { + DataObjectUtil.setBoolean(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(Property property, byte value) + { + DataObjectUtil.setByte(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(Property property, byte[] value) + { + DataObjectUtil.setBytes(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(Property property, char value) + { + DataObjectUtil.setChar(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(Property property, DataObject value) + { + DataObjectUtil.setDataObject(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(Property property, Date value) + { + DataObjectUtil.setDate(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(Property property, double value) + { + DataObjectUtil.setDouble(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(Property property, float value) + { + DataObjectUtil.setFloat(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(Property property, int value) + { + DataObjectUtil.setInt(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(Property property, List value) + { + DataObjectUtil.setList(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(Property property, long value) + { + DataObjectUtil.setLong(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(Property property, short value) + { + DataObjectUtil.setShort(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(Property property, String value) + { + DataObjectUtil.setString(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(String propertyName) + { + return DataObjectUtil.createDataObject(this, propertyName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(int propertyIndex) + { + return DataObjectUtil.createDataObject(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(Property property) + { + return DataObjectUtil.createDataObject(this,property); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) + { + return DataObjectUtil.createDataObject(this, propertyName, namespaceURI, typeName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) + { + return DataObjectUtil.createDataObject(this, propertyIndex, namespaceURI, typeName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(Property property, Type type) + { + return DataObjectUtil.createDataObject(this, property, type); + } + + /** + * + * + * @generated NOT + */ + public void delete() + { + DataObjectUtil.delete(this); + } + + protected Sequence sequence = null; + + /** + * + * + * @generated NOT + */ + public Sequence getSequence() + { + if (sequence == null) + { + EStructuralFeature sequenceFeature = ((ClassImpl)eClass()).getSequenceFeature(); + if (sequenceFeature == null) return null; + if (sequenceFeature == ClassImpl.VIRTUAL_SEQUENCE_FEATURE) + sequence = new VirtualSequence(this); + else + sequence = (Sequence)eGet(sequenceFeature, true, false); + } + return sequence; + } + + /** + * + * + * @generated NOT + */ + public List getInstanceProperties() + { + return DataObjectUtil.getInstanceProperties(this); + } + + /** + * + * + * @generated NOT + */ + public Property getInstanceProperty(String propertyName) + { + return DataObjectUtil.getInstanceProperty(this, propertyName); + } + + /** + * @deprecated + */ + public Property getProperty(String propertyName) + { + return DataObjectUtil.getInstanceProperty(this, propertyName); + } + + /** + * + * + * @generated NOT + */ + public DataObject getRootObject() + { + return DataObjectUtil.getRootObject(this); + } + + /** + * + * + * @generated NOT + */ + public ChangeSummary getChangeSummary() + { + return DataObjectUtil.getChangeSummary(this); + } + + /** + * + * + * @generated NOT + */ + public void detach() + { + DataObjectUtil.detach(this); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Following methods customize BasicEObjectImpl, optimized for SDO + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.Literals.DATA_OBJECT; + } + + public boolean eNotificationRequired() + { + return changeRecorder != null || super.eNotificationRequired(); + } + + public boolean eDeliver() + { + return true; + } + + public void eNotify(Notification notification) + { + if(changeRecorder != null) changeRecorder.notifyChanged(notification); + super.eNotify(notification); + } + + public void setChangeRecorder(SDOChangeRecorder changeRecorder) + { + if (this.changeRecorder != null) + { + this.changeRecorder.unsetTarget(this); + } + + if (changeRecorder != null) + { + changeRecorder.setTarget(this); + } + + this.changeRecorder = changeRecorder; + } + + public InternalEObject eInternalContainer() + { + return eContainer; + } + + public int eContainerFeatureID() + { + return eContainerFeatureID; + } + + protected void eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID) + { + eContainer = newContainer; + eContainerFeatureID = newContainerFeatureID; + } + + public EClass eClass() + { + return eStaticClass(); + } + + public EList eContents() + { + return new EContentsEList(this); + } + + public EList eCrossReferences() + { + return new ECrossReferenceEList(this); + } + + public Resource.Internal eDirectResource() + { + return location instanceof Resource.Internal ? (Resource.Internal)location : null; + } + + protected EClass eDynamicClass() + { + return null; + } + + protected boolean eHasSettings() + { + return false; + } + + public boolean eIsProxy() + { + return location instanceof URI; + } + + public URI eProxyURI() + { + return location instanceof URI ? (URI)location : null; + } + + public void eSetClass(EClass eClass) + { + throw new UnsupportedOperationException(); + } + + protected void eSetDirectResource(Resource.Internal resource) + { + location = resource; + } + + public void eSetProxyURI(URI uri) + { + location = uri; + } + + protected DynamicValueHolder eSettings() + { + return null; + } + + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + return eDynamicGet(featureID, resolve, coreType); + } + + public void eSet(int featureID, Object newValue) + { + eDynamicSet(featureID, newValue); + } + + public void eUnset(int featureID) + { + eDynamicUnset(featureID); + } + + public boolean eIsSet(int featureID) + { + return eDynamicIsSet(featureID); + } + + public Object eDynamicGet(int featureID, boolean resolve, boolean coreType) + { + return eOpenGet(DataObjectUtil.getOpenFeature(this, featureID), resolve); + } + + public void eDynamicSet(int featureID, Object newValue) + { + eOpenSet(DataObjectUtil.getOpenFeature(this, featureID), newValue); + } + + public void eDynamicUnset(int featureID) + { + eOpenUnset(DataObjectUtil.getOpenFeature(this, featureID)); + } + + public boolean eDynamicIsSet(int featureID) + { + return eOpenIsSet(DataObjectUtil.getOpenFeature(this, featureID)); + } + + public EList eAdapters() + { + if (eAdapters == null) + { + eAdapters = new EAdapterList(this); + } + return eAdapters; + } + + public BasicEList eBasicAdapters() + { + return eAdapters; + } + + + /* + public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature) + { + Class containerClass = eStructuralFeature.getContainerClass(); + return + containerClass == null ? + eClass().getFeatureID(eStructuralFeature) : + containerClass.isInstance(this) ? + eDerivedStructuralFeatureID(eStructuralFeature.getFeatureID(), containerClass) : + -1; + } + + public void eOpenSet(EStructuralFeature eFeature, Object newValue) + { + EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature); + if (openFeature == null) + { + openFeature = (EStructuralFeature)eClass().getEStructuralFeature("any"); + } + if (openFeature != null) + { + if (!FeatureMapUtil.isFeatureMap(openFeature)) + { + openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature); + } + FeatureMap featureMap = (FeatureMap)eGet(openFeature); + ((FeatureMap.Internal)featureMap).set(eFeature, newValue); + } + else + { + throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature"); + } + } + */ + +} //DataObjectImpl + + + diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java new file mode 100644 index 0000000000..46d2659023 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Data Type'. + * + *+ *
+ * + * @generated + */ +public class DataTypeImpl extends EDataTypeImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/ +{ + /** + * + * + * @generated + */ + protected DataTypeImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getDataType(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() + { + return getEPackage().getNsURI(); + } + + /** + * + * + */ + public Class getInstanceClass() { + // TODO: verify! + return super.getInstanceClass(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() + { + return true; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() + { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() + { + return false; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public List getDeclaredProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() + { + EDataType dataType = ExtendedMetaData.INSTANCE.getBaseType(this); + if (dataType == null) + { + return Collections.EMPTY_LIST; + } + else + { + return Collections.singletonList(dataType); + } + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java new file mode 100644 index 0000000000..71469c4873 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Dynamic Data Object'. + * @extends EStructuralFeature.Internal.DynamicValueHolder + * + *+ *
+ * + * @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]; + + /** + * + * + * @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); + } + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java new file mode 100644 index 0000000000..b14629e718 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Dynamic Store Data Object'. + * + *+ *
+ * + * @generated + */ +public class DynamicStoreDataObjectImpl extends StoreDataObjectImpl implements DataObject +{ + protected EClass eClass; + + /** + * + * + * @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); + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java new file mode 100644 index 0000000000..d8aeb533b3 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Enum'. + * + *+ *
+ * + * @generated + */ +public class EnumImpl extends EEnumImpl implements Type +{ + /** + * + * + * @generated + */ + protected EnumImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEEnum(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() + { + return getEPackage().getNsURI(); + } + + /** + * + * + * @generated + */ + public Class getInstanceClass() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() + { + return true; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() + { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() + { + return false; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public List getDeclaredProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) + { + return null; + } + + /** + * + * + * @generated NOT + */ + public boolean isAbstract() + { + return false; + } + + public List getInstanceProperties() + { + throw new UnsupportedOperationException(); + } + + public Object get(Property property) + { + throw new UnsupportedOperationException(); + } + +} //EnumTypeImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java new file mode 100644 index 0000000000..206a3c1fbf --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java @@ -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(); + } +} diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ExtensibleDataObjectImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ExtensibleDataObjectImpl.java new file mode 100644 index 0000000000..ea7ae02984 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ExtensibleDataObjectImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Extensible Data Object'. + * @extends EStructuralFeature.Internal.DynamicValueHolder + * + *+ *
+ * + * @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]; + + /** + * + * + * @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); + } + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java new file mode 100644 index 0000000000..e344a6ffde --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java @@ -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(); + } +} diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java new file mode 100644 index 0000000000..986628bbc9 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java @@ -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); + } +} diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java new file mode 100644 index 0000000000..2c48bae144 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Reference'. + * + *+ *
+ * + * @generated + */ +public class ReferenceImpl extends EReferenceImpl implements Property +{ + /** + * + * + * @generated + */ + protected ReferenceImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getReference(); + } + + /** + * + * + * @generated NOT + */ + public Object getDefault() + { + return getDefaultValue(); + } + + /** + * + * + * @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; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public Type getType() + { + return (Type)getEType(); + /* + EClassifier eType = getEType(); + //FB More temporary hacks + return eType instanceof Type ? (Type)getEType() : null; + */ + } + + /** + * + * + * @generated NOT + */ + public Type getContainingType() + { + return (Type)getEContainingClass(); + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java new file mode 100644 index 0000000000..a42d6798f4 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java @@ -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; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SDOFactoryImpl extends EFactoryImpl implements SDOFactory +{ + /** + * Creates the default factory implementation. + * + * + * @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. + * + * + * @generated + */ + public SDOFactoryImpl() + { + super(); + } + + /** + * + * + * @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"); + } + } + + /** + * + * + * @generated + */ + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) { + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) { + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public ChangeSummary createChangeSummary() + { + ChangeSummaryImpl changeSummary = new ChangeSummaryImpl(); + return changeSummary; + } + + /** + * + * + * @generated + */ + public ChangeSummary.Setting createChangeSummarySetting() + { + ChangeSummarySettingImpl changeSummarySetting = new ChangeSummarySettingImpl(); + return changeSummarySetting; + } + + /** + * + * + * @generated + */ + public DataGraph createDataGraph() + { + DataGraphImpl dataGraph = new DataGraphImpl(); + return dataGraph; + } + + /** + * + * + * @generated + */ + public AnyTypeDataObject createAnyTypeDataObject() + { + AnyTypeDataObjectImpl anyTypeDataObject = new AnyTypeDataObjectImpl(); + return anyTypeDataObject; + } + + /** + * + * + * @generated + */ + public SimpleAnyTypeDataObject createSimpleAnyTypeDataObject() + { + SimpleAnyTypeDataObjectImpl simpleAnyTypeDataObject = new SimpleAnyTypeDataObjectImpl(); + return simpleAnyTypeDataObject; + } + + /** + * + * + * @generated + */ + public Type createClass() + { + ClassImpl class_ = new ClassImpl(); + return class_; + } + + /** + * + * + * @generated + */ + public Type createDataType() + { + DataTypeImpl dataType = new DataTypeImpl(); + return dataType; + } + + /** + * + * + * @generated + */ + public Property createAttribute() + { + AttributeImpl attribute = new AttributeImpl(); + return attribute; + } + + /** + * + * + * @generated + */ + public Property createReference() + { + ReferenceImpl reference = new ReferenceImpl(); + return reference; + } + + /** + * + * + * @generated + */ + public Type createEnum() + { + EnumImpl enum_ = new EnumImpl(); + return enum_; + } + + /** + * + * + * @generated + */ + public DataObject createDynamicDataObject() + { + DynamicDataObjectImpl dynamicDataObject = new DynamicDataObjectImpl(); + return dynamicDataObject; + } + + /** + * + * + * @generated + */ + public DataObject createStoreDataObject() + { + StoreDataObjectImpl storeDataObject = new StoreDataObjectImpl(); + return storeDataObject; + } + + /** + * + * + * @generated + */ + public DataObject createDynamicStoreDataObject() + { + DynamicStoreDataObjectImpl dynamicStoreDataObject = new DynamicStoreDataObjectImpl(); + return dynamicStoreDataObject; + } + + /** + * + * + * @generated + */ + public DataObject createExtensibleDataObject() + { + ExtensibleDataObjectImpl extensibleDataObject = new ExtensibleDataObjectImpl(); + return extensibleDataObject; + } + + /** + * + * + * @generated + */ + public SDOPackage getSDOPackage() + { + return (SDOPackage)getEPackage(); + } + + /** + * + * + * @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 diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java new file mode 100644 index 0000000000..bf69742a4d --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java @@ -0,0 +1,1330 @@ +/** + * + * 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.ObjectStreamException; +import java.util.Collections; +import java.util.List; + +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.apache.tuscany.sdo.impl.SDOFactoryImpl.SDOEcoreFactory; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.change.ChangePackage; +import org.eclipse.emf.ecore.change.impl.ChangePackageImpl; +import org.eclipse.emf.ecore.impl.EClassImpl; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.emf.ecore.impl.EcorePackageImpl; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; +import org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class SDOPackageImpl extends EPackageImpl implements SDOPackage +{ + /** + * + * + * @generated + */ + private EClass changeSummaryEClass = null; + + /** + * + * + * @generated + */ + private EClass changeSummarySettingEClass = null; + + /** + * + * + * @generated + */ + private EClass dataGraphEClass = null; + + /** + * + * + * @generated + */ + private EClass dataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass propertyEClass = null; + + /** + * + * + * @generated + */ + private EClass sequenceEClass = null; + + /** + * + * + * @generated + */ + private EClass typeEClass = null; + + /** + * + * + * @generated + */ + private EClass anyTypeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass simpleAnyTypeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass classEClass = null; + + /** + * + * + * @generated + */ + private EClass dataTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass attributeEClass = null; + + /** + * + * + * @generated + */ + private EClass referenceEClass = null; + + /** + * + * + * @generated + */ + private EClass enumEClass = null; + + /** + * + * + * @generated + */ + private EClass dynamicDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass storeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass dynamicStoreDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass extensibleDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EDataType eJavaListEDataType = null; + + /** + * + * + * @generated + */ + private EDataType eObjectStreamExceptionEDataType = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.sdo.SDOPackage#eNS_URI + * @see #init() + * @generated NOT + */ + private SDOPackageImpl() + { + super(eNS_URI, SDOFactory.eINSTANCE); + ecoreFactory = new SDOEcoreFactory(); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *
This method is used to initialize {@link SDOPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ *
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static SDOPackage init()
+ {
+ if (isInited) return (SDOPackage)EPackage.Registry.INSTANCE.getEPackage(SDOPackage.eNS_URI);
+
+ // Obtain or create and register package
+ SDOPackageImpl theSDOPackage = (SDOPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SDOPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new SDOPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ XMLTypePackage.eINSTANCE.eClass();
+ ChangePackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theSDOPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theSDOPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theSDOPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(SDOPackage.eNS_URI, theSDOPackage);
+ return theSDOPackage;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public EClass getChangeSummary()
+ {
+ return changeSummaryEClass;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public EReference getChangeSummary_EDataGraph()
+ {
+ return (EReference)changeSummaryEClass.getEStructuralFeatures().get(0);
+ }
+
+// /**
+// *
+// *
+// *
+ * The following features are implemented:
+ *
+ *
+ *
+ *
+ * + * @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; + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.Literals.STORE_DATA_OBJECT; + } + +} //StoreDataObjectImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java new file mode 100644 index 0000000000..e57b11474b --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java @@ -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; + +/** + * + * A representation of the model object 'Base Data Graph Type'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Models' containment reference isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Models' 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 Models}' containment reference. + * + * + * @param value the new value of the 'Models' 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 Models}' containment reference. + * + * + * @see #isSetModels() + * @see #getModels() + * @see #setModels(ModelsType) + * @generated + */ + void unsetModels(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels Models}' containment reference is set. + * + * + * @return whether the value of the 'Models' containment reference is set. + * @see #unsetModels() + * @see #getModels() + * @see #setModels(ModelsType) + * @generated + */ + boolean isSetModels(); + + /** + * Returns the value of the 'Xsd' containment reference. + * + *+ * If the meaning of the 'Xsd' containment reference isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Xsd' 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 Xsd}' containment reference. + * + * + * @param value the new value of the 'Xsd' 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 Xsd}' containment reference. + * + * + * @see #isSetXsd() + * @see #getXsd() + * @see #setXsd(XSDType) + * @generated + */ + void unsetXsd(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd Xsd}' containment reference is set. + * + * + * @return whether the value of the 'Xsd' containment reference is set. + * @see #unsetXsd() + * @see #getXsd() + * @see #setXsd(XSDType) + * @generated + */ + boolean isSetXsd(); + + /** + * Returns the value of the 'Change Summary' attribute. + * + *+ * If the meaning of the 'Change Summary' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Change Summary' attribute. + * @see #isSetChangeSummary() + * @see #unsetChangeSummary() + * @see #setChangeSummary(ChangeSummary) + * @generated + */ + ChangeSummary getChangeSummary(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary Change Summary}' attribute. + * + * + * @param value the new value of the 'Change Summary' 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 Change Summary}' attribute. + * + * + * @see #isSetChangeSummary() + * @see #getChangeSummary() + * @see #setChangeSummary(ChangeSummary) + * @generated + */ + void unsetChangeSummary(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary Change Summary}' attribute is set. + * + * + * @return whether the value of the 'Change Summary' attribute is set. + * @see #unsetChangeSummary() + * @see #getChangeSummary() + * @see #setChangeSummary(ChangeSummary) + * @generated + */ + boolean isSetChangeSummary(); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + +} // BaseDataGraphType diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java new file mode 100644 index 0000000000..2c83244789 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java @@ -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; + +/** + * + * A representation of the model object 'Data Graph Type'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // DataGraphType diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java new file mode 100644 index 0000000000..9e3b2a1386 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java @@ -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; + +/** + * + * A representation of the model object 'Data Object'. + * + * + * + * @extends Serializable + * @generated + */ +public interface DataObject extends Serializable +{ +} // DataObject diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java new file mode 100644 index 0000000000..c8fe69167e --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java @@ -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; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface ModelFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + ModelFactory INSTANCE = org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.init(); + + /** + * Returns a new object of class 'Data Graph Type'. + * + * + * @return a new object of class 'Data Graph Type'. + * @generated + */ + DataGraphType createDataGraphType(); + + /** + * Returns a new object of class 'Models Type'. + * + * + * @return a new object of class 'Models Type'. + * @generated + */ + ModelsType createModelsType(); + + /** + * Returns a new object of class 'Property'. + * + * + * @return a new object of class 'Property'. + * @generated + */ + Property createProperty(); + + /** + * Returns a new object of class 'Type'. + * + * + * @return a new object of class 'Type'. + * @generated + */ + Type createType(); + + /** + * Returns a new object of class 'Types'. + * + * + * @return a new object of class 'Types'. + * @generated + */ + Types createTypes(); + + /** + * Returns a new object of class 'XSD Type'. + * + * + * @return a new object of class 'XSD Type'. + * @generated + */ + XSDType createXSDType(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //ModelFactory diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java new file mode 100644 index 0000000000..4159ac9dc1 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java @@ -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; + +/** + * + * A representation of the model object 'Models Type'. + * + * + * + * + * Expected type is emof:Package. + * + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // ModelsType diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java new file mode 100644 index 0000000000..15ee4c2f99 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java @@ -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; + +/** + * + * A representation of the model object 'Property'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Alias Name' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Alias Name' attribute list. + * @generated + */ + List getAliasName(); + + /** + * Returns the value of the 'Any' attribute list. + * + *+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + + /** + * Returns the value of the 'Name' attribute. + * + *+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Name' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' 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 Name}' attribute. + * + * + * @see #isSetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + void unsetName(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getName Name}' attribute is set. + * + * + * @return whether the value of the 'Name' attribute is set. + * @see #unsetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + boolean isSetName(); + + /** + * Returns the value of the 'Many' attribute. + * + *+ * If the meaning of the 'Many' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Many' attribute. + * @see #isSetMany() + * @see #unsetMany() + * @see #setMany(boolean) + * @generated + */ + boolean isMany(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany Many}' attribute. + * + * + * @param value the new value of the 'Many' 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 Many}' attribute. + * + * + * @see #isSetMany() + * @see #isMany() + * @see #setMany(boolean) + * @generated + */ + void unsetMany(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany Many}' attribute is set. + * + * + * @return whether the value of the 'Many' attribute is set. + * @see #unsetMany() + * @see #isMany() + * @see #setMany(boolean) + * @generated + */ + boolean isSetMany(); + + /** + * Returns the value of the 'Containment' attribute. + * + *+ * If the meaning of the 'Containment' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Containment' attribute. + * @see #isSetContainment() + * @see #unsetContainment() + * @see #setContainment(boolean) + * @generated + */ + boolean isContainment(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}' attribute. + * + * + * @param value the new value of the 'Containment' 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 Containment}' attribute. + * + * + * @see #isSetContainment() + * @see #isContainment() + * @see #setContainment(boolean) + * @generated + */ + void unsetContainment(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}' attribute is set. + * + * + * @return whether the value of the 'Containment' attribute is set. + * @see #unsetContainment() + * @see #isContainment() + * @see #setContainment(boolean) + * @generated + */ + boolean isSetContainment(); + + /** + * Returns the value of the 'Default' attribute. + * + *+ * If the meaning of the 'Default' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Default' attribute. + * @see #isSetDefault() + * @see #unsetDefault() + * @see #setDefault_(String) + * @generated + */ + String getDefault_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault Default}' attribute. + * + * + * @param value the new value of the 'Default' 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 Default}' attribute. + * + * + * @see #isSetDefault() + * @see #getDefault_() + * @see #setDefault_(String) + * @generated + */ + void unsetDefault(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault Default}' attribute is set. + * + * + * @return whether the value of the 'Default' attribute is set. + * @see #unsetDefault() + * @see #getDefault_() + * @see #setDefault_(String) + * @generated + */ + boolean isSetDefault(); + + /** + * Returns the value of the 'Read Only' attribute. + * + *+ * If the meaning of the 'Read Only' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Read Only' attribute. + * @see #isSetReadOnly() + * @see #unsetReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + boolean isReadOnly(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}' attribute. + * + * + * @param value the new value of the 'Read Only' 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 Read Only}' attribute. + * + * + * @see #isSetReadOnly() + * @see #isReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + void unsetReadOnly(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}' attribute is set. + * + * + * @return whether the value of the 'Read Only' attribute is set. + * @see #unsetReadOnly() + * @see #isReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + boolean isSetReadOnly(); + + /** + * Returns the value of the 'Type' reference. + * + *+ * If the meaning of the 'Type' reference isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Type' reference. + * @see #isSetType() + * @see #unsetType() + * @see #setType(Type) + * @generated + */ + Type getType_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getType_ Type}' reference. + * + * + * @param value the new value of the 'Type' 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_ Type}' reference. + * + * + * @see #isSetType() + * @see #getType_() + * @see #setType(Type) + * @generated + */ + void unsetType(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getType_ Type}' reference is set. + * + * + * @return whether the value of the 'Type' reference is set. + * @see #unsetType() + * @see #getType_() + * @see #setType(Type) + * @generated + */ + boolean isSetType(); + + /** + * Returns the value of the 'Opposite' reference. + * + *+ * If the meaning of the 'Opposite' reference isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Opposite' reference. + * @see #isSetOpposite() + * @see #unsetOpposite() + * @see #setOpposite_(Property) + * @generated + */ + Property getOpposite_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite Opposite}' reference. + * + * + * @param value the new value of the 'Opposite' 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 Opposite}' reference. + * + * + * @see #isSetOpposite() + * @see #getOpposite_() + * @see #setOpposite_(Property) + * @generated + */ + void unsetOpposite(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite Opposite}' reference is set. + * + * + * @return whether the value of the 'Opposite' reference is set. + * @see #unsetOpposite() + * @see #getOpposite_() + * @see #setOpposite_(Property) + * @generated + */ + boolean isSetOpposite(); + + /** + * Returns the value of the 'Nullable' attribute. + * + *+ * If the meaning of the 'Nullable' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Nullable' attribute. + * @see #isSetNullable() + * @see #unsetNullable() + * @see #setNullable(boolean) + * @generated + */ + boolean isNullable(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isNullable Nullable}' attribute. + * + * + * @param value the new value of the 'Nullable' 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 Nullable}' attribute. + * + * + * @see #isSetNullable() + * @see #isNullable() + * @see #setNullable(boolean) + * @generated + */ + void unsetNullable(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isNullable Nullable}' attribute is set. + * + * + * @return whether the value of the 'Nullable' attribute is set. + * @see #unsetNullable() + * @see #isNullable() + * @see #setNullable(boolean) + * @generated + */ + boolean isSetNullable(); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + +} // Property diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java new file mode 100644 index 0000000000..741343e5a8 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java @@ -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; + +/** + * + * A representation of the model object 'Text Type'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Text' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Text' attribute list. + * @generated + */ + List getText(); + +} // TextType diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java new file mode 100644 index 0000000000..26a02f7cc0 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java @@ -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; + +/** + * + * A representation of the model object 'Type'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Base Type' reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Base Type' reference list. + * @generated + */ + List getBaseType(); + + /** + * Returns the value of the 'Property' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.model.Property}. + * + *+ * If the meaning of the 'Property' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Property' containment reference list. + * @generated + */ + List getProperty(); + + /** + * Returns the value of the 'Alias Name' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'Alias Name' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Alias Name' attribute list. + * @generated + */ + List getAliasName(); + + /** + * Returns the value of the 'Any' attribute list. + * + *+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + + /** + * Returns the value of the 'Name' attribute. + * + *+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Name' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' 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 Name}' attribute. + * + * + * @see #isSetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + void unsetName(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#getName Name}' attribute is set. + * + * + * @return whether the value of the 'Name' attribute is set. + * @see #unsetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + boolean isSetName(); + + /** + * Returns the value of the 'Uri' attribute. + * + *+ * If the meaning of the 'Uri' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Uri' attribute. + * @see #isSetUri() + * @see #unsetUri() + * @see #setUri(String) + * @generated + */ + String getUri(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri Uri}' attribute. + * + * + * @param value the new value of the 'Uri' 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 Uri}' attribute. + * + * + * @see #isSetUri() + * @see #getUri() + * @see #setUri(String) + * @generated + */ + void unsetUri(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri Uri}' attribute is set. + * + * + * @return whether the value of the 'Uri' attribute is set. + * @see #unsetUri() + * @see #getUri() + * @see #setUri(String) + * @generated + */ + boolean isSetUri(); + + /** + * Returns the value of the 'Data Type' attribute. + * + *+ * If the meaning of the 'Data Type' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Data Type' attribute. + * @see #isSetDataType() + * @see #unsetDataType() + * @see #setDataType(boolean) + * @generated + */ + boolean isDataType(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}' attribute. + * + * + * @param value the new value of the 'Data Type' 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 Data Type}' attribute. + * + * + * @see #isSetDataType() + * @see #isDataType() + * @see #setDataType(boolean) + * @generated + */ + void unsetDataType(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}' attribute is set. + * + * + * @return whether the value of the 'Data Type' attribute is set. + * @see #unsetDataType() + * @see #isDataType() + * @see #setDataType(boolean) + * @generated + */ + boolean isSetDataType(); + + /** + * Returns the value of the 'Open' attribute. + * + *+ * If the meaning of the 'Open' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Open' attribute. + * @see #isSetOpen() + * @see #unsetOpen() + * @see #setOpen(boolean) + * @generated + */ + boolean isOpen(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}' attribute. + * + * + * @param value the new value of the 'Open' 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 Open}' attribute. + * + * + * @see #isSetOpen() + * @see #isOpen() + * @see #setOpen(boolean) + * @generated + */ + void unsetOpen(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}' attribute is set. + * + * + * @return whether the value of the 'Open' attribute is set. + * @see #unsetOpen() + * @see #isOpen() + * @see #setOpen(boolean) + * @generated + */ + boolean isSetOpen(); + + /** + * Returns the value of the 'Sequenced' attribute. + * + *+ * If the meaning of the 'Sequenced' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Sequenced' attribute. + * @see #isSetSequenced() + * @see #unsetSequenced() + * @see #setSequenced(boolean) + * @generated + */ + boolean isSequenced(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}' attribute. + * + * + * @param value the new value of the 'Sequenced' 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 Sequenced}' attribute. + * + * + * @see #isSetSequenced() + * @see #isSequenced() + * @see #setSequenced(boolean) + * @generated + */ + void unsetSequenced(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}' attribute is set. + * + * + * @return whether the value of the 'Sequenced' attribute is set. + * @see #unsetSequenced() + * @see #isSequenced() + * @see #setSequenced(boolean) + * @generated + */ + boolean isSetSequenced(); + + /** + * Returns the value of the 'Abstract' attribute. + * + *+ * If the meaning of the 'Abstract' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Abstract' attribute. + * @see #isSetAbstract() + * @see #unsetAbstract() + * @see #setAbstract(boolean) + * @generated + */ + boolean isAbstract(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}' attribute. + * + * + * @param value the new value of the 'Abstract' 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 Abstract}' attribute. + * + * + * @see #isSetAbstract() + * @see #isAbstract() + * @see #setAbstract(boolean) + * @generated + */ + void unsetAbstract(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}' attribute is set. + * + * + * @return whether the value of the 'Abstract' attribute is set. + * @see #unsetAbstract() + * @see #isAbstract() + * @see #setAbstract(boolean) + * @generated + */ + boolean isSetAbstract(); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + + String getInstanceClassName(); + +} // Type diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java new file mode 100644 index 0000000000..26fb9c57ce --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java @@ -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; + +/** + * + * A representation of the model object 'Types'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Type' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Type' containment reference list. + * @generated + */ + List getType_(); + + List getTypeList(); + +} // Types diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java new file mode 100644 index 0000000000..32cde02086 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java @@ -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; + +/** + * + * A representation of the model object 'XSD Type'. + * + * + * + * + * Expected type is xsd:schema. + * + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // XSDType diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java new file mode 100644 index 0000000000..e8824974a0 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java @@ -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; + +/** + * + * An implementation of the model object 'Base Data Graph Type'. + * + *+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ *
+ * + * @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. + * + * + * @generated + * @ordered + */ + public final static int INTERNAL_PROPERTY_COUNT = 0; + + protected int internalConvertIndex(int internalIndex) + { + switch (internalIndex) + { + } + return super.internalConvertIndex(internalIndex); + } + + + /** + * + * + * @generated + */ + public DataObjectImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getStaticType() + { + return ((ModelFactoryImpl)ModelFactory.INSTANCE).getDataObject(); + } + +} //DataObjectImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java new file mode 100644 index 0000000000..761efb4217 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java @@ -0,0 +1,2401 @@ +/** + * + * 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.helper.DataHelper; +import commonj.sdo.helper.HelperContext; + +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.TimeZone; + +import org.apache.tuscany.sdo.impl.FactoryBase; + +import org.apache.tuscany.sdo.model.*; +import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; +import org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil; + +/** + * + * An implementation of the commonj.sdo model factory. + * This model is generated from sdoModel.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 -targetDirectory+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'Java Class' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Java Class' 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 Java Class}' attribute. + * + * + * @param value the new value of the 'Java Class' 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 Java Class}' attribute. + * + * + * @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 Java Class}' attribute is set. + * + * + * @return whether the value of the 'Java Class' attribute is set. + * @see #unsetJavaClass() + * @see #getJavaClass() + * @see #setJavaClass(String) + * @generated + */ + boolean isSetJavaClass(); + +} // JavaInfo diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java new file mode 100644 index 0000000000..515311f7ff --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java @@ -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; + +/** + * + * 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+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'Xml Element' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Xml Element' attribute. + * @see #isSetXmlElement() + * @see #unsetXmlElement() + * @see #setXmlElement(boolean) + * @generated + */ + boolean isXmlElement(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.xml.XMLInfo#isXmlElement Xml Element}' attribute. + * + * + * @param value the new value of the 'Xml Element' attribute. + * @see #isSetXmlElement() + * @see #unsetXmlElement() + * @see #isXmlElement() + * @generated + */ + void setXmlElement(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.xml.XMLInfo#isXmlElement Xml Element}' attribute. + * + * + * @see #isSetXmlElement() + * @see #isXmlElement() + * @see #setXmlElement(boolean) + * @generated + */ + void unsetXmlElement(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.xml.XMLInfo#isXmlElement Xml Element}' attribute is set. + * + * + * @return whether the value of the 'Xml Element' attribute is set. + * @see #unsetXmlElement() + * @see #isXmlElement() + * @see #setXmlElement(boolean) + * @generated + */ + boolean isSetXmlElement(); + +} // XMLInfo diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/xml/impl/XMLFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/xml/impl/XMLFactoryImpl.java new file mode 100644 index 0000000000..f07d8b7f3c --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/model/xml/impl/XMLFactoryImpl.java @@ -0,0 +1,341 @@ +/** + * + * 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.xml.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.internal.InternalFactory; + +import org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl; + +import org.apache.tuscany.sdo.model.xml.*; + +/** + * + * An implementation of the commonj.sdo/xml model factory. + * This model is generated from sdoXML.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/xml -prefix XML -targetDirectory+ * The following features are implemented: + *
+ * path = /? (step '/')* step + * step = feature + * | feature '.' index_from_0 + * | feature '[' index_from_1 ']' + * | reference '[' attribute '=' value ']' + * | .. + * | '@' step + *+ * + * feature = the name of an attribute or reference + * attribute = the name of an attribute + * reference = the name of a reference + * index = positive integer + * value = the string value of an attribute + * leading / begins at the root + * .. is containing object + * + * features must be multi-valued to use '.' and '[' operations. + * Only the last step may have an attribute as the feature. + */ + public static final class Accessor //TODO rewrite this using SDO APIs + { + /** + * Creates an accessor for the path of the object. + */ + public static Accessor create(EObject eObject, String path) + { + return create(eObject, path, null); + } + + public static Accessor create(EObject eObject, String path, Object value) + { + Accessor result = pool.get(); + result.init(eObject, path, value); + return result; + } + + /** + * Only the get and recycle methods should be call; they are the only synchronized methods. + */ + protected static class Pool extends BasicEList + { + protected Accessor[] accessors; + + public Pool() + { + super(10); + } + + protected Object[] newData(int capacity) + { + return accessors = new Accessor [capacity]; + } + + /** + * Returns a recyled instance or a new instance. + */ + public synchronized Accessor get() + { + if (size > 0) + { + return accessors[--size]; + } + else + { + return new Accessor(); + } + } + + /** Safely gives the accessor back for recycled use. + */ + public synchronized void recycle(Accessor accessor) + { + int minimumCapacity = size + 1; + if (minimumCapacity > data.length) + { + grow(minimumCapacity); + } + accessors[size++] = accessor; + } + } + + /** + * A static thread safe pool of Accessors. + */ + static final Pool pool = new Pool(); + + protected static final int NO_INDEX = -1; + + protected EObject eObject; + protected Object value; + + protected EStructuralFeature feature; + + protected int index; + + RuntimeException runtimeException; + + protected Accessor() + { + } + + //protected Accessor(EObject eObject, String path) + //{ + // init(eObject, path); + //} + + protected void init(EObject eObject, String path, Object value) + { + this.eObject = eObject; + this.value = value; + runtimeException = null; + + // This should only be called with a path right now. + // + //feature = getType(eObject).getProperty(path).getEStructuralFeature(); + //if (feature == null) + { + process(path); + } + //else + { + //index = NO_INDEX; + } + } + + public Object get() + { + if (feature == null) + { + return eObject; + } + else + { + Object value = eObject.eGet(feature, true); + if (index >= 0) + { + value = ((List)value).get(index); + if (value instanceof FeatureMap.Entry) + { + value = ((FeatureMap.Entry)value).getValue(); + } + } + else if (FeatureMapUtil.isFeatureMap(feature)) + { + value = new BasicSequence((FeatureMap.Internal)value); + } + return value; + } + } + + public Object getAndRecyle() + { + Object result = get(); + pool.recycle(this); + return result; + } + + protected final void assertSuccessfulProcess() + { + if (runtimeException != null) + throw runtimeException; + } + + public void set(Object newValue) + { + assertSuccessfulProcess(); + if (index >= 0) + { + List list = (List)eObject.eGet(feature, true); + list.set(index, newValue); + } + else + { + // EATM newValue = string2Enum(feature, newValue); + eObject.eSet(feature, newValue); + } + } + + public void setAndRecyle(Object newValue) + { + set(newValue); + pool.recycle(this); + } + + public boolean isSet() + { + return feature != null && eObject.eIsSet(feature); + } + + public boolean isSetAndRecyle() + { + boolean result = isSet(); + pool.recycle(this); + return result; + } + + public void unset() + { + assertSuccessfulProcess(); + eObject.eUnset(feature); + } + + public void unsetAndRecyle() + { + unset(); + pool.recycle(this); + } + + public void recycle() + { + pool.recycle(this); + } + + public EObject getEObject() + { + return eObject; + } + + protected void setEObject(EObject eObject) + { + this.eObject = eObject; + feature = null; + index = NO_INDEX; + } + + public EStructuralFeature getEStructuralFeature() + { + return feature; + } + + public Property getProperty() + { + assertSuccessfulProcess(); + return (Property)feature; + } + + protected void setFeatureName(String name) + { + if (name != null) + { + feature = (EStructuralFeature)((DataObject)eObject).getInstanceProperty(name); + if (feature == null) + { + int index = name.lastIndexOf('.'); + if (index == -1) + { + Type type = (Type)eObject.eClass(); + if (value != null && type.isOpen()) + { + feature = (EStructuralFeature)demandOpenProperty(type, name, value, false); + this.index = NO_INDEX; + return; + } + runtimeException = new IllegalArgumentException("Class '" + eObject.eClass().getName() + "' does not have a feature named '" + name + '\''); + } + else + { + int propertyNameEnd = index; + try + { + index = Integer.parseInt(name.substring(++index)); + // NumberFormatException may be thrown + String propertyName = name.substring(0, propertyNameEnd); + feature = (EStructuralFeature)((DataObject)eObject).getInstanceProperty(propertyName); + if (feature != null) + { + setIndex(index); + return; + } + runtimeException = new IllegalArgumentException("Class '" + eObject.eClass().getName() + "' does not have a feature named '" + name + "' or '" + propertyName + '\''); + } + catch(NumberFormatException eNumberFormat) + { + runtimeException = eNumberFormat; + } + } + setEObject(null); + } + } + else + { + feature = null; + } + index = NO_INDEX; + } + + protected int getIndex() + { + return index; + } + + /* + * calling constraint, this method is not to be used for semantic of setting index to NO_INDEX + */ + protected void setIndex(int index) + { + if (index < 0) { + // The index value should not be less than 0. + runtimeException = new IndexOutOfBoundsException("Index value is too low"); + setEObject(null); + return; + } + if (!FeatureMapUtil.isMany(eObject, feature)) + { + runtimeException = new IndexOutOfBoundsException("Index applies only to multi-valued features"); + setEObject(null); + return; + } + int size = ((List) eObject.eGet(feature)).size(); + if (index >= size) + { + // The index value should be less than size. + runtimeException = new IndexOutOfBoundsException("Index value should have been less than " + size); + setEObject(null); + } + this.index = index; + } + + protected void process(String pathString) + { + TokenList tokens = new TokenList(pathString.toCharArray()); + String token; + int size = tokens.size(); + int x = 0; + + if ("/".equals(tokens.peek(0))) + { + setEObject(EcoreUtil.getRootContainer(eObject)); + x++; + } + + for (; x < size; x++) + { + token = tokens.peek(x); + char c = token.charAt(0); + if ('/' == c) + { + setEObject((EObject)get()); + if (eObject == null) break; + } + else if ("..".equals(token)) + { + setEObject(eObject.eContainer()); + if (eObject == null) break; + } + else if ('[' == c) + { + x++; // skip [ + token = tokens.peek(x); // name or index + char following = tokens.peek(x + 1).charAt(0); + if ('=' != following) + { + try + { + setIndex(Integer.parseInt(token) - 1); + // runtimeException may be recorded + } + catch(NumberFormatException eNumberFormat) + { + runtimeException = eNumberFormat; + setEObject(null); + break; + } + if (runtimeException != null) + break; + x++; // skip ] + } + else + { + x++; // done name + x++; // skip = + String attributeValue = tokens.peek(x); // value + if ("\"".equals(attributeValue)) + { + x++; // skip " + attributeValue = tokens.peek(++x); + } + x++; // skip ] + int index = matchingIndex((List)get(), token, attributeValue); + if (index < 0) + { + setEObject(null); + break; + } + else + { + setIndex(index); + } + } + } + else if ('@' == c) + { + // skip @ + } + else + { + setFeatureName(token); + if (eObject == null) break; + } + } + } + + protected static int matchingIndex(List dataObjects, String attributeName, String attributeValue) + { + for (int i = 0, size = dataObjects.size(); i < size; i++) + { + DataObject dataObject = (DataObject)dataObjects.get(i); + Property property = getInstanceProperty(dataObject, attributeName); + if (property != null) + { + Object test = dataObject.get(property); + if (test != null) + { + String testString = EcoreUtil.convertToString((EDataType)property.getType(), test); + if (attributeValue.equals(testString)) + { + return i; + } + } + } + } + return -1; + } + + protected static class TokenList extends BasicEList + { + public TokenList(char[] path) + { + super(4); + + int pathLength = path.length; + StringBuffer token = new StringBuffer(); + char cPrev; + char c = 0; + char cNext; + char stringConstant = 0; + for (int pos = 0; pos < pathLength; pos++) + { + cPrev = c; + c = path[pos]; + cNext = pos < pathLength - 1 ? path[pos + 1] : 0; + + if (stringConstant != 0) + { + if (c == stringConstant) + { + endToken(token, true); + stringConstant = 0; + } + else + { + token.append(c); + } + } + else + { + switch (c) + { + case ' ': + case 0xA: + case 0xD: + case 0x9: + if (cPrev != ' ') + { + endToken(token, false); + } + c = ' '; + break; + + case '"': + case '\'': + endToken(token, false); + stringConstant = c; + break; + + // double or single tokens + case '/': + case ':': + if (cPrev != c) + { + endToken(token, false); + } + token.append(c); + if (cNext != c) + { + endToken(token, false); + } + break; + + // double token (..) + case '.': + if (cNext == '.') + endToken(token, false); + token.append(c); + if (cPrev == '.') + endToken(token, false); + break; + + // single tokens + case '*': + case '@': + case '[': + case ']': + case '(': + case ')': + case '|': + endToken(token, false); + add(String.valueOf(c)); + break; + + // TODO: < > <= >= + - != + case '!': + endToken(token, false); + token.append(c); + break; + + case '=': + endToken(token, false); + add(String.valueOf(c)); + break; + + default: + token.append(c); + } + } + } + endToken(token, false); + } + + public String peek() + { + return size > 0 ? (String)data[0] : " "; + } + + public String peek(int index) + { + return index < size ? (String)data[index] : " "; + } + + public TokenList pop() + { + remove(0); + return this; + } + + public TokenList pop(int count) + { + while (count-- > 0) + { + remove(count); + } + return this; + } + + protected void endToken(StringBuffer token, boolean includeEmpty) + { + if (includeEmpty || token.length() > 0) + { + add(token.toString()); + } + token.setLength(0); + } + + protected boolean canContainNull() + { + return false; + } + + protected Object[] newData(int capacity) + { + return new String [capacity]; + } + } + + public String toString() + { + StringBuffer result = new StringBuffer("Accessor (object:"); + result.append(eObject == null ? "null" : eObject.toString()); + result.append(", feature:"); + result.append(feature == null ? "null" : feature.getName()); + result.append(", index:"); + result.append(index); + result.append(")"); + return result.toString(); + } + } + + public static Type getType(DataObject dataObject, String namespaceURI, String typeName) + { + DataGraph dataGraph = dataObject.getDataGraph(); + if (dataGraph != null) + { + return dataGraph.getType(namespaceURI, typeName); + } + else + { + //TODO think about where else to find the type + return TypeHelper.INSTANCE.getType(namespaceURI, typeName); + } + } + + public static Property getInstanceProperty(DataObject dataObject, String propertyName) + { + ClassImpl type = (ClassImpl)dataObject.getType(); + Property property = type.getProperty(propertyName); + if (property == null) + { + property = type.getOpenProperty((EObject)dataObject, propertyName); + //throw new IllegalArgumentException("Type '" + dataObject.getType().getName() + "' does not have a property named '" + propertyName + "'"); + } + + return property; + } + + public static Property getProperty(DataObject dataObject, int propertyIndex) + { + List typeProperties = dataObject.getType().getProperties(); + try { + Property property = propertyIndex < typeProperties.size() ? + (Property)typeProperties.get(propertyIndex) : + (Property)dataObject.getInstanceProperties().get(propertyIndex); + + return property; + } catch (IndexOutOfBoundsException e) { + throw new IllegalArgumentException(); + } + } + + public static Property getContainmentProperty(Property property) + { + if (property.isContainment()) + { + return property; + } + throw new IllegalArgumentException("The property '" + property.getName() + "' of '" + property.getContainingType().getName() + + "' isn't a containment"); + } + + public static DataObject create(Type type) + { + //return (DataObject)EcoreUtil.create((EClass)type); + if ((type instanceof EClass) && !type.isAbstract()) { + EClass eClass = (EClass)type; + try { + return (DataObject)EcoreUtil.create(eClass); + } catch (ClassCastException e) { + throw new IllegalArgumentException(); + } + } + throw new IllegalArgumentException(); + } + + public static ResourceSet createResourceSet() + { + ResourceSet result = new ResourceSetImpl(); + configureResourceSet(result); + return result; + } + + protected static Map registrations; + + protected static Map getRegistrations() + { + if (registrations == null) + { + Map result = new HashMap(); + + Resource.Factory factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.datagraph")); + result.put("datagraph", factory instanceof DataGraphResourceFactoryImpl ? factory : new DataGraphResourceFactoryImpl()); + + factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.ecore")); + result.put("ecore", factory instanceof EcoreResourceFactoryImpl ? factory : new EcoreResourceFactoryImpl()); + + factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.emof")); + result.put("emof", factory instanceof EMOFResourceFactoryImpl ? factory : new EMOFResourceFactoryImpl()); + + factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.xsd")); + result.put("xsd", factory instanceof XSDResourceFactoryImpl ? factory : new XSDResourceFactoryImpl()); + + factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.wsdl")); + result.put("wsdl", factory instanceof XSDResourceFactoryImpl ? factory : new XSDResourceFactoryImpl()); + + factory = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.*")); + result.put("*", factory instanceof SDOXMLResourceFactoryImpl ? factory : new SDOXMLResourceFactoryImpl()); + + registrations = result; + } + + return registrations; + } + + protected static void configureResourceSet(ResourceSet resourceSet) + { + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().putAll(getRegistrations()); + resourceSet.setPackageRegistry(new EPackageRegistryImpl(HelperContextImpl.getBuiltInModelRegistry())); + resourceSet.setURIConverter(new SDOURIConverterImpl()); + } + + public static EClass createDocumentRoot() + { + EClass documentRootEClass = (EClass)SDOFactory.eINSTANCE.createClass(); + documentRootEClass.setName("DocumentRoot"); + ExtendedMetaData.INSTANCE.setName(documentRootEClass, ""); + ExtendedMetaData.INSTANCE.setContentKind(documentRootEClass, ExtendedMetaData.MIXED_CONTENT); + + EAttribute mixed = (EAttribute)SDOFactory.eINSTANCE.createAttribute(); + mixed.setName("mixed"); + mixed.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry()); + mixed.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + ExtendedMetaData.INSTANCE.setName(mixed, ":mixed"); + ExtendedMetaData.INSTANCE.setFeatureKind(mixed, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE); + documentRootEClass.getEStructuralFeatures().add(mixed); + + EReference xmlnsPrefixMap = (EReference)SDOFactory.eINSTANCE.createReference(); + xmlnsPrefixMap.setName("xMLNSPrefixMap"); + xmlnsPrefixMap.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry()); + xmlnsPrefixMap.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + xmlnsPrefixMap.setContainment(true); + xmlnsPrefixMap.setTransient(true); + ExtendedMetaData.INSTANCE.setName(xmlnsPrefixMap, "xmlns:prefix"); + ExtendedMetaData.INSTANCE.setFeatureKind(xmlnsPrefixMap, ExtendedMetaData.ATTRIBUTE_FEATURE); + documentRootEClass.getEStructuralFeatures().add(xmlnsPrefixMap); + + EReference xsiSchemaLocation = (EReference)SDOFactory.eINSTANCE.createReference(); + xsiSchemaLocation.setName("xSISchemaLocation"); + xsiSchemaLocation.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry()); + xsiSchemaLocation.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + xsiSchemaLocation.setContainment(true); + xsiSchemaLocation.setTransient(true); + ExtendedMetaData.INSTANCE.setName(xsiSchemaLocation, "xsi:schemaLocation"); + ExtendedMetaData.INSTANCE.setFeatureKind(xsiSchemaLocation, ExtendedMetaData.ATTRIBUTE_FEATURE); + documentRootEClass.getEStructuralFeatures().add(xsiSchemaLocation); + + return documentRootEClass; + } + + /** + * Configure EMF to support the SDO runtime by registering a specialized Ecore factory, SDOEcoreFactory. + * This static initializion must run before any SDO metadata is created or loaded. + * As long as SDO helper classes (e.g., TypeHelper, XMLHelper, etc.) are accessed though their + * corresponding INSTANCE fields (e.g., TypeHelper.INSTANCE), or using the SDOUtil methods (e.g., + * SDOUtil.createTypeHelper(), this will always be the case. + */ + /* + static + { + EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, new EPackage.Descriptor() + { + public EPackage getEPackage() + { + return EcorePackage.eINSTANCE; + } + + public EFactory getEFactory() + { + return new SDOFactoryImpl.SDOEcoreFactory(); + } + }); + } + */ + + /* + protected static StringBuffer getXPath(DataObject dataObject, StringBuffer path, DataObject root) + { + DataObject container = dataObject.getContainer(); + if (container == null) return path; + + if (container == root) { + throw new IllegalStateException("There is a cycle in the containment hierarchy of " + root); + } + + boolean first = path.length() == 0; + Property property = dataObject.getContainmentProperty(); + if (SDOUtil.isMany(property, dataObject)) + { + List list = container.getList(property); + int pos = list.indexOf(dataObject); + path.insert(0, property.getName() + "." + pos + (first ? "" : "/")); + } + else + { + path.insert(0, property.getName() + (first ? "" : "/")); + } + + return getXPath(container, path, root); + } + */ + + public static String getXPath(DataObject dataObject) + { + return SDOUtil.getXPath(dataObject); + //StringBuffer path = getXPath(dataObject, new StringBuffer(), dataObject); + //return path.toString(); + } + + protected static XMLParserPool globalXMLParserPool = new XMLParserPoolImpl(); + + public static void configureXMLResource(XMLResource resource, ExtendedMetaData extendedMetaData) + { + XMLOptions xmlOptions = new XMLOptionsImpl(); + xmlOptions.setProcessAnyXML(true); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_XML_OPTIONS, xmlOptions); + + resource.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, globalXMLParserPool); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE); + + resource.getDefaultSaveOptions().put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + resource.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + resource.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + + //resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, globalHashMap); + + //resource.getDefaultSaveOptions().put(XMLResource.OPTION_FORMATTED, Boolean.FALSE); + } + + /** + * @deprecated SDO runtime initialization is no longer required + */ + public static void initRuntime() + { + // NOOP since init is done during static initialization of this class. See above. + } + + /* + public static Object get(org.apache.tuscany.sdo.model.Property property, int propertyIndex) { + switch(propertyIndex) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return property.getAliasName(); + case ModelPackageImpl.PROPERTY__ANY: + return property.getAny(); + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return property.getAnyAttribute(); + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return Boolean.valueOf(property.isContainment()); + case ModelPackageImpl.PROPERTY__DEFAULT: + return property.getDefault_(); + case ModelPackageImpl.PROPERTY__MANY: + return Boolean.valueOf(property.isMany()); + case ModelPackageImpl.PROPERTY__NAME: + return property.getName(); + case ModelPackageImpl.PROPERTY__OPPOSITE: + return property.getOpposite_(); + case ModelPackageImpl.PROPERTY__READ_ONLY: + return Boolean.valueOf(property.isReadOnly()); + case ModelPackageImpl.PROPERTY__TYPE: + return property.getType_(); + } + return null; + } + + public static boolean isSet(org.apache.tuscany.sdo.model.Property property, int propertyIndex) { + switch(propertyIndex) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return !property.getAliasName().isEmpty(); + case ModelPackageImpl.PROPERTY__ANY: + return false; + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return false; + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return property.isSetContainment(); + case ModelPackageImpl.PROPERTY__DEFAULT: + return property.getDefault_() != null; + case ModelPackageImpl.PROPERTY__MANY: + return property.isSetMany(); + case ModelPackageImpl.PROPERTY__NAME: + return property.getName() != null; + case ModelPackageImpl.PROPERTY__OPPOSITE: + return property.getOpposite_() != null; + case ModelPackageImpl.PROPERTY__READ_ONLY: + return property.isSetReadOnly(); + case ModelPackageImpl.PROPERTY__TYPE: + return property.getType_() != null; + } + return false; + } + + public static Object get(org.apache.tuscany.sdo.model.Type type, int propertyIndex) { + switch (propertyIndex) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return type.getBaseType(); + case ModelPackageImpl.TYPE__PROPERTY: + return type.getProperty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return type.getAliasName(); + case ModelPackageImpl.TYPE__ANY: + return type.getAny(); + case ModelPackageImpl.TYPE__ABSTRACT: + return Boolean.valueOf(type.isAbstract()); + case ModelPackageImpl.TYPE__DATA_TYPE: + return Boolean.valueOf(type.isDataType()); + case ModelPackageImpl.TYPE__NAME: + return type.getName(); + case ModelPackageImpl.TYPE__OPEN: + return Boolean.valueOf(type.isOpen()); + case ModelPackageImpl.TYPE__SEQUENCED: + return Boolean.valueOf(type.isSequenced()); + case ModelPackageImpl.TYPE__URI: + return type.getUri(); + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return type.getAnyAttribute(); + } + return null; + } + + public static boolean isSet(org.apache.tuscany.sdo.model.Type type, int propertyIndex) { + //FB Note that this implementation has the undesirable effect of invoking lazy creation of feature lists + switch (propertyIndex) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return !type.getBaseType().isEmpty(); + case ModelPackageImpl.TYPE__PROPERTY: + return !type.getProperty().isEmpty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return !type.getAliasName().isEmpty(); + case ModelPackageImpl.TYPE__ANY: + return false; + case ModelPackageImpl.TYPE__ABSTRACT: + return type.isSetAbstract(); + case ModelPackageImpl.TYPE__DATA_TYPE: + return type.isSetDataType(); + case ModelPackageImpl.TYPE__NAME: + return type.getName() != null; + case ModelPackageImpl.TYPE__OPEN: + return type.isSetOpen(); + case ModelPackageImpl.TYPE__SEQUENCED: + return type.isSetSequenced(); + case ModelPackageImpl.TYPE__URI: + return type.getUri() != null; + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return false; + } + return false; + } + */ + + /** + * Returns a unique list of meta object instance properties (stored in EAnnotations) + * + * @param metaObject - A Type or Property instance + * @return A list of commonj.sdo.Property instances + */ + public static List getMetaObjectInstanceProperties(EModelElement metaObject) + { + // Use the default helper context for now + // TypeHelper typeHelper = HelperProvider.getDefaultContext().getTypeHelper(); + HelperContext hc = HelperProvider.getDefaultContext(); + + List result = new UniqueEList(); + List annotations = metaObject.getEAnnotations(); + int size = annotations.size(); + for (int i=0; i
+ * The following features are supported: + *
+ * If the meaning of the 'Factory Interface' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Factory Interface' attribute. + * @see #setFactoryInterface(String) + * @generated + */ + String getFactoryInterface(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getFactoryInterface Factory Interface}' attribute. + * + * + * @param value the new value of the 'Factory Interface' attribute. + * @see #getFactoryInterface() + * @generated + */ + void setFactoryInterface(String value); + + /** + * Returns the value of the 'Type Interface' attribute. + * + *+ * If the meaning of the 'Type Interface' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Type Interface' attribute. + * @see #setTypeInterface(String) + * @generated + */ + String getTypeInterface(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getTypeInterface Type Interface}' attribute. + * + * + * @param value the new value of the 'Type Interface' attribute. + * @see #getTypeInterface() + * @generated + */ + void setTypeInterface(String value); + +} // JavaMetaData diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java new file mode 100644 index 0000000000..1f540afa2c --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java @@ -0,0 +1,77 @@ +/** + * + * 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.util.metadata; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface MetadataFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + MetadataFactory INSTANCE = org.apache.tuscany.sdo.util.metadata.impl.MetadataFactoryImpl.init(); + + /** + * Returns a new object of class 'Java Meta Data'. + * + * + * @return a new object of class 'Java Meta Data'. + * @generated + */ + JavaMetaData createJavaMetaData(); + + /** + * Returns a new object of class 'SDO Meta Data Group'. + * + * + * @return a new object of class 'SDO Meta Data Group'. + * @generated + */ + SDOMetaDataGroup createSDOMetaDataGroup(); + + /** + * Returns a new object of class 'Type Meta Data'. + * + * + * @return a new object of class 'Type Meta Data'. + * @generated + */ + TypeMetaData createTypeMetaData(); + + /** + * Returns a new object of class 'XSD Meta Data'. + * + * + * @return a new object of class 'XSD Meta Data'. + * @generated + */ + XSDMetaData createXSDMetaData(); + +} //MetadataFactory diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java new file mode 100644 index 0000000000..5657f26ca5 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java @@ -0,0 +1,87 @@ +/** + * + * 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.util.metadata; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'SDO Meta Data Group'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Java Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Java Meta Data' containment reference list. + * @generated + */ + List getJavaMetaData(); + + /** + * Returns the value of the 'Xsd Meta Data' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.util.metadata.XSDMetaData}. + * + *+ * If the meaning of the 'Xsd Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Xsd Meta Data' containment reference list. + * @generated + */ + List getXsdMetaData(); + + /** + * Returns the value of the 'Type Meta Data' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.util.metadata.TypeMetaData}. + * + *+ * If the meaning of the 'Type Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Type Meta Data' containment reference list. + * @generated + */ + List getTypeMetaData(); + +} // SDOMetaDataGroup diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java new file mode 100644 index 0000000000..c3d67a8318 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java @@ -0,0 +1,65 @@ +/** + * + * 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.util.metadata; + +import java.io.Serializable; + +/** + * + * A representation of the model object 'Type Meta Data'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Location' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Location' attribute. + * @see #setLocation(String) + * @generated + */ + String getLocation(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.TypeMetaData#getLocation Location}' attribute. + * + * + * @param value the new value of the 'Location' attribute. + * @see #getLocation() + * @generated + */ + void setLocation(String value); + +} // TypeMetaData diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java new file mode 100644 index 0000000000..09bffece71 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java @@ -0,0 +1,66 @@ +/** + * + * 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.util.metadata; + +import java.io.Serializable; + +/** + * + * A representation of the model object 'XSD Meta Data'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Location' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Location' attribute. + * @see #setLocation(String) + * @generated + */ + String getLocation(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.XSDMetaData#getLocation Location}' attribute. + * + * + * @param value the new value of the 'Location' attribute. + * @see #getLocation() + * @generated + */ + void setLocation(String value); + +} // XSDMetaData diff --git a/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java new file mode 100644 index 0000000000..8a6dce6161 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java @@ -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.util.metadata.impl; + +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.metadata.JavaMetaData; +import org.apache.tuscany.sdo.util.metadata.MetadataFactory; + +/** + * + * An implementation of the model object 'Java Meta Data'. + * + *+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'String Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'String Val' attribute. + * @see #isSetStringVal() + * @see #unsetStringVal() + * @see #setStringVal(String) + * @generated + */ + String getStringVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getStringVal String Val}' attribute. + * + * + * @param value the new value of the 'String Val' attribute. + * @see #isSetStringVal() + * @see #unsetStringVal() + * @see #getStringVal() + * @generated + */ + void setStringVal(String value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getStringVal String Val}' attribute. + * + * + * @see #isSetStringVal() + * @see #getStringVal() + * @see #setStringVal(String) + * @generated + */ + void unsetStringVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getStringVal String Val}' attribute is set. + * + * + * @return whether the value of the 'String Val' attribute is set. + * @see #unsetStringVal() + * @see #getStringVal() + * @see #setStringVal(String) + * @generated + */ + boolean isSetStringVal(); + + /** + * Returns the value of the 'Boolean Val' attribute. + * + *+ * If the meaning of the 'Boolean Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Boolean Val' attribute. + * @see #isSetBooleanVal() + * @see #unsetBooleanVal() + * @see #setBooleanVal(boolean) + * @generated + */ + boolean isBooleanVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#isBooleanVal Boolean Val}' attribute. + * + * + * @param value the new value of the 'Boolean Val' attribute. + * @see #isSetBooleanVal() + * @see #unsetBooleanVal() + * @see #isBooleanVal() + * @generated + */ + void setBooleanVal(boolean value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#isBooleanVal Boolean Val}' attribute. + * + * + * @see #isSetBooleanVal() + * @see #isBooleanVal() + * @see #setBooleanVal(boolean) + * @generated + */ + void unsetBooleanVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#isBooleanVal Boolean Val}' attribute is set. + * + * + * @return whether the value of the 'Boolean Val' attribute is set. + * @see #unsetBooleanVal() + * @see #isBooleanVal() + * @see #setBooleanVal(boolean) + * @generated + */ + boolean isSetBooleanVal(); + + /** + * Returns the value of the 'Byte Val' attribute. + * + *+ * If the meaning of the 'Byte Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Byte Val' attribute. + * @see #isSetByteVal() + * @see #unsetByteVal() + * @see #setByteVal(byte) + * @generated + */ + byte getByteVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getByteVal Byte Val}' attribute. + * + * + * @param value the new value of the 'Byte Val' attribute. + * @see #isSetByteVal() + * @see #unsetByteVal() + * @see #getByteVal() + * @generated + */ + void setByteVal(byte value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getByteVal Byte Val}' attribute. + * + * + * @see #isSetByteVal() + * @see #getByteVal() + * @see #setByteVal(byte) + * @generated + */ + void unsetByteVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getByteVal Byte Val}' attribute is set. + * + * + * @return whether the value of the 'Byte Val' attribute is set. + * @see #unsetByteVal() + * @see #getByteVal() + * @see #setByteVal(byte) + * @generated + */ + boolean isSetByteVal(); + + /** + * Returns the value of the 'Decimal Val' attribute. + * + *+ * If the meaning of the 'Decimal Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Decimal Val' attribute. + * @see #isSetDecimalVal() + * @see #unsetDecimalVal() + * @see #setDecimalVal(BigDecimal) + * @generated + */ + BigDecimal getDecimalVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDecimalVal Decimal Val}' attribute. + * + * + * @param value the new value of the 'Decimal Val' attribute. + * @see #isSetDecimalVal() + * @see #unsetDecimalVal() + * @see #getDecimalVal() + * @generated + */ + void setDecimalVal(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDecimalVal Decimal Val}' attribute. + * + * + * @see #isSetDecimalVal() + * @see #getDecimalVal() + * @see #setDecimalVal(BigDecimal) + * @generated + */ + void unsetDecimalVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDecimalVal Decimal Val}' attribute is set. + * + * + * @return whether the value of the 'Decimal Val' attribute is set. + * @see #unsetDecimalVal() + * @see #getDecimalVal() + * @see #setDecimalVal(BigDecimal) + * @generated + */ + boolean isSetDecimalVal(); + + /** + * Returns the value of the 'Int Val' attribute. + * + *+ * If the meaning of the 'Int Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Int Val' attribute. + * @see #isSetIntVal() + * @see #unsetIntVal() + * @see #setIntVal(int) + * @generated + */ + int getIntVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntVal Int Val}' attribute. + * + * + * @param value the new value of the 'Int Val' attribute. + * @see #isSetIntVal() + * @see #unsetIntVal() + * @see #getIntVal() + * @generated + */ + void setIntVal(int value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntVal Int Val}' attribute. + * + * + * @see #isSetIntVal() + * @see #getIntVal() + * @see #setIntVal(int) + * @generated + */ + void unsetIntVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntVal Int Val}' attribute is set. + * + * + * @return whether the value of the 'Int Val' attribute is set. + * @see #unsetIntVal() + * @see #getIntVal() + * @see #setIntVal(int) + * @generated + */ + boolean isSetIntVal(); + + /** + * Returns the value of the 'Float Val' attribute. + * + *+ * If the meaning of the 'Float Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Float Val' attribute. + * @see #isSetFloatVal() + * @see #unsetFloatVal() + * @see #setFloatVal(float) + * @generated + */ + float getFloatVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getFloatVal Float Val}' attribute. + * + * + * @param value the new value of the 'Float Val' attribute. + * @see #isSetFloatVal() + * @see #unsetFloatVal() + * @see #getFloatVal() + * @generated + */ + void setFloatVal(float value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getFloatVal Float Val}' attribute. + * + * + * @see #isSetFloatVal() + * @see #getFloatVal() + * @see #setFloatVal(float) + * @generated + */ + void unsetFloatVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getFloatVal Float Val}' attribute is set. + * + * + * @return whether the value of the 'Float Val' attribute is set. + * @see #unsetFloatVal() + * @see #getFloatVal() + * @see #setFloatVal(float) + * @generated + */ + boolean isSetFloatVal(); + + /** + * Returns the value of the 'Double Val' attribute. + * + *+ * If the meaning of the 'Double Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Double Val' attribute. + * @see #isSetDoubleVal() + * @see #unsetDoubleVal() + * @see #setDoubleVal(double) + * @generated + */ + double getDoubleVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDoubleVal Double Val}' attribute. + * + * + * @param value the new value of the 'Double Val' attribute. + * @see #isSetDoubleVal() + * @see #unsetDoubleVal() + * @see #getDoubleVal() + * @generated + */ + void setDoubleVal(double value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDoubleVal Double Val}' attribute. + * + * + * @see #isSetDoubleVal() + * @see #getDoubleVal() + * @see #setDoubleVal(double) + * @generated + */ + void unsetDoubleVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDoubleVal Double Val}' attribute is set. + * + * + * @return whether the value of the 'Double Val' attribute is set. + * @see #unsetDoubleVal() + * @see #getDoubleVal() + * @see #setDoubleVal(double) + * @generated + */ + boolean isSetDoubleVal(); + + /** + * Returns the value of the 'Date Val' attribute. + * + *+ * If the meaning of the 'Date Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Date Val' attribute. + * @see #isSetDateVal() + * @see #unsetDateVal() + * @see #setDateVal(String) + * @generated + */ + String getDateVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDateVal Date Val}' attribute. + * + * + * @param value the new value of the 'Date Val' attribute. + * @see #isSetDateVal() + * @see #unsetDateVal() + * @see #getDateVal() + * @generated + */ + void setDateVal(String value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDateVal Date Val}' attribute. + * + * + * @see #isSetDateVal() + * @see #getDateVal() + * @see #setDateVal(String) + * @generated + */ + void unsetDateVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getDateVal Date Val}' attribute is set. + * + * + * @return whether the value of the 'Date Val' attribute is set. + * @see #unsetDateVal() + * @see #getDateVal() + * @see #setDateVal(String) + * @generated + */ + boolean isSetDateVal(); + + /** + * Returns the value of the 'Short Val' attribute. + * + *+ * If the meaning of the 'Short Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Short Val' attribute. + * @see #isSetShortVal() + * @see #unsetShortVal() + * @see #setShortVal(short) + * @generated + */ + short getShortVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getShortVal Short Val}' attribute. + * + * + * @param value the new value of the 'Short Val' attribute. + * @see #isSetShortVal() + * @see #unsetShortVal() + * @see #getShortVal() + * @generated + */ + void setShortVal(short value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getShortVal Short Val}' attribute. + * + * + * @see #isSetShortVal() + * @see #getShortVal() + * @see #setShortVal(short) + * @generated + */ + void unsetShortVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getShortVal Short Val}' attribute is set. + * + * + * @return whether the value of the 'Short Val' attribute is set. + * @see #unsetShortVal() + * @see #getShortVal() + * @see #setShortVal(short) + * @generated + */ + boolean isSetShortVal(); + + /** + * Returns the value of the 'Long Val' attribute. + * + *+ * If the meaning of the 'Long Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Long Val' attribute. + * @see #isSetLongVal() + * @see #unsetLongVal() + * @see #setLongVal(long) + * @generated + */ + long getLongVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getLongVal Long Val}' attribute. + * + * + * @param value the new value of the 'Long Val' attribute. + * @see #isSetLongVal() + * @see #unsetLongVal() + * @see #getLongVal() + * @generated + */ + void setLongVal(long value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getLongVal Long Val}' attribute. + * + * + * @see #isSetLongVal() + * @see #getLongVal() + * @see #setLongVal(long) + * @generated + */ + void unsetLongVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getLongVal Long Val}' attribute is set. + * + * + * @return whether the value of the 'Long Val' attribute is set. + * @see #unsetLongVal() + * @see #getLongVal() + * @see #setLongVal(long) + * @generated + */ + boolean isSetLongVal(); + + /** + * Returns the value of the 'List Val' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'List Val' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'List Val' attribute list. + * @generated + */ + List getListVal(); + + /** + * Returns the value of the 'Bytes Val' attribute. + * + *+ * If the meaning of the 'Bytes Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Bytes Val' attribute. + * @see #isSetBytesVal() + * @see #unsetBytesVal() + * @see #setBytesVal(byte[]) + * @generated + */ + byte[] getBytesVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getBytesVal Bytes Val}' attribute. + * + * + * @param value the new value of the 'Bytes Val' attribute. + * @see #isSetBytesVal() + * @see #unsetBytesVal() + * @see #getBytesVal() + * @generated + */ + void setBytesVal(byte[] value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getBytesVal Bytes Val}' attribute. + * + * + * @see #isSetBytesVal() + * @see #getBytesVal() + * @see #setBytesVal(byte[]) + * @generated + */ + void unsetBytesVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getBytesVal Bytes Val}' attribute is set. + * + * + * @return whether the value of the 'Bytes Val' attribute is set. + * @see #unsetBytesVal() + * @see #getBytesVal() + * @see #setBytesVal(byte[]) + * @generated + */ + boolean isSetBytesVal(); + + /** + * Returns the value of the 'Integer Val' attribute. + * + *+ * If the meaning of the 'Integer Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Integer Val' attribute. + * @see #isSetIntegerVal() + * @see #unsetIntegerVal() + * @see #setIntegerVal(BigInteger) + * @generated + */ + BigInteger getIntegerVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntegerVal Integer Val}' attribute. + * + * + * @param value the new value of the 'Integer Val' attribute. + * @see #isSetIntegerVal() + * @see #unsetIntegerVal() + * @see #getIntegerVal() + * @generated + */ + void setIntegerVal(BigInteger value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntegerVal Integer Val}' attribute. + * + * + * @see #isSetIntegerVal() + * @see #getIntegerVal() + * @see #setIntegerVal(BigInteger) + * @generated + */ + void unsetIntegerVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getIntegerVal Integer Val}' attribute is set. + * + * + * @return whether the value of the 'Integer Val' attribute is set. + * @see #unsetIntegerVal() + * @see #getIntegerVal() + * @see #setIntegerVal(BigInteger) + * @generated + */ + boolean isSetIntegerVal(); + + /** + * Returns the value of the 'Char Val' attribute. + * + *+ * If the meaning of the 'Char Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Char Val' attribute. + * @see #isSetCharVal() + * @see #unsetCharVal() + * @see #setCharVal(String) + * @generated + */ + String getCharVal(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getCharVal Char Val}' attribute. + * + * + * @param value the new value of the 'Char Val' attribute. + * @see #isSetCharVal() + * @see #unsetCharVal() + * @see #getCharVal() + * @generated + */ + void setCharVal(String value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getCharVal Char Val}' attribute. + * + * + * @see #isSetCharVal() + * @see #getCharVal() + * @see #setCharVal(String) + * @generated + */ + void unsetCharVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getCharVal Char Val}' attribute is set. + * + * + * @return whether the value of the 'Char Val' attribute is set. + * @see #unsetCharVal() + * @see #getCharVal() + * @see #setCharVal(String) + * @generated + */ + boolean isSetCharVal(); + + /** + * Returns the value of the 'Read Only Val' attribute. + * + *+ * If the meaning of the 'Read Only Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Read Only Val' attribute. + * @see #isSetReadOnlyVal() + * @generated + */ + String getReadOnlyVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getReadOnlyVal Read Only Val}' attribute is set. + * + * + * @return whether the value of the 'Read Only Val' attribute is set. + * @see #getReadOnlyVal() + * @generated + */ + boolean isSetReadOnlyVal(); + + /** + * Returns the value of the 'Read Only List Val' attribute. + * + *+ * If the meaning of the 'Read Only List Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Read Only List Val' attribute. + * @see #isSetReadOnlyListVal() + * @generated + */ + String getReadOnlyListVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.ExpectedExceptionType#getReadOnlyListVal Read Only List Val}' attribute is set. + * + * + * @return whether the value of the 'Read Only List Val' attribute is set. + * @see #getReadOnlyListVal() + * @generated + */ + boolean isSetReadOnlyListVal(); + +} // ExpectedExceptionType diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/SequenceReadOnlyType.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/SequenceReadOnlyType.java new file mode 100644 index 0000000000..a87511df28 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/SequenceReadOnlyType.java @@ -0,0 +1,158 @@ +/** + * + * 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 com.example.ExpectedException; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +/** + * + * A representation of the model object 'Sequence Read Only Type'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Read Only Val' attribute. + * + *+ * If the meaning of the 'Read Only Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Read Only Val' attribute. + * @see #isSetReadOnlyVal() + * @generated + */ + String getReadOnlyVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.SequenceReadOnlyType#getReadOnlyVal Read Only Val}' attribute is set. + * + * + * @return whether the value of the 'Read Only Val' attribute is set. + * @see #getReadOnlyVal() + * @generated + */ + boolean isSetReadOnlyVal(); + + /** + * Returns the value of the 'Read Only List Val' attribute. + * + *+ * If the meaning of the 'Read Only List Val' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Read Only List Val' attribute. + * @see #isSetReadOnlyListVal() + * @generated + */ + String getReadOnlyListVal(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.SequenceReadOnlyType#getReadOnlyListVal Read Only List Val}' attribute is set. + * + * + * @return whether the value of the 'Read Only List Val' attribute is set. + * @see #getReadOnlyListVal() + * @generated + */ + boolean isSetReadOnlyListVal(); + + /** + * Returns the value of the 'Unique Name' attribute. + * + *+ * If the meaning of the 'Unique Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Unique Name' attribute. + * @see #isSetUniqueName() + * @see #unsetUniqueName() + * @see #setUniqueName(String) + * @generated + */ + String getUniqueName(); + + /** + * Sets the value of the '{@link com.example.ExpectedException.SequenceReadOnlyType#getUniqueName Unique Name}' attribute. + * + * + * @param value the new value of the 'Unique Name' attribute. + * @see #isSetUniqueName() + * @see #unsetUniqueName() + * @see #getUniqueName() + * @generated + */ + void setUniqueName(String value); + + /** + * Unsets the value of the '{@link com.example.ExpectedException.SequenceReadOnlyType#getUniqueName Unique Name}' attribute. + * + * + * @see #isSetUniqueName() + * @see #getUniqueName() + * @see #setUniqueName(String) + * @generated + */ + void unsetUniqueName(); + + /** + * Returns whether the value of the '{@link com.example.ExpectedException.SequenceReadOnlyType#getUniqueName Unique Name}' attribute is set. + * + * + * @return whether the value of the 'Unique Name' attribute is set. + * @see #unsetUniqueName() + * @see #getUniqueName() + * @see #setUniqueName(String) + * @generated + */ + boolean isSetUniqueName(); + +} // SequenceReadOnlyType diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionFactoryImpl.java new file mode 100644 index 0000000000..68280749c4 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionFactoryImpl.java @@ -0,0 +1,579 @@ +/** + * + * 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 com.example.ExpectedException.impl; + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import com.example.ExpectedException.*; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.SDOFactory; + +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.internal.InternalFactory; + +import org.apache.tuscany.sdo.util.SDOUtil; + +/** + * + * An implementation of the model Factory. + * Generator information: + * patternVersion=1.2; -prefix ExpectedException + * + * @generated + */ +public class ExpectedExceptionFactoryImpl extends FactoryBase implements ExpectedExceptionFactory +{ + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String NAMESPACE_URI = "http://example.com/ExpectedException"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String NAMESPACE_PREFIX = "expect"; + + /** + * The version of the generator pattern used to generate this class. + * + * + * @generated + */ + public static final String PATTERN_VERSION = "1.2"; + + public static final int EXPECTED_EXCEPTION_TYPE = 1; + public static final int SEQUENCE_READ_ONLY_TYPE = 2; + public static final int CHAR = 3; + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public ExpectedExceptionFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.sdo.test.ExpectedException"); + } + + /** + * 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. + * + * + * @generated + */ + public void register(HelperContext scope) { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper(); + th.getExtendedMetaData().putPackage(NAMESPACE_URI, this); + } + + /** + * + * + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + case EXPECTED_EXCEPTION_TYPE: return (DataObject)createExpectedExceptionType(); + case SEQUENCE_READ_ONLY_TYPE: return (DataObject)createSequenceReadOnlyType(); + default: + return super.create(typeNumber); + } + } + + /** + * + * + * @generated + */ + public Object createFromString(int typeNumber, String initialValue) + { + switch (typeNumber) + { + case CHAR: + return createcharFromString(initialValue); + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype"); + } + } + + /** + * + * + * @generated + */ + public String convertToString(int typeNumber, Object instanceValue) + { + switch (typeNumber) + { + case CHAR: + return convertcharToString(instanceValue); + default: + throw new IllegalArgumentException("The type number '" + typeNumber + "' is not a valid datatype"); + } + } + /** + * + * + * @generated + */ + public ExpectedExceptionType createExpectedExceptionType() + { + ExpectedExceptionTypeImpl expectedExceptionType = new ExpectedExceptionTypeImpl(); + return expectedExceptionType; + } + /** + * + * + * @generated + */ + public SequenceReadOnlyType createSequenceReadOnlyType() + { + SequenceReadOnlyTypeImpl sequenceReadOnlyType = new SequenceReadOnlyTypeImpl(); + return sequenceReadOnlyType; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type expectedExceptionTypeType = null; + + public Type getExpectedExceptionType() + { + return expectedExceptionTypeType; + } + + protected Type sequenceReadOnlyTypeType = null; + + public Type getSequenceReadOnlyType() + { + return sequenceReadOnlyTypeType; + } + + protected Type char_Type = null; + + public Type getchar() + { + return char_Type; + } + + + private static boolean isInited = false; + + public static ExpectedExceptionFactoryImpl init() + { + if (isInited) return (ExpectedExceptionFactoryImpl)FactoryBase.getStaticFactory(ExpectedExceptionFactoryImpl.NAMESPACE_URI); + ExpectedExceptionFactoryImpl theExpectedExceptionFactoryImpl = new ExpectedExceptionFactoryImpl(); + isInited = true; + + // Initialize dependencies + SDOUtil.registerStaticTypes(SDOFactory.class); + SDOUtil.registerStaticTypes(ModelFactory.class); + SDOUtil.registerStaticTypes(InternalFactory.class); + + // Create package meta-data objects + theExpectedExceptionFactoryImpl.createMetaData(); + + // Initialize created meta-data + theExpectedExceptionFactoryImpl.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //theExpectedExceptionFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ???? + + return theExpectedExceptionFactoryImpl; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + + // Create types and their properties + expectedExceptionTypeType = createType(false, EXPECTED_EXCEPTION_TYPE); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_STRING_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_BOOLEAN_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_BYTE_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_DECIMAL_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_INT_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_FLOAT_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_DOUBLE_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_DATE_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_SHORT_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_LONG_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_LIST_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_BYTES_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_INTEGER_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_CHAR_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_READ_ONLY_VAL); + createProperty(true, expectedExceptionTypeType,ExpectedExceptionTypeImpl.INTERNAL_READ_ONLY_LIST_VAL); + sequenceReadOnlyTypeType = createType(false, SEQUENCE_READ_ONLY_TYPE); + createProperty(true, sequenceReadOnlyTypeType,SequenceReadOnlyTypeImpl.INTERNAL_MIXED); + createProperty(true, sequenceReadOnlyTypeType,SequenceReadOnlyTypeImpl.INTERNAL_READ_ONLY_VAL); + createProperty(true, sequenceReadOnlyTypeType,SequenceReadOnlyTypeImpl.INTERNAL_READ_ONLY_LIST_VAL); + createProperty(true, sequenceReadOnlyTypeType,SequenceReadOnlyTypeImpl.INTERNAL_UNIQUE_NAME); + + // Create data types + char_Type = createType(true, CHAR ); + } + + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI); + Property property = null; + + // Add supertypes to types + + // Initialize types and properties + initializeType(expectedExceptionTypeType, ExpectedExceptionType.class, "ExpectedExceptionType", false); + property = getLocalProperty(expectedExceptionTypeType, 0); + initializeProperty(property, theModelPackageImpl.getString(), "stringVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 1); + initializeProperty(property, theModelPackageImpl.getBoolean(), "booleanVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 2); + initializeProperty(property, theModelPackageImpl.getByte(), "byteVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 3); + initializeProperty(property, theModelPackageImpl.getDecimal(), "decimalVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 4); + initializeProperty(property, theModelPackageImpl.getInt(), "intVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 5); + initializeProperty(property, theModelPackageImpl.getFloat(), "floatVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 6); + initializeProperty(property, theModelPackageImpl.getDouble(), "doubleVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 7); + initializeProperty(property, theModelPackageImpl.getDateTime(), "dateVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 8); + initializeProperty(property, theModelPackageImpl.getShort(), "shortVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 9); + initializeProperty(property, theModelPackageImpl.getLong(), "longVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 10); + initializeProperty(property, theModelPackageImpl.getString(), "listVal", null, 0, -1, ExpectedExceptionType.class, false, false, false); + + property = getLocalProperty(expectedExceptionTypeType, 11); + initializeProperty(property, theModelPackageImpl.getBytes(), "bytesVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 12); + initializeProperty(property, theModelPackageImpl.getInteger(), "integerVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 13); + initializeProperty(property, this.getchar(), "charVal", null, 1, 1, ExpectedExceptionType.class, false, true, false); + + property = getLocalProperty(expectedExceptionTypeType, 14); + initializeProperty(property, theModelPackageImpl.getString(), "readOnlyVal", null, 1, 1, ExpectedExceptionType.class, true, true, false); + setInstanceProperty (property, "commonj.sdo/xml", "readOnly", "true"); + + property = getLocalProperty(expectedExceptionTypeType, 15); + initializeProperty(property, theModelPackageImpl.getString(), "readOnlyListVal", null, 1, 1, ExpectedExceptionType.class, true, true, false); + setInstanceProperty (property, "commonj.sdo/xml", "readOnly", "true"); + + initializeType(sequenceReadOnlyTypeType, SequenceReadOnlyType.class, "SequenceReadOnlyType", false); + property = getLocalProperty(sequenceReadOnlyTypeType, 0); + initializeProperty(property, getSequence(), "mixed", null, 0, -1, SequenceReadOnlyType.class, false, false, false); + + property = getLocalProperty(sequenceReadOnlyTypeType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "readOnlyVal", null, 1, 1, SequenceReadOnlyType.class, true, true, true); + setInstanceProperty (property, "commonj.sdo/xml", "readOnly", "true"); + + property = getLocalProperty(sequenceReadOnlyTypeType, 2); + initializeProperty(property, theModelPackageImpl.getString(), "readOnlyListVal", null, 1, 1, SequenceReadOnlyType.class, true, true, true); + setInstanceProperty (property, "commonj.sdo/xml", "readOnly", "true"); + + property = getLocalProperty(sequenceReadOnlyTypeType, 3); + initializeProperty(property, theModelPackageImpl.getString(), "uniqueName", null, 1, 1, SequenceReadOnlyType.class, false, true, true); + + // Initialize data types + initializeType(char_Type, String.class, "char", true, false); + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + Property property = null; + + + property = createGlobalProperty + ("expectedExceptionsElem", + this.getExpectedExceptionType(), + new String[] + { + "kind", "element", + "name", "expectedExceptionsElem", + "namespace", "##targetNamespace" + }); + + property = createGlobalProperty + ("sequencedReadOnlyElem", + this.getSequenceReadOnlyType(), + new String[] + { + "kind", "element", + "name", "sequencedReadOnlyElem", + "namespace", "##targetNamespace" + }); + + addXSDMapping + (expectedExceptionTypeType, + new String[] + { + "name", "ExpectedExceptionType", + "kind", "elementOnly" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_STRING_VAL), + new String[] + { + "kind", "element", + "name", "stringVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_BOOLEAN_VAL), + new String[] + { + "kind", "element", + "name", "booleanVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_BYTE_VAL), + new String[] + { + "kind", "element", + "name", "byteVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_DECIMAL_VAL), + new String[] + { + "kind", "element", + "name", "decimalVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_INT_VAL), + new String[] + { + "kind", "element", + "name", "intVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_FLOAT_VAL), + new String[] + { + "kind", "element", + "name", "floatVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_DOUBLE_VAL), + new String[] + { + "kind", "element", + "name", "doubleVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_DATE_VAL), + new String[] + { + "kind", "element", + "name", "dateVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_SHORT_VAL), + new String[] + { + "kind", "element", + "name", "shortVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_LONG_VAL), + new String[] + { + "kind", "element", + "name", "longVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_LIST_VAL), + new String[] + { + "kind", "element", + "name", "listVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_BYTES_VAL), + new String[] + { + "kind", "element", + "name", "bytesVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_INTEGER_VAL), + new String[] + { + "kind", "element", + "name", "integerVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_CHAR_VAL), + new String[] + { + "kind", "element", + "name", "charVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_READ_ONLY_VAL), + new String[] + { + "kind", "element", + "name", "readOnlyVal" + }); + + addXSDMapping + (getProperty(expectedExceptionTypeType, ExpectedExceptionTypeImpl.INTERNAL_READ_ONLY_LIST_VAL), + new String[] + { + "kind", "element", + "name", "readOnlyListVal" + }); + + addXSDMapping + (sequenceReadOnlyTypeType, + new String[] + { + "name", "SequenceReadOnlyType", + "kind", "mixed" + }); + + addXSDMapping + (getProperty(sequenceReadOnlyTypeType, SequenceReadOnlyTypeImpl.INTERNAL_MIXED), + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + + addXSDMapping + (getProperty(sequenceReadOnlyTypeType, SequenceReadOnlyTypeImpl.INTERNAL_READ_ONLY_VAL), + new String[] + { + "kind", "element", + "name", "readOnlyVal" + }); + + addXSDMapping + (getProperty(sequenceReadOnlyTypeType, SequenceReadOnlyTypeImpl.INTERNAL_READ_ONLY_LIST_VAL), + new String[] + { + "kind", "element", + "name", "readOnlyListVal" + }); + + addXSDMapping + (getProperty(sequenceReadOnlyTypeType, SequenceReadOnlyTypeImpl.INTERNAL_UNIQUE_NAME), + new String[] + { + "kind", "element", + "name", "uniqueName" + }); + + addXSDMapping + (char_Type, + new String[] + { + "name", "char", + "baseType", "commonj.sdo#String", + "length", "1" + }); + + } + + /** + * + * + * @generated + */ + public String createcharFromString(String initialValue) + { + return (String)((ModelFactoryImpl)ModelFactory.INSTANCE).createStringFromString(initialValue); + } + + /** + * + * + * @generated + */ + public String convertcharToString(Object instanceValue) + { + return ((ModelFactoryImpl)ModelFactory.INSTANCE).convertStringToString(instanceValue); + } + +} //ExpectedExceptionFactoryImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionTypeImpl.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionTypeImpl.java new file mode 100644 index 0000000000..df7bdbd66e --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionTypeImpl.java @@ -0,0 +1,1682 @@ +/** + * + * 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 com.example.ExpectedException.impl; + +import com.example.ExpectedException.ExpectedExceptionFactory; +import com.example.ExpectedException.ExpectedExceptionType; + +import commonj.sdo.Type; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Type'. + * + *+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'Symbol' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #setSymbol(String) + * @generated + */ + String getSymbol(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getSymbol Symbol}' attribute. + * + * + * @param value the new value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #getSymbol() + * @generated + */ + void setSymbol(String value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getSymbol Symbol}' attribute. + * + * + * @see #isSetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + void unsetSymbol(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getSymbol Symbol}' attribute is set. + * + * + * @return whether the value of the 'Symbol' attribute is set. + * @see #unsetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + boolean isSetSymbol(); + + /** + * Returns the value of the 'Company Name' attribute. + * + *+ * If the meaning of the 'Company Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #setCompanyName(String) + * @generated + */ + String getCompanyName(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getCompanyName Company Name}' attribute. + * + * + * @param value the new value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #getCompanyName() + * @generated + */ + void setCompanyName(String value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getCompanyName Company Name}' attribute. + * + * + * @see #isSetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + void unsetCompanyName(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getCompanyName Company Name}' attribute is set. + * + * + * @return whether the value of the 'Company Name' attribute is set. + * @see #unsetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + boolean isSetCompanyName(); + + /** + * Returns the value of the 'Price' attribute. + * + *+ * If the meaning of the 'Price' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + BigDecimal getPrice(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getPrice Price}' attribute. + * + * + * @param value the new value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #getPrice() + * @generated + */ + void setPrice(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getPrice Price}' attribute. + * + * + * @see #isSetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + void unsetPrice(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getPrice Price}' attribute is set. + * + * + * @return whether the value of the 'Price' attribute is set. + * @see #unsetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + boolean isSetPrice(); + + /** + * Returns the value of the 'Open1' attribute. + * + *+ * If the meaning of the 'Open1' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + BigDecimal getOpen1(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getOpen1 Open1}' attribute. + * + * + * @param value the new value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #getOpen1() + * @generated + */ + void setOpen1(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getOpen1 Open1}' attribute. + * + * + * @see #isSetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + void unsetOpen1(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getOpen1 Open1}' attribute is set. + * + * + * @return whether the value of the 'Open1' attribute is set. + * @see #unsetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + boolean isSetOpen1(); + + /** + * Returns the value of the 'High' attribute. + * + *+ * If the meaning of the 'High' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + BigDecimal getHigh(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getHigh High}' attribute. + * + * + * @param value the new value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #getHigh() + * @generated + */ + void setHigh(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getHigh High}' attribute. + * + * + * @see #isSetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + void unsetHigh(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getHigh High}' attribute is set. + * + * + * @return whether the value of the 'High' attribute is set. + * @see #unsetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + boolean isSetHigh(); + + /** + * Returns the value of the 'Low' attribute. + * + *+ * If the meaning of the 'Low' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #setLow(BigDecimal) + * @generated + */ + BigDecimal getLow(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getLow Low}' attribute. + * + * + * @param value the new value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #getLow() + * @generated + */ + void setLow(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getLow Low}' attribute. + * + * + * @see #isSetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + void unsetLow(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getLow Low}' attribute is set. + * + * + * @return whether the value of the 'Low' attribute is set. + * @see #unsetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + boolean isSetLow(); + + /** + * Returns the value of the 'Volume' attribute. + * + *+ * If the meaning of the 'Volume' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #setVolume(double) + * @generated + */ + double getVolume(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute. + * + * + * @param value the new value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #getVolume() + * @generated + */ + void setVolume(double value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute. + * + * + * @see #isSetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + void unsetVolume(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute is set. + * + * + * @return whether the value of the 'Volume' attribute is set. + * @see #unsetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + boolean isSetVolume(); + + /** + * Returns the value of the 'Change1' attribute. + * + *+ * If the meaning of the 'Change1' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #setChange1(double) + * @generated + */ + double getChange1(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute. + * + * + * @param value the new value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #getChange1() + * @generated + */ + void setChange1(double value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute. + * + * + * @see #isSetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + void unsetChange1(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute is set. + * + * + * @return whether the value of the 'Change1' attribute is set. + * @see #unsetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + boolean isSetChange1(); + + /** + * Returns the value of the 'Quotes' containment reference list. + * The list contents are of type {@link com.example.simple.Quote}. + * + *+ * If the meaning of the 'Quotes' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Quotes' containment reference list. + * @generated + */ + List getQuotes(); + +} // Quote diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/SimpleFactory.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/SimpleFactory.java new file mode 100644 index 0000000000..98dc01d69a --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/SimpleFactory.java @@ -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 com.example.simple; + +import commonj.sdo.helper.HelperContext; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface SimpleFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SimpleFactory INSTANCE = com.example.simple.impl.SimpleFactoryImpl.init(); + + /** + * Returns a new object of class 'Quote'. + * + * + * @return a new object of class 'Quote'. + * @generated + */ + Quote createQuote(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //SimpleFactory diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/impl/QuoteImpl.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/impl/QuoteImpl.java new file mode 100644 index 0000000000..39af3bbdb2 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/simple/impl/QuoteImpl.java @@ -0,0 +1,1045 @@ +/** + * + * 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 com.example.simple.impl; + +import com.example.simple.Quote; +import com.example.simple.SimpleFactory; + +import commonj.sdo.Type; + +import java.math.BigDecimal; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Quote'. + * + *+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Name' attribute. + * + *+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Name' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link com.example.test.Containment.ContainmentTest#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #isSetName() + * @see #unsetName() + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Unsets the value of the '{@link com.example.test.Containment.ContainmentTest#getName Name}' attribute. + * + * + * @see #isSetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + void unsetName(); + + /** + * Returns whether the value of the '{@link com.example.test.Containment.ContainmentTest#getName Name}' attribute is set. + * + * + * @return whether the value of the 'Name' attribute is set. + * @see #unsetName() + * @see #getName() + * @see #setName(String) + * @generated + */ + boolean isSetName(); + + /** + * Returns the value of the 'Contain' containment reference. + * + *+ * If the meaning of the 'Contain' containment reference isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Contain' containment reference. + * @see #isSetContain() + * @see #unsetContain() + * @see #setContain(ContainmentTest) + * @generated + */ + ContainmentTest getContain(); + + /** + * Sets the value of the '{@link com.example.test.Containment.ContainmentTest#getContain Contain}' containment reference. + * + * + * @param value the new value of the 'Contain' containment reference. + * @see #isSetContain() + * @see #unsetContain() + * @see #getContain() + * @generated + */ + void setContain(ContainmentTest value); + + /** + * Unsets the value of the '{@link com.example.test.Containment.ContainmentTest#getContain Contain}' containment reference. + * + * + * @see #isSetContain() + * @see #getContain() + * @see #setContain(ContainmentTest) + * @generated + */ + void unsetContain(); + + /** + * Returns whether the value of the '{@link com.example.test.Containment.ContainmentTest#getContain Contain}' containment reference is set. + * + * + * @return whether the value of the 'Contain' containment reference is set. + * @see #unsetContain() + * @see #getContain() + * @see #setContain(ContainmentTest) + * @generated + */ + boolean isSetContain(); + + /** + * Returns the value of the 'Contain Many' containment reference list. + * The list contents are of type {@link com.example.test.Containment.ContainmentTest}. + * + *+ * If the meaning of the 'Contain Many' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Contain Many' containment reference list. + * @generated + */ + List getContainMany(); + +} // ContainmentTest diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentFactoryImpl.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentFactoryImpl.java new file mode 100644 index 0000000000..9f51d02590 --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentFactoryImpl.java @@ -0,0 +1,270 @@ +/** + * + * 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 com.example.test.Containment.impl; + +import commonj.sdo.helper.HelperContext; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; + +import com.example.test.Containment.*; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.SDOFactory; + +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.internal.InternalFactory; + +import org.apache.tuscany.sdo.util.SDOUtil; + +/** + * + * An implementation of the model Factory. + * Generator information: + * patternVersion=1.2; -prefix Containment + * + * @generated + */ +public class ContainmentFactoryImpl extends FactoryBase implements ContainmentFactory +{ + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String NAMESPACE_URI = "http://www.example.com/ContainmentTest"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String NAMESPACE_PREFIX = "contain"; + + /** + * The version of the generator pattern used to generate this class. + * + * + * @generated + */ + public static final String PATTERN_VERSION = "1.2"; + + public static final int CONTAINMENT_TEST = 1; + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public ContainmentFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.test.Containment"); + } + + /** + * 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. + * + * + * @generated + */ + public void register(HelperContext scope) { + if(scope == null) { + throw new IllegalArgumentException("Scope can not be null"); + } + TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper(); + th.getExtendedMetaData().putPackage(NAMESPACE_URI, this); + } + + /** + * + * + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + case CONTAINMENT_TEST: return (DataObject)createContainmentTest(); + default: + return super.create(typeNumber); + } + } + + /** + * + * + * @generated + */ + public ContainmentTest createContainmentTest() + { + ContainmentTestImpl containmentTest = new ContainmentTestImpl(); + return containmentTest; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type containmentTestType = null; + + public Type getContainmentTest() + { + return containmentTestType; + } + + + private static boolean isInited = false; + + public static ContainmentFactoryImpl init() + { + if (isInited) return (ContainmentFactoryImpl)FactoryBase.getStaticFactory(ContainmentFactoryImpl.NAMESPACE_URI); + ContainmentFactoryImpl theContainmentFactoryImpl = new ContainmentFactoryImpl(); + isInited = true; + + // Initialize dependencies + SDOUtil.registerStaticTypes(SDOFactory.class); + SDOUtil.registerStaticTypes(ModelFactory.class); + SDOUtil.registerStaticTypes(InternalFactory.class); + + // Create package meta-data objects + theContainmentFactoryImpl.createMetaData(); + + // Initialize created meta-data + theContainmentFactoryImpl.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //theContainmentFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ???? + + return theContainmentFactoryImpl; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + + // Create types and their properties + containmentTestType = createType(false, CONTAINMENT_TEST); + createProperty(true, containmentTestType,ContainmentTestImpl.INTERNAL_MIXED); + createProperty(true, containmentTestType,ContainmentTestImpl.INTERNAL_NAME); + createProperty(false, containmentTestType,ContainmentTestImpl.INTERNAL_CONTAIN); + createProperty(false, containmentTestType,ContainmentTestImpl.INTERNAL_CONTAIN_MANY); + } + + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI); + Property property = null; + + // Add supertypes to types + + // Initialize types and properties + initializeType(containmentTestType, ContainmentTest.class, "ContainmentTest", false); + property = getLocalProperty(containmentTestType, 0); + initializeProperty(property, getSequence(), "mixed", null, 0, -1, ContainmentTest.class, false, false, false); + + property = getLocalProperty(containmentTestType, 1); + initializeProperty(property, theModelPackageImpl.getString(), "Name", null, 1, 1, ContainmentTest.class, false, true, true); + + property = getLocalProperty(containmentTestType, 2); + initializeProperty(property, this.getContainmentTest(), "Contain", null, 1, 1, ContainmentTest.class, false, true, true, true , null); + + property = getLocalProperty(containmentTestType, 3); + initializeProperty(property, this.getContainmentTest(), "ContainMany", null, 0, -1, ContainmentTest.class, false, false, true, true , null); + + createXSDMetaData(theModelPackageImpl); + } + + protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl) + { + super.initXSD(); + + Property property = null; + + + addXSDMapping + (containmentTestType, + new String[] + { + "name", "ContainmentTest", + "kind", "mixed" + }); + + addXSDMapping + (getProperty(containmentTestType, ContainmentTestImpl.INTERNAL_MIXED), + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + + addXSDMapping + (getProperty(containmentTestType, ContainmentTestImpl.INTERNAL_NAME), + new String[] + { + "kind", "element", + "name", "Name" + }); + + addXSDMapping + (getProperty(containmentTestType, ContainmentTestImpl.INTERNAL_CONTAIN), + new String[] + { + "kind", "element", + "name", "Contain" + }); + + addXSDMapping + (getProperty(containmentTestType, ContainmentTestImpl.INTERNAL_CONTAIN_MANY), + new String[] + { + "kind", "element", + "name", "ContainMany" + }); + + property = createGlobalProperty + ("containTestInstance", + this.getContainmentTest(), + new String[] + { + "kind", "element", + "name", "containTestInstance", + "namespace", "##targetNamespace" + }); + + } + +} //ContainmentFactoryImpl diff --git a/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentTestImpl.java b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentTestImpl.java new file mode 100644 index 0000000000..14d4678d2d --- /dev/null +++ b/sdo-java/branches/emf-2.5/impl/src/test/java/com/example/test/Containment/impl/ContainmentTestImpl.java @@ -0,0 +1,409 @@ +/** + * + * 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 com.example.test.Containment.impl; + +import com.example.test.Containment.ContainmentFactory; +import com.example.test.Containment.ContainmentTest; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Test'. + * + *+ * The following features are implemented: + *
+The "org.apache.tuscany.sdo.api" package represents Tuscany API for SDO Java +above and beyond what is offered by the SDO API itself. The contents of this +project provide a means to achieve operations that are not currently addressed +by the SDO API. +
++The SDOUtil class simply provides a set of static convenince methods for +exercising the methods of a default instance of the SDOHelper interface. +
+ + diff --git a/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectInputStream.java b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectInputStream.java new file mode 100644 index 0000000000..606b4c8fc3 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectInputStream.java @@ -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.lib; + +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; + +import commonj.sdo.helper.HelperContext; + +/** + * This subclass of ObjectInputStream provides a place to store the scope in which + * it was created. + */ +public class SDOObjectInputStream extends ObjectInputStream { + + private HelperContext helperContext; + + public SDOObjectInputStream(InputStream in, HelperContext helperContext) throws IOException{ + super(in); + this.helperContext = helperContext; + } + + public HelperContext getHelperContext() { + return helperContext; + } + + public void setHelperContext(HelperContext helperContext) { + this.helperContext = helperContext; + } + +} diff --git a/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectOutputStream.java b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectOutputStream.java new file mode 100644 index 0000000000..05f2105b97 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/SDOObjectOutputStream.java @@ -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.lib; + +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; + +import commonj.sdo.helper.HelperContext; + +/** + * This subclass of ObjectOutputStream provides a place to store the scope in which + * it was created. + */ +public class SDOObjectOutputStream extends ObjectOutputStream { + + private HelperContext helperContext; + + public SDOObjectOutputStream(OutputStream os, HelperContext helperContext) throws IOException{ + super(os); + this.helperContext = helperContext; + } + + public HelperContext getHelperContext() { + return helperContext; + } + + public void setHelperContext(HelperContext helperContext) { + this.helperContext = helperContext; + } + +} diff --git a/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/UnknownPropertyList.java b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/UnknownPropertyList.java new file mode 100644 index 0000000000..95eabd4b82 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/lib/UnknownPropertyList.java @@ -0,0 +1,70 @@ +/** + * + * 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.lib; + +import java.util.AbstractList; +import java.util.Collections; +import java.util.List; + +import commonj.sdo.DataObject; + +public class UnknownPropertyList extends AbstractList { + protected List delegateList = Collections.EMPTY_LIST; + protected DataObject dataObject; + protected String path; + + public UnknownPropertyList(DataObject dataObject, String path) { + this.dataObject = dataObject; + this.path = path; + } + + public Object get(int index) { + return getDelegateList().get(index); + } + + public int size() { + return getDelegateList().size(); + } + + public Object remove(int index) { + return getDelegateList().remove(index); + } + public Object set(int index, Object element) { + return getDelegateList().set(index, element); + } + + public void add(int index, Object element) { + if (getDelegateList() == Collections.EMPTY_LIST && index == 0) { + dataObject.set(path, Collections.singletonList(element)); + delegateList = (List)dataObject.get(path); + } + else { + delegateList.add(index, element); + } + } + + protected List getDelegateList() { + if (delegateList == Collections.EMPTY_LIST) { + List propertyList = (List)dataObject.get(path); + if (propertyList != null) delegateList = propertyList; + } + return delegateList; + } +} diff --git a/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/HelperProviderBase.java b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/HelperProviderBase.java new file mode 100644 index 0000000000..375552497b --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/HelperProviderBase.java @@ -0,0 +1,246 @@ +/** + * + * 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.spi; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.NotSerializableException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.ObjectStreamException; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import org.apache.tuscany.sdo.api.SDOHelper; +import org.apache.tuscany.sdo.api.SDOUtil; +import org.apache.tuscany.sdo.api.XMLStreamHelper; +import org.apache.tuscany.sdo.lib.SDOObjectInputStream; +import org.apache.tuscany.sdo.lib.SDOObjectOutputStream; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +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.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import commonj.sdo.impl.HelperProvider; +import commonj.sdo.impl.ExternalizableDelegator.Resolvable; + + +/** + * Create and manage all the default helpers + */ +public abstract class HelperProviderBase extends HelperProvider +{ + protected CopyHelper copyHelper; + + protected DataFactory dataFactory; + + protected DataHelper dataHelper; + + protected EqualityHelper equalityHelper; + + protected TypeHelper typeHelper; + + protected XMLHelper xmlHelper; + + protected XSDHelper xsdHelper; + + protected SDOHelper sdoHelper; // Tuscany extension APIs + + protected XMLStreamHelper xmlStreamHelper; + /** + * Subclasses must implement this method to initialize the above Helper instance variables + */ + protected abstract HelperContext createDefaultHelpers(); + + public HelperProviderBase() + { + defaultContext = createDefaultHelpers(); + } + + public SDOHelper sdoHelper() + { + return sdoHelper; + } + + public CopyHelper copyHelper() + { + return copyHelper; + } + + public DataFactory dataFactory() + { + return dataFactory; + } + + public DataHelper dataHelper() + { + return dataHelper; + } + + public EqualityHelper equalityHelper() + { + return equalityHelper; + } + + public TypeHelper typeHelper() + { + return typeHelper; + } + + public XMLHelper xmlHelper() + { + return xmlHelper; + } + + public XMLStreamHelper xmlStreamHelper() + { + return xmlStreamHelper; + } + public XSDHelper xsdHelper() + { + return xsdHelper; + } + + public Resolvable resolvable() + { + return new ResolvableImpl(); + } + + public Resolvable resolvable(Object target) + { + return new ResolvableImpl(target); + } + + protected class ResolvableImpl implements Resolvable + { + protected Object target; + + public ResolvableImpl(Object target) { this.target = target; } + + public ResolvableImpl() { this.target = null; } + + public void writeExternal(ObjectOutput out) throws IOException + { + if (target instanceof DataObject) + { + writeDataObject((DataObject)target, out); + } + else + { + throw new NotSerializableException(); // should never happen + } + } + + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException + { + target = readDataObject(in); + } + + public Object readResolve() throws ObjectStreamException + { + return target; + } + + protected void writeDataObject(DataObject dataObject, ObjectOutput objectOutput) throws IOException + { + DataGraph dataGraph = dataObject.getDataGraph(); + if (dataGraph != null) + { + objectOutput.writeByte(0); + objectOutput.writeUTF(SDOUtil.getXPath(dataObject)); + objectOutput.writeObject(dataGraph); + } + else if (dataObject.getContainer() != null) + { + objectOutput.writeByte(0); + objectOutput.writeUTF(SDOUtil.getXPath(dataObject)); + objectOutput.writeObject(dataObject.getRootObject()); + } + else + { + // Root object + objectOutput.writeByte(1); + + ByteArrayOutputStream compressedByteArrayOutputStream = new ByteArrayOutputStream(); + GZIPOutputStream gzipOutputStream = new GZIPOutputStream(compressedByteArrayOutputStream); + XMLHelper xmlHelperLocal = xmlHelper; + if(objectOutput instanceof SDOObjectOutputStream) + { + xmlHelperLocal = ((SDOObjectOutputStream)objectOutput).getHelperContext().getXMLHelper(); + } + xmlHelperLocal.save(dataObject, "commonj.sdo", "dataObject", gzipOutputStream); + gzipOutputStream.close(); // Flush the contents + + byte[] byteArray = compressedByteArrayOutputStream.toByteArray(); + objectOutput.writeInt(byteArray.length); + objectOutput.write(byteArray); + } + } + + protected DataObject readDataObject(ObjectInput objectInput) throws IOException, ClassNotFoundException + { + boolean isRoot = objectInput.readByte() == 1; + if (isRoot) + { + // Root object: [rootXML] = length + XML contents + int length = objectInput.readInt(); + byte[] compressedBytes = new byte [length]; + + int index = 0; + int bytesRead; + while (index < length) { + if ((bytesRead = objectInput.read(compressedBytes, index, length-index)) == -1) { + break; + } + index += bytesRead; + } + + GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(compressedBytes)); + XMLHelper xmlHelperLocal = xmlHelper; + if (objectInput instanceof SDOObjectInputStream) + { + xmlHelperLocal = ((SDOObjectInputStream)objectInput).getHelperContext().getXMLHelper(); + } + XMLDocument doc = xmlHelperLocal.load(gzipInputStream); + gzipInputStream.close(); + + return doc.getRootObject(); + } + else + { + // Non root object: [path] [root] + String xpath = objectInput.readUTF(); + Object object = objectInput.readObject(); + + DataObject root = object instanceof DataGraph ? ((DataGraph)object).getRootObject() : (DataObject)object; + return xpath.equals("") ? root : root.getDataObject(xpath); + } + } + } + +} diff --git a/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/SDOHelperBase.java b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/SDOHelperBase.java new file mode 100644 index 0000000000..ce3678d81f --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/java/org/apache/tuscany/sdo/spi/SDOHelperBase.java @@ -0,0 +1,176 @@ +/** + * + * 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.spi; + +/** + * Base class for an implementation of the SDOHelper and SDOHelper.MetaDataBuilder interfaces. + */ +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.api.SDOHelper; +import org.apache.tuscany.sdo.api.SDOUtil; +import org.apache.tuscany.sdo.lib.SDOObjectInputStream; +import org.apache.tuscany.sdo.lib.SDOObjectOutputStream; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.helper.HelperContext; + +public abstract class SDOHelperBase implements SDOHelper, SDOHelper.MetaDataBuilder +{ + public HelperContext createHelperContext() + { + return createHelperContext(false); + } + + public ObjectInputStream createObjectInputStream(InputStream inputStream, HelperContext helperContext) throws IOException + { + return new SDOObjectInputStream(inputStream, helperContext); + } + + public ObjectOutputStream createObjectOutputStream(OutputStream outputStream, HelperContext helperContext) throws IOException + { + return new SDOObjectOutputStream(outputStream, helperContext); + } + + public String getXPath(DataObject dataObject) + { + StringBuffer path = getXPath(dataObject, new StringBuffer(), dataObject); + return path.toString(); + } + + protected StringBuffer getXPath(DataObject dataObject, StringBuffer path, DataObject root) + { + DataObject container = dataObject.getContainer(); + if (container == null) + return path; + + if (container == root) + throw new IllegalStateException("There is a cycle in the containment hierarchy of " + root); + + boolean first = path.length() == 0; + Property property = dataObject.getContainmentProperty(); + if (SDOUtil.isMany(property, dataObject)) + { + List list = container.getList(property); + int pos = list.indexOf(dataObject); + path.insert(0, property.getName() + "." + pos + (first ? "" : "/")); + } + else + { + path.insert(0, property.getName() + (first ? "" : "/")); + } + + return getXPath(container, path, root); + } + + public MetaDataBuilder getMetaDataBuilder() + { + return this; + } + + //Java instance class to SDO mappings (section 8.1 of the SDO spec) + protected static Map javaToSdoMappings = new HashMap(); + static { + javaToSdoMappings.put(boolean.class, "Boolean"); + javaToSdoMappings.put(byte.class, "Byte"); + javaToSdoMappings.put(char.class, "Character"); + javaToSdoMappings.put(Date.class, "Date"); + javaToSdoMappings.put(BigDecimal.class, "Decimal"); + javaToSdoMappings.put(double.class, "Double"); + javaToSdoMappings.put(float.class, "Float"); + javaToSdoMappings.put(int.class, "Int"); + javaToSdoMappings.put(BigInteger.class, "Integer"); + javaToSdoMappings.put(long.class, "Long"); + javaToSdoMappings.put(Object.class, "Object"); + javaToSdoMappings.put(short.class, "Short"); + javaToSdoMappings.put(String.class, "String"); + javaToSdoMappings.put(Boolean.class, "BooleanObject"); + javaToSdoMappings.put(Byte.class, "ByteObject"); + javaToSdoMappings.put(Character.class, "CharacterObject"); + javaToSdoMappings.put(Double.class, "DoubleObject"); + javaToSdoMappings.put(Float.class, "FloatObject"); + javaToSdoMappings.put(Integer.class, "IntObject"); + javaToSdoMappings.put(Long.class, "LongObject"); + javaToSdoMappings.put(Short.class, "ShortObject"); + } + + //XSD to SDO mappings (section 9.4 of the SDO spec) + protected static Map xsdToSdoMappings = new HashMap(); + static { + xsdToSdoMappings.put("anySimpleType", "Object"); + xsdToSdoMappings.put("anyType", "DataObject"); + xsdToSdoMappings.put("anyURI", "URI"); + xsdToSdoMappings.put("base64Binary", "Bytes"); + xsdToSdoMappings.put("boolean", "Boolean"); + xsdToSdoMappings.put("byte", "Byte"); + xsdToSdoMappings.put("date", "YearMonthDay"); + xsdToSdoMappings.put("dateTime", "DateTime"); + xsdToSdoMappings.put("decimal", "Decimal"); + xsdToSdoMappings.put("double", "Double"); + xsdToSdoMappings.put("duration", "Duration"); + xsdToSdoMappings.put("ENTITIES", "Strings"); + xsdToSdoMappings.put("ENTITY", "String"); + xsdToSdoMappings.put("float", "Float"); + xsdToSdoMappings.put("gDay", "Day"); + xsdToSdoMappings.put("gMonth", "Month"); + xsdToSdoMappings.put("gMonthDay", "MonthDay"); + xsdToSdoMappings.put("gYear", "Year"); + xsdToSdoMappings.put("gYearMonth", "YearMonth"); + xsdToSdoMappings.put("hexBinary", "Bytes"); + xsdToSdoMappings.put("ID","String"); + xsdToSdoMappings.put("IDREF","String"); + xsdToSdoMappings.put("IDREFS","Strings"); + xsdToSdoMappings.put("int","Int"); + xsdToSdoMappings.put("integer","Integer"); + xsdToSdoMappings.put("language","String"); + xsdToSdoMappings.put("long","Long"); + xsdToSdoMappings.put("Name","String"); + xsdToSdoMappings.put("NCName","String"); + xsdToSdoMappings.put("negativeInteger","Integer"); + xsdToSdoMappings.put("NMTOKEN","String"); + xsdToSdoMappings.put("NMTOKENS","Strings"); + xsdToSdoMappings.put("nonNegativeInteger","Integer"); + xsdToSdoMappings.put("nonPositiveInteger","Integer"); + xsdToSdoMappings.put("normalizedString","String"); + xsdToSdoMappings.put("NOTATION","String"); + xsdToSdoMappings.put("positiveInteger","Integer"); + xsdToSdoMappings.put("QName","URI"); + xsdToSdoMappings.put("short","Short"); + xsdToSdoMappings.put("string","String"); + xsdToSdoMappings.put("time","Time"); + xsdToSdoMappings.put("token","String"); + xsdToSdoMappings.put("unsignedByte","Short"); + xsdToSdoMappings.put("unsignedInt","Long"); + xsdToSdoMappings.put("unsignedLong","Integer"); + xsdToSdoMappings.put("unsignedShort","Int"); + } + +} diff --git a/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/DISCLAIMER b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/DISCLAIMER new file mode 100644 index 0000000000..a65af91c5a --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/DISCLAIMER @@ -0,0 +1,7 @@ +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. \ No newline at end of file diff --git a/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/LICENSE.txt b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..9a90d375bc --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,207 @@ + + 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. + + + + + diff --git a/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/MANIFEST.MF b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..64cd082dc8 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Extension-Name: tuscany-sdo-lib +Specification-Title: Tuscany SDO Implementation Library +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: tuscany-sdo-lib +Implementation-Version: 1.1-incubating +Bundle-ManifestVersion: 2 +Bundle-Name: Tuscany SDO Implementation Library +Bundle-SymbolicName: org.apache.tuscany.sdo.lib +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation +Require-Bundle: org.apache.tuscany.sdo.spec;visibility:=reexport +Export-Package: org.apache.tuscany.sdo.api, + org.apache.tuscany.sdo.spi, + org.apache.tuscany.sdo.lib +X-Compile-Source-JDK: 1.4 +X-Compile-Target-JDK: 1.4 diff --git a/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/NOTICE b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..3349bf7c89 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/NOTICE @@ -0,0 +1,8 @@ +Apache Tuscany +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Please see the LICENSE file present in the META-INF directory of this archive. + diff --git a/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/README.txt b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..a3c36b7705 --- /dev/null +++ b/sdo-java/branches/emf-2.5/lib/src/main/resources/META-INF/README.txt @@ -0,0 +1,23 @@ +Apache Tuscany 1.1-incubating build (February 2008) +=============================================== + +http://incubator.apache.org/tuscany/ + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sdo-java/branches/emf-2.5/plugin/pom.xml b/sdo-java/branches/emf-2.5/plugin/pom.xml new file mode 100644 index 0000000000..c58fd5ee09 --- /dev/null +++ b/sdo-java/branches/emf-2.5/plugin/pom.xml @@ -0,0 +1,106 @@ + + ++ * Each of the samples creates text output to the console. If the commentary + * level in {@link #constructorArgs the sample program constructor arguments} + * used to construct each sample is set to + * {@link SampleInfrastructure#COMMENTARY_FOR_NOVICE COMMENTARY_FOR_NOVICE} then there + * will be much more output than if set to one of the other values. + * + */ +public class ExecuteSamples extends SampleBase { + + /** + * Edit this value to cause the program to pause between each sample program + * and wait for the user to hit the enter key. + */ + private static final boolean pauseBetweenSamples = true; + + /** + * By default run all samples from novice level right up to advanced level. + * Edit this to run fewer samples. + */ + private static final int runSamplesUpToLevel = SampleInfrastructure.SAMPLE_LEVEL_ADVANCED.intValue(); + + /** + * Edit the value of this argument to one of COMMENTARY_FOR_NOVICE, COMMENTARY_FOR_INTERMEDIATE or COMMENTARY_FOR_ADVANCED to see + * more or less commentary. Note, this value only controls the level of commentary, + * not which samples are executed. Use it to filter out the noise if you have already + * understood the more basic commentary. + */ + private static final Object[] constructorArgs = { SampleInfrastructure.COMMENTARY_FOR_NOVICE }; + + + public static void main(String [] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException { + ExecuteSamples sample = new ExecuteSamples(COMMENTARY_FOR_NOVICE); + sample.run(); + } + + public ExecuteSamples(Integer userLevel) { + super(userLevel, SAMPLE_LEVEL_BASIC); + } + + public void runSample() throws Exception { + Class[] constructorArgTypes = { Integer.class }; + + + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + + int sampleCount = 0; + for (int i=0; i < SampleInfrastructure.sampleClasses.length; i++) { + Constructor c = SampleInfrastructure.sampleClasses[i].getConstructor(constructorArgTypes); + SampleBase sample = (SampleBase)c.newInstance(constructorArgs); + if(sample.getSampleComplexityLevel() <= runSamplesUpToLevel) { + sample.run(); + sampleCount++; + if(pauseBetweenSamples) { + System.out.println(">>>Press Enter to continue"); + in.readLine(); + } + } + } + System.out.println("Ran " + sampleCount + " samples"); + } +} diff --git a/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java new file mode 100644 index 0000000000..3b4aba2b42 --- /dev/null +++ b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java @@ -0,0 +1,192 @@ +/** + * + * 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.samples.sdo; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import org.apache.tuscany.samples.sdo.internal.SampleInfrastructure; +import org.apache.tuscany.sdo.api.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XSDHelper; +import commonj.sdo.impl.HelperProvider; + +/** + * the base function for samples is split into two classes. This one is intended + * to house all the interesting SDO utility methods, and the superclass houses + * all the infrastructure that the SDO user isn't interested in inspecting. + */ +public abstract class SampleBase extends SampleInfrastructure { + + + public SampleBase() + { + super(COMMENTARY_FOR_NOVICE); + } + + + public SampleBase(Integer commentaryLevel, Integer sampLevel) { + super(commentaryLevel, sampLevel); + } + + protected HelperContext createScopeForTypes() { + commentary( + COMMENTARY_FOR_NOVICE, + "All MetaData for SDO types can be viewed as being scoped within an instance of HelperContext\n" + + "The Helper Context instance provides access to a collection of other helpers\n" + + "that you will see exercised in the SDO samples\n" + + "All the Helpers related to a given helper context instance know about the same set of types\n\n" + + "The SDO specification doesn't state how an SDO implementation should create a HelperContext\n" + + "So we use a Tuscany specific API to do this ...\n\n" + + "HelperContext scope = SDOUtil.createHelperContext();", + + "Creating a new HelperContext scope for types for the next sample run as we did in previous samples" + ); + + HelperContext scope = SDOUtil.createHelperContext(); + return scope; + } + + protected HelperContext useDefaultScopeForTypes() { + commentary( + COMMENTARY_FOR_NOVICE, + "All MetaData for SDO types can be viewed as being held in an instance of HelperContext\n" + + "The Helper Context instance provides access to a collection of other helpers\n" + + "that you will see exercised in the SDO samples\n" + + "All the Helpers related to a given helper context instance know about the same set of types\n\n" + + "For most cases it's best to take control of the type scope by creating a new HelperContext,\n" + + "but a default helper context is provided and can be accessed using ...\n\n" + + "HelperContext scope = HelperProvider.getDefaultContext();\n\n" + + "A case in point where the default scope must be used is when using some of the DataGraph APIs\n" + + "which don't all support the type scoping extensions which were introduced in the SDO 2.1 specification", + + "Retrieving the default HelperContext scope for types for the next sample run as we saw in a previous sample" + ); + + HelperContext scope = HelperProvider.getDefaultContext(); + return scope; + } + + + protected void loadTypesFromXMLSchemaFile(HelperContext scope, String fileName) { + commentary(COMMENTARY_FOR_NOVICE, + "If you want to create types dynamically by loading an XML schema you\n" + + "use an instance of XSDHelper. You get that helper from a HelperContext.\n" + + "After successful loading of a schema, the new types are available to every\n" + + "other helper belonging to the HelperContext instance\n\n" + + "XSDHelper xsdHelper = scope.getXSDHelper();\n"+ + "xsdHelper.define(inputStream, null);", + + "Using an XSDHelper again to create types from an XML schema file as we saw in a previous sample" + ); + + XSDHelper xsdHelper = scope.getXSDHelper(); + + InputStream is = null; + try { + + URL url = getClass().getResource("/"+fileName); + is = url.openStream(); + xsdHelper.define(is, url.toString()); + + } catch (Exception e) { + somethingUnexpectedHasHappened(e); + } finally { + try { + is.close(); + } catch (Exception e) { + somethingUnexpectedHasHappened(e); + } + } + } + + public DataObject getDataObjectFromFile(HelperContext scope, String filename) + throws Exception { + + + XMLDocument xmlDoc = getXMLDocumentFromFile(scope, filename); + commentary(COMMENTARY_FOR_NOVICE, + "An XMLDocument instance provides a wrapper for the root DataObject of a data graph\n" + + "along with other aspects of the XML nature of the document\n\n"+ + "DataObject result = xmlDoc.getRootObject();", + + "Getting the root object from an XMLDocument as seen in previous samples" + ); + DataObject result = xmlDoc.getRootObject(); + + return result; + } + + public XMLDocument getXMLDocumentFromFile(HelperContext scope, + String filename) throws Exception { + + XMLDocument result = null; + InputStream is = null; + + try { + commentary(COMMENTARY_FOR_NOVICE, + "The XMLHelper can be used to create an SDO XMLDocument instance from a file\n\n"+ + "inputStream = ClassLoader.getSystemResourceAsStream(filename);\n"+ + "result = scope.getXMLHelper().load(is);", + + "Getting an XMLDocument instance from an XML file as seen in previous samples" + ); + is = ClassLoader.getSystemResourceAsStream(filename); + result = scope.getXMLHelper().load(is); + + } catch (Exception e) { + somethingUnexpectedHasHappened(e); + } finally { + try { + is.close(); + } catch (Exception e) { + somethingUnexpectedHasHappened(e); + } + } + + return result; + } + + protected XMLDocument getXMLDocumentFromString(HelperContext scope, String xmlDoc) throws IOException { + XMLDocument result = null; + InputStream is = null; + + + commentary(COMMENTARY_FOR_NOVICE, + "The XMLHelper can be used to create an SDO XMLDocument instance from an\n\n"+ + "inputStream = new ByteArrayInputStream(xmlDoc.getBytes());\n"+ + "result = scope.getXMLHelper().load(is);", + + "Getting an XMLDocument instance from an XML file as seen in previous samples" + ); + + is = new ByteArrayInputStream(xmlDoc.getBytes()); + result = scope.getXMLHelper().load(is); + + return result; + } + +} diff --git a/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java new file mode 100644 index 0000000000..916fe9405c --- /dev/null +++ b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java @@ -0,0 +1,424 @@ +/** + * 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.samples.sdo.advanced; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.samples.sdo.SampleBase; +import org.apache.tuscany.sdo.api.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; + +/** + * This sample is based on a 2 part article by Kelvin Goodson and Geoffrey Winn. + * See Part1 and Part 2 of the article. + *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * It builds indexes from + * sample to function and from function to sample and creates + * html output that displays these indexes. + */ +public class DocumentSamples { + + private Map classToCoreFunction = new HashMap(); + private Map coreFunctionToClass = new HashMap(); + private Map classToSignificantFunction = new HashMap(); + private Map significantFunctionToClass = new HashMap(); + + public static void main(String[] args) throws SecurityException, + NoSuchMethodException, IllegalArgumentException, InstantiationException, + IllegalAccessException, InvocationTargetException, IOException { + + DocumentSamples ds = new DocumentSamples(); + ds.run(); + + } + + private static String HTML_HEADER = + "\n" + + "\n" + + " \n"+ + " \n"+ + "
\n" + + "The samples provided in the Tuscany SDO distribution cover many areas of\n" + + "the SDO API. Here we provide two indexes into the samples. The first lists\n" + + "each sample in sequence and details the central theme(s) of the sample.\n" + + "It also mentions if the sample significantly demonstrates other areas in passing.\n" + + "The second index lists all the themes that are covered by these samples, and\n" + + "indicates which of the samples has that subject area as a central theme or as\n" + + "demonstrates the subject area significant as an incidental part of the sample."; + + private static String CLASSES_HEADING = + "
+These samples are coded to the SDO 2.1 API defined +here +
++These samples provide a place to begin learning and experimenting with the SDO +API and programming model. Developers are encouraged to extend and experiment +with the current set of samples. If a sample is unclear, is missing +documentation, or does not cover a desired area, please send feedback to the +Tuscany mailing lists, or better still send us a patch or join the Tuscany team +and contribute back to the project. +
+The +SDO samples have been written to be useful in learning SDO, even without +reference to the sample source code. The samples output commentary as they +execute and key lines of source code are output too. One of the sample programs +(ExecuteSamples) executes all the other samples in sequence. The binary +distribution includes the sample source code too, so that you can investigate +further if you wish. +
++The binary distribution of Tuscany contains a pair of scripts to execute the +ExecuteSamples program (runsamples.bat and runsamples.sh). To execute the +samples first locate the appropriate script for your environment in the samples +directory of the binary distribution and set the value of the BINARY_BASE +variable to be the directory in your file system that contains the lib and +samples directories. Then run the script and take a look at the output. After +that, copy and modify the script to suit your own purposes in running the other +samples. +
++The +samples depend on the following libraries +
++If you are running these samples as a result of building Tuscany SDO for Java +from a Tuscany source distribution using maven then these dependencies will be +resolved by having followed the instructions in the BUILDING file at the root of +the source distribution. +
+ + diff --git a/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/package.html b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/package.html new file mode 100644 index 0000000000..c1335e6e5b --- /dev/null +++ b/sdo-java/branches/emf-2.5/sample/src/main/java/org/apache/tuscany/samples/sdo/package.html @@ -0,0 +1,33 @@ + + + ++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.
true
) or off (false
).
+ * @return true
if change logging is on.
+ * @see #beginLogging
+ * @see #endLogging
+ */
+ boolean isLogging();
+
+ /**
+ * Returns the {@link DataGraph data graph} associated with this change summary or null.
+ * @return the data graph.
+ * @see DataGraph#getChangeSummary
+ */
+ DataGraph getDataGraph();
+
+ /**
+ * Returns a list consisting of all the {@link DataObject data objects} that have been changed while {@link #isLogging logging}.
+ * + * The {@link #isCreated new} and {@link #isModified modified} objects in the List are references to objects + * associated with this ChangeSummary. + * The {@link #isDeleted deleted} objects in the List are references to objects + * at the time that event logging was enabled; + *
Each changed object must have exactly one of the following methods return true:
+ * {@link #isCreated isCreated},
+ * {@link #isDeleted isDeleted}, or
+ * {@link #isModified isModified}.
+ * @return a list of changed data objects.
+ * @see #isCreated(DataObject)
+ * @see #isDeleted(DataObject)
+ * @see #isModified(DataObject)
+ */
+ List /*DataObject*/ getChangedDataObjects();
+
+ /**
+ * Returns whether or not the specified data object was created while {@link #isLogging logging}.
+ * Any object that was added to the scope
+ * but was not in the scope when logging began,
+ * will be considered created.
+ * @param dataObject the data object in question.
+ * @return true
if the specified data object was created.
+ * @see #getChangedDataObjects
+ */
+ boolean isCreated(DataObject dataObject);
+
+ /**
+ * Returns whether or not the specified data object was deleted while {@link #isLogging logging}.
+ * Any object that is not in scope but was in scope when logging began
+ * will be considered deleted.
+ * @param dataObject the data object in question.
+ * @return true
if the specified data object was deleted.
+ * @see #getChangedDataObjects
+ */
+ boolean isDeleted(DataObject dataObject);
+
+ /**
+ * A setting encapsulates a {@link Property property} and a corresponding single value of the property's {@link Property#getType type}.
+ */
+ public interface Setting
+ {
+ /**
+ * Returns the property of the setting.
+ * @return the setting property.
+ */
+ Property getProperty();
+
+ /**
+ * Returns the value of the setting.
+ * @return the setting value.
+ */
+ Object getValue();
+
+ /**
+ * Returns whether or not the property is set.
+ * @return true
if the property is set.
+ */
+ boolean isSet();
+ }
+
+ /**
+ * Returns a list of {@link ChangeSummary.Setting settings}
+ * that represent the property values of the given dataObject
+ * at the point when logging {@link #beginLogging() began}.
+ *
In the case of a {@link #isDeleted(DataObject) deleted} object, + * the List will include settings for all the Properties. + *
An old value setting indicates the value at the + * point logging begins. A setting is only produced for + * {@link #isModified modified} objects if + * either the old value differs from the current value or + * if the isSet differs from the current value. + *
No settings are produced for {@link #isCreated created} objects. + * @param dataObject the object in question. + * @return a list of settings. + * @see #getChangedDataObjects + */ + List /*ChangeSummary.Setting*/ getOldValues(DataObject dataObject); + + /** + * Clears the List of {@link #getChangedDataObjects changes} and turns change logging on. + * No operation occurs if logging is already on. + * @see #endLogging + * @see #isLogging + */ + void beginLogging(); + + /** + * An implementation that requires logging may throw an UnsupportedOperationException. + * Turns change logging off. No operation occurs if logging is already off. + * @see #beginLogging + * @see #isLogging + */ + void endLogging(); + + + /** + * Returns whether or not the specified data object was updated while {@link #isLogging logging}. + * An object that was contained in the scope when logging began + * and remains in the scope when logging ends will be considered potentially modified. + *
An object considered modified must have at least one old value setting.
+ * @param dataObject the data object in question.
+ * @return true
if the specified data object was modified.
+ * @see #getChangedDataObjects
+ */
+ boolean isModified(DataObject dataObject);
+
+ /**
+ * Returns the ChangeSummary root DataObject - the object from which
+ * changes are tracked.
+ * When a DataGraph is used, this is the same as getDataGraph().getRootObject().
+ * @return the ChangeSummary root DataObject
+ */
+ DataObject getRootObject();
+
+ /**
+ * Returns a {@link ChangeSummary.Setting setting} for the specified property
+ * representing the property value of the given dataObject
+ * at the point when logging {@link #beginLogging() began}.
+ *
Returns null if the property was not modified and
+ * has not been {@link #isDeleted(DataObject) deleted}.
+ * @param dataObject the object in question.
+ * @param property the property of the object.
+ * @return the Setting for the specified property.
+ * @see #getChangedDataObjects
+ */
+ Setting getOldValue(DataObject dataObject, Property property);
+
+ /**
+ * Returns the value of the {@link DataObject#getContainer container} data object
+ * at the point when logging {@link #beginLogging() began}.
+ * @param dataObject the object in question.
+ * @return the old container data object.
+ */
+ DataObject getOldContainer(DataObject dataObject);
+
+ /**
+ * Returns the value of the {@link DataObject#getContainmentProperty containment property} data object property
+ * at the point when logging {@link #beginLogging() began}.
+ * @param dataObject the object in question.
+ * @return the old containment property.
+ */
+ Property getOldContainmentProperty(DataObject dataObject);
+
+ /**
+ * Returns the value of the {@link DataObject#getSequence sequence} for the data object
+ * at the point when logging {@link #beginLogging() began}.
+ * @param dataObject the object in question.
+ * @return the old containment property.
+ */
+ Sequence getOldSequence(DataObject dataObject);
+
+ /**
+ * This method is intended for use by service implementations only.
+ * Undoes all changes in the log to restore the tree of
+ * DataObjects to its original state when logging began.
+ * isLogging() is unchanged. The log is cleared.
+ * @see #beginLogging
+ * @see #endLogging
+ * @see #isLogging
+ */
+ void undoChanges();
+
+}
diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/DataGraph.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/DataGraph.java
new file mode 100644
index 0000000000..f583cbf0a3
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/DataGraph.java
@@ -0,0 +1,76 @@
+/**
+ *
+ * Each data object holds its data as a series of {@link Property Properties}. + * Properties can be accessed by name, property index, or using the property meta object itself. + * A data object can also contain references to other data objects, through reference-type Properties. + *
+ * A data object has a series of convenience accessors for its Properties. + * These methods either use a path (String), + * a property index, + * or the {@link Property property's meta object} itself, to identify the property. + * Some examples of the path-based accessors are as follows: + *
+ * DataObject company = ...; + * company.get("name"); is the same as company.get(company.getType().getProperty("name")) + * company.set("name", "acme"); + * company.get("department.0/name") is the same as ((DataObject)((List)company.get("department")).get(0)).get("name") + * .n indexes from 0 ... implies the name property of the first department + * company.get("department[1]/name") [] indexes from 1 ... implies the name property of the first department + * company.get("department[number=123]") returns the first department where number=123 + * company.get("..") returns the containing data object + * company.get("/") returns the root containing data object + *+ *
There are general accessors for Properties, i.e., {@link #get(Property) get} and {@link #set(Property, Object) set},
+ * as well as specific accessors for the primitive types and commonly used data types like
+ * String, Date, List, BigInteger, and BigDecimal.
+ */
+public interface DataObject extends Serializable
+{
+ /**
+ * Returns the value of a property of either this object or an object reachable from it, as identified by the
+ * specified path.
+ * @param path the path to a valid object and property.
+ * @return the value of the specified property.
+ * @see #get(Property)
+ */
+ Object get(String path);
+
+ /**
+ * Sets a property of either this object or an object reachable from it, as identified by the specified path,
+ * to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void set(String path, Object value);
+
+ /**
+ * Returns whether a property of either this object or an object reachable from it, as identified by the specified path,
+ * is considered to be set.
+ * @param path the path to a valid object and property.
+ * @see #isSet(Property)
+ */
+ boolean isSet(String path);
+
+ /**
+ * Unsets a property of either this object or an object reachable from it, as identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @see #unset(Property)
+ */
+ void unset(String path);
+
+ /**
+ * Returns the value of a boolean
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the boolean
value of the specified property.
+ * @see #get(String)
+ */
+ boolean getBoolean(String path);
+
+ /**
+ * Returns the value of a byte
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the byte
value of the specified property.
+ * @see #get(String)
+ */
+ byte getByte(String path);
+
+ /**
+ * Returns the value of a char
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the char
value of the specified property.
+ * @see #get(String)
+ */
+ char getChar(String path);
+
+ /**
+ * Returns the value of a double
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the double
value of the specified property.
+ * @see #get(String)
+ */
+ double getDouble(String path);
+
+ /**
+ * Returns the value of a float
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the float
value of the specified property.
+ * @see #get(String)
+ */
+ float getFloat(String path);
+
+ /**
+ * Returns the value of a int
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the int
value of the specified property.
+ * @see #get(String)
+ */
+ int getInt(String path);
+
+ /**
+ * Returns the value of a long
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the long
value of the specified property.
+ * @see #get(String)
+ */
+ long getLong(String path);
+
+ /**
+ * Returns the value of a short
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the short
value of the specified property.
+ * @see #get(String)
+ */
+ short getShort(String path);
+
+ /**
+ * Returns the value of a byte[]
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the byte[]
value of the specified property.
+ * @see #get(String)
+ */
+ byte[] getBytes(String path);
+
+ /**
+ * Returns the value of a BigDecimal
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the BigDecimal
value of the specified property.
+ * @see #get(String)
+ */
+ BigDecimal getBigDecimal(String path);
+
+ /**
+ * Returns the value of a BigInteger
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the BigInteger
value of the specified property.
+ * @see #get(String)
+ */
+ BigInteger getBigInteger(String path);
+
+ /**
+ * Returns the value of a DataObject
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the DataObject
value of the specified property.
+ * @see #get(String)
+ */
+ DataObject getDataObject(String path);
+
+ /**
+ * Returns the value of a Date
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the Date
value of the specified property.
+ * @see #get(String)
+ */
+ Date getDate(String path);
+
+ /**
+ * Returns the value of a String
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the String
value of the specified property.
+ * @see #get(String)
+ */
+ String getString(String path);
+
+ /**
+ * Returns the value of a List
property identified by the specified path.
+ * @param path the path to a valid object and property.
+ * @return the List
value of the specified property.
+ * @see #get(String)
+ */
+ List getList(String path);
+
+ /**
+ * @see #getSequence()
+ * Returns the value of a Sequence
property identified by the specified path.
+ * An implementation may throw an UnsupportedOperationException.
+ * @param path the path to a valid object and property.
+ * @return the Sequence
value of the specified property.
+ * @see #get(String)
+ * @deprecated in 2.1.0.
+ */
+ Sequence getSequence(String path);
+
+ /**
+ * Sets the value of a boolean
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setBoolean(String path, boolean value);
+
+ /**
+ * Sets the value of a byte
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setByte(String path, byte value);
+
+ /**
+ * Sets the value of a char
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setChar(String path, char value);
+
+ /**
+ * Sets the value of a double
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setDouble(String path, double value);
+
+ /**
+ * Sets the value of a float
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setFloat(String path, float value);
+
+ /**
+ * Sets the value of a int
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setInt(String path, int value);
+
+ /**
+ * Sets the value of a long
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setLong(String path, long value);
+
+ /**
+ * Sets the value of a short
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setShort(String path, short value);
+
+ /**
+ * Sets the value of a byte[]
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setBytes(String path, byte[] value);
+
+ /**
+ * Sets the value of a BigDecimal
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setBigDecimal(String path, BigDecimal value);
+
+ /**
+ * Sets the value of a BigInteger
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setBigInteger(String path, BigInteger value);
+
+ /**
+ * Sets the value of a DataObject
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setDataObject(String path, DataObject value);
+
+ /**
+ * Sets the value of a Date
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setDate(String path, Date value);
+
+ /**
+ * Sets the value of a String
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ */
+ void setString(String path, String value);
+
+ /**
+ * Sets the value of a List
property identified by the specified path, to the specified value.
+ * @param path the path to a valid object and property.
+ * @param value the new value for the property.
+ * @see #set(String, Object)
+ * @see #setList(Property, List)
+ */
+ void setList(String path, List value);
+
+ /**
+ * Returns the value of the property at the specified index in {@link Type#getProperties property list}
+ * of this object's {@link Type type}.
+ * @param propertyIndex the index of the property.
+ * @return the value of the specified property.
+ * @see #get(Property)
+ */
+ Object get(int propertyIndex);
+
+ /**
+ * Sets the property at the specified index in {@link Type#getProperties property list} of this object's
+ * {@link Type type}, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void set(int propertyIndex, Object value);
+
+ /**
+ * Returns whether the the property at the specified index in {@link Type#getProperties property list} of this object's
+ * {@link Type type}, is considered to be set.
+ * @param propertyIndex the index of the property.
+ * @return whether the specified property is set.
+ * @see #isSet(Property)
+ */
+ boolean isSet(int propertyIndex);
+
+ /**
+ * Unsets the property at the specified index in {@link Type#getProperties property list} of this object's {@link Type type}.
+ * @param propertyIndex the index of the property.
+ * @see #unset(Property)
+ */
+ void unset(int propertyIndex);
+
+ /**
+ * Returns the value of a boolean
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the boolean
value of the specified property.
+ * @see #get(int)
+ */
+ boolean getBoolean(int propertyIndex);
+
+ /**
+ * Returns the value of a byte
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the byte
value of the specified property.
+ * @see #get(int)
+ */
+ byte getByte(int propertyIndex);
+
+ /**
+ * Returns the value of a char
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the char
value of the specified property.
+ * @see #get(int)
+ */
+ char getChar(int propertyIndex);
+
+ /**
+ * Returns the value of a double
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the double
value of the specified property.
+ * @see #get(int)
+ */
+ double getDouble(int propertyIndex);
+
+ /**
+ * Returns the value of a float
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the float
value of the specified property.
+ * @see #get(int)
+ */
+ float getFloat(int propertyIndex);
+
+ /**
+ * Returns the value of a int
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the int
value of the specified property.
+ * @see #get(int)
+ */
+ int getInt(int propertyIndex);
+
+ /**
+ * Returns the value of a long
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the long
value of the specified property.
+ * @see #get(int)
+ */
+ long getLong(int propertyIndex);
+
+ /**
+ * Returns the value of a short
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the short
value of the specified property.
+ * @see #get(int)
+ */
+ short getShort(int propertyIndex);
+
+ /**
+ * Returns the value of a byte[]
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the byte[]
value of the specified property.
+ * @see #get(int)
+ */
+ byte[] getBytes(int propertyIndex);
+
+ /**
+ * Returns the value of a BigDecimal
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the BigDecimal
value of the specified property.
+ * @see #get(int)
+ */
+ BigDecimal getBigDecimal(int propertyIndex);
+
+ /**
+ * Returns the value of a BigInteger
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the BigInteger
value of the specified property.
+ * @see #get(int)
+ */
+ BigInteger getBigInteger(int propertyIndex);
+
+ /**
+ * Returns the value of a DataObject
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the DataObject
value of the specified property.
+ * @see #get(int)
+ */
+ DataObject getDataObject(int propertyIndex);
+
+ /**
+ * Returns the value of a Date
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the Date
value of the specified property.
+ * @see #get(int)
+ */
+ Date getDate(int propertyIndex);
+
+ /**
+ * Returns the value of a String
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the String
value of the specified property.
+ * @see #get(int)
+ */
+ String getString(int propertyIndex);
+
+ /**
+ * Returns the value of a List
property identified by the specified property index.
+ * @param propertyIndex the index of the property.
+ * @return the List
value of the specified property.
+ * @see #get(int)
+ */
+ List getList(int propertyIndex);
+
+ /**
+ * @see #getSequence()
+ * Returns the value of a Sequence
property identified by the specified property index.
+ * An implementation may throw an UnsupportedOperationException.
+ * @param propertyIndex the index of the property.
+ * @return the Sequence
value of the specified property.
+ * @see #get(int)
+ * @deprecated in 2.1.0.
+ */
+ Sequence getSequence(int propertyIndex);
+
+ /**
+ * Sets the value of a boolean
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setBoolean(int propertyIndex, boolean value);
+
+ /**
+ * Sets the value of a byte
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setByte(int propertyIndex, byte value);
+
+ /**
+ * Sets the value of a char
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setChar(int propertyIndex, char value);
+
+ /**
+ * Sets the value of a double
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setDouble(int propertyIndex, double value);
+
+ /**
+ * Sets the value of a float
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setFloat(int propertyIndex, float value);
+
+ /**
+ * Sets the value of a int
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setInt(int propertyIndex, int value);
+
+ /**
+ * Sets the value of a long
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setLong(int propertyIndex, long value);
+
+ /**
+ * Sets the value of a short
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setShort(int propertyIndex, short value);
+
+ /**
+ * Sets the value of a byte[]
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setBytes(int propertyIndex, byte[] value);
+
+ /**
+ * Sets the value of a BigDecimal
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setBigDecimal(int propertyIndex, BigDecimal value);
+
+ /**
+ * Sets the value of a BigInteger
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setBigInteger(int propertyIndex, BigInteger value);
+
+ /**
+ * Sets the value of a DataObject
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setDataObject(int propertyIndex, DataObject value);
+
+ /**
+ * Sets the value of a Date
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setDate(int propertyIndex, Date value);
+
+ /**
+ * Sets the value of a String
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ */
+ void setString(int propertyIndex, String value);
+
+ /**
+ * Sets the value of a List
property identified by the specified property index, to the specified value.
+ * @param propertyIndex the index of the property.
+ * @param value the new value for the property.
+ * @see #set(int, Object)
+ * @see #setList(Property, List)
+ */
+ void setList(int propertyIndex, List value);
+
+ /**
+ * Returns the value of the given property of this object.
+ *
+ * If the property is {@link Property#isMany many-valued}, + * the result will be a {@link java.util.List} + * and each object in the List will be {@link Type#isInstance an instance of} + * the property's {@link Property#getType type}. + * Otherwise the result will directly be an instance of the property's type. + * @param property the property of the value to fetch. + * @return the value of the given property of the object. + * @see #set(Property, Object) + * @see #unset(Property) + * @see #isSet(Property) + */ + Object get(Property property); + + /** + * Sets the value of the given property of the object to the new value. + *
+ * If the property is {@link Property#isMany many-valued}, + * the new value must be a {@link java.util.List} + * and each object in that list must be {@link Type#isInstance an instance of} + * the property's {@link Property#getType type}; + * the existing contents are cleared and the contents of the new value are added. + * Otherwise the new value directly must be an instance of the property's type + * and it becomes the new value of the property of the object. + * @param property the property of the value to set. + * @param value the new value for the property. + * @see #unset(Property) + * @see #isSet(Property) + * @see #get(Property) + */ + void set(Property property, Object value); + + /** + * Returns whether the property of the object is considered to be set. + *
+ * isSet() for many-valued Properties returns true if the List is not empty and + * false if the List is empty. For single-valued Properties it returns true if the Property + * has been set() and not unset(), and false otherwise. + * Any call to set() without a call to unset() will cause isSet() to return true, regardless of + * the value being set. For example, after calling set(property, property.getDefault()) on a + * previously unset property, isSet(property) will return true, even though the value of + * get(property) will be unchanged. + * @param property the property in question. + * @return whether the property of the object is set. + * @see #set(Property, Object) + * @see #unset(Property) + * @see #get(Property) + */ + boolean isSet(Property property); + + /** + * Unsets the property of the object. + *
+ * If the property is {@link Property#isMany many-valued},
+ * the value must be an {@link java.util.List}
+ * and that list is cleared.
+ * Otherwise,
+ * the value of the property of the object
+ * is set to the property's {@link Property#getDefault default value}.
+ * The property will no longer be considered {@link #isSet set}.
+ * @param property the property in question.
+ * @see #isSet(Property)
+ * @see #set(Property, Object)
+ * @see #get(Property)
+ */
+ void unset(Property property);
+
+ /**
+ * Returns the value of the specified boolean
property.
+ * @param property the property to get.
+ * @return the boolean
value of the specified property.
+ * @see #get(Property)
+ */
+ boolean getBoolean(Property property);
+
+ /**
+ * Returns the value of the specified byte
property.
+ * @param property the property to get.
+ * @return the byte
value of the specified property.
+ * @see #get(Property)
+ */
+ byte getByte(Property property);
+
+ /**
+ * Returns the value of the specified char
property.
+ * @param property the property to get.
+ * @return the char
value of the specified property.
+ * @see #get(Property)
+ */
+ char getChar(Property property);
+
+ /**
+ * Returns the value of the specified double
property.
+ * @param property the property to get.
+ * @return the double
value of the specified property.
+ * @see #get(Property)
+ */
+ double getDouble(Property property);
+
+ /**
+ * Returns the value of the specified float
property.
+ * @param property the property to get.
+ * @return the float
value of the specified property.
+ * @see #get(Property)
+ */
+ float getFloat(Property property);
+
+ /**
+ * Returns the value of the specified int
property.
+ * @param property the property to get.
+ * @return the int
value of the specified property.
+ * @see #get(Property)
+ */
+ int getInt(Property property);
+
+ /**
+ * Returns the value of the specified long
property.
+ * @param property the property to get.
+ * @return the long
value of the specified property.
+ * @see #get(Property)
+ */
+ long getLong(Property property);
+
+ /**
+ * Returns the value of the specified short
property.
+ * @param property the property to get.
+ * @return the short
value of the specified property.
+ * @see #get(Property)
+ */
+ short getShort(Property property);
+
+ /**
+ * Returns the value of the specified byte[]
property.
+ * @param property the property to get.
+ * @return the byte[]
value of the specified property.
+ * @see #get(Property)
+ */
+ byte[] getBytes(Property property);
+
+ /**
+ * Returns the value of the specified BigDecimal
property.
+ * @param property the property to get.
+ * @return the BigDecimal
value of the specified property.
+ * @see #get(Property)
+ */
+ BigDecimal getBigDecimal(Property property);
+
+ /**
+ * Returns the value of the specified BigInteger
property.
+ * @param property the property to get.
+ * @return the BigInteger
value of the specified property.
+ * @see #get(Property)
+ */
+ BigInteger getBigInteger(Property property);
+
+ /**
+ * Returns the value of the specified DataObject
property.
+ * @param property the property to get.
+ * @return the DataObject
value of the specified property.
+ * @see #get(Property)
+ */
+ DataObject getDataObject(Property property);
+
+ /**
+ * Returns the value of the specified Date
property.
+ * @param property the property to get.
+ * @return the Date
value of the specified property.
+ * @see #get(Property)
+ */
+ Date getDate(Property property);
+
+ /**
+ * Returns the value of the specified String
property.
+ * @param property the property to get.
+ * @return the String
value of the specified property.
+ * @see #get(Property)
+ */
+ String getString(Property property);
+
+ /**
+ * Returns the value of the specified List
property.
+ * The List returned contains the current values.
+ * Updates through the List interface operate on the current values of the DataObject.
+ * Each access returns the same List object.
+ * @param property the property to get.
+ * @return the List
value of the specified property.
+ * @see #get(Property)
+ */
+ List getList(Property property);
+
+ /**
+ * @see #getSequence()
+ * Returns the value of the specified Sequence
property.
+ * An implementation may throw an UnsupportedOperationException.
+ * @param property the property to get.
+ * @return the Sequence
value of the specified property.
+ * @see #get(Property)
+ * @deprecated in 2.1.0.
+ */
+ Sequence getSequence(Property property);
+
+ /**
+ * Sets the value of the specified boolean
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setBoolean(Property property, boolean value);
+
+ /**
+ * Sets the value of the specified byte
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setByte(Property property, byte value);
+
+ /**
+ * Sets the value of the specified char
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setChar(Property property, char value);
+
+ /**
+ * Sets the value of the specified double
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setDouble(Property property, double value);
+
+ /**
+ * Sets the value of the specified float
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setFloat(Property property, float value);
+
+ /**
+ * Sets the value of the specified int
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setInt(Property property, int value);
+
+ /**
+ * Sets the value of the specified long
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setLong(Property property, long value);
+
+ /**
+ * Sets the value of the specified short
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setShort(Property property, short value);
+
+ /**
+ * Sets the value of the specified byte[]
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setBytes(Property property, byte[] value);
+
+ /**
+ * Sets the value of the specified BigDecimal
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setBigDecimal(Property property, BigDecimal value);
+
+ /**
+ * Sets the value of the specified BigInteger
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setBigInteger(Property property, BigInteger value);
+
+ /**
+ * Sets the value of the specified DataObject
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setDataObject(Property property, DataObject value);
+
+ /**
+ * Sets the value of the specified Date
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setDate(Property property, Date value);
+
+ /**
+ * Sets the value of the specified String
property, to the specified value.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setString(Property property, String value);
+
+ /**
+ * Sets the value of the specified List
property, to the specified value.
+ *
The new value must be a {@link java.util.List}
+ * and each object in that list must be {@link Type#isInstance an instance of}
+ * the property's {@link Property#getType type};
+ * the existing contents are cleared and the contents of the new value are added.
+ * @param property the property to set.
+ * @param value the new value for the property.
+ * @see #set(Property, Object)
+ */
+ void setList(Property property, List value);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be a {@link Property#isContainment containment property}.
+ * The type of the created object is the {@link Property#getType declared type} of the specified property.
+ * @param propertyName the name of the specified containment property.
+ * @return the created data object.
+ * @see #createDataObject(String, String, String)
+ */
+ DataObject createDataObject(String propertyName);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be a {@link Property#isContainment containment property}.
+ * The type of the created object is the {@link Property#getType declared type} of the specified property.
+ * @param propertyIndex the index of the specified containment property.
+ * @return the created data object.
+ * @see #createDataObject(int, String, String)
+ */
+ DataObject createDataObject(int propertyIndex);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be a {@link Property#isContainment containment property}.
+ * The type of the created object is the {@link Property#getType declared type} of the specified property.
+ * @param property the specified containment property.
+ * @return the created data object.
+ * @see #createDataObject(Property, Type)
+ */
+ DataObject createDataObject(Property property);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be a {@link Property#isContainment containment property}.
+ * The type of the created object is specified by the packageURI and typeName arguments.
+ * The specified type must be a compatible target for the property identified by propertyName.
+ * @param propertyName the name of the specified containment property.
+ * @param namespaceURI the namespace URI of the package containing the type of object to be created.
+ * @param typeName the name of a type in the specified package.
+ * @return the created data object.
+ * @see #createDataObject(String)
+ * @see DataGraph#getType
+ */
+ DataObject createDataObject(String propertyName, String namespaceURI, String typeName);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be a {@link Property#isContainment containment property}.
+ * The type of the created object is specified by the packageURI and typeName arguments.
+ * The specified type must be a compatible target for the property identified by propertyIndex.
+ * @param propertyIndex the index of the specified containment property.
+ * @param namespaceURI the namespace URI of the package containing the type of object to be created.
+ * @param typeName the name of a type in the specified package.
+ * @return the created data object.
+ * @see #createDataObject(int)
+ * @see DataGraph#getType
+ */
+ DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName);
+
+ /**
+ * Returns a new {@link DataObject data object} contained by this object using the specified property,
+ * which must be of {@link Property#isContainment containment type}.
+ * The type of the created object is specified by the type argument,
+ * which must be a compatible target for the speicifed property.
+ * @param property a containment property of this object.
+ * @param type the type of object to be created.
+ * @return the created data object.
+ * @see #createDataObject(int)
+ */
+ DataObject createDataObject(Property property, Type type);
+
+ /**
+ * Remove this object from its container and then unset all its non-{@link Property#isReadOnly readOnly} Properties.
+ * If this object is contained by a {@link Property#isReadOnly readOnly} {@link Property#isContainment containment property}, its non-{@link Property#isReadOnly readOnly} Properties will be unset but the object will not be removed from its container.
+ * All DataObjects recursively contained by {@link Property#isContainment containment Properties} will also be deleted.
+ */
+ void delete();
+
+ /**
+ * Returns the containing {@link DataObject data object}
+ * or null
if there is no container.
+ * @return the containing data object or null
.
+ */
+ DataObject getContainer();
+
+ /**
+ * Return the Property of the {@link DataObject data object} containing this data object
+ * or null
if there is no container.
+ * @return the property containing this data object.
+ */
+ Property getContainmentProperty();
+
+ /**
+ * Returns the {@link DataGraph data graph} for this object or null
if there isn't one.
+ * @return the containing data graph or null
.
+ */
+ DataGraph getDataGraph();
+
+ /**
+ * Returns the data object's type.
+ *
+ * The type defines the Properties available for reflective access.
+ * @return the type.
+ */
+ Type getType();
+
+ /**
+ * Returns the Sequence
for this DataObject.
+ * When getType().isSequencedType() == true,
+ * the Sequence of a DataObject corresponds to the
+ * XML elements representing the values of its Properties.
+ * Updates through DataObject and the Lists or Sequences returned
+ * from DataObject operate on the same data.
+ * When getType().isSequencedType() == false, null is returned.
+ * @return the Sequence
or null.
+ */
+ Sequence getSequence();
+
+ /**
+ * Returns a read-only List of the Properties currently used in this DataObject.
+ * This list will contain all of the Properties in getType().getProperties()
+ * and any Properties where isSet(property) is true.
+ * For example, Properties resulting from the use of
+ * open or mixed XML content are present if allowed by the Type.
+ * the List does not contain duplicates.
+ * The order of the Properties in the List begins with getType().getProperties()
+ * and the order of the remaining Properties is determined by the implementation.
+ * The same list will be returned unless the DataObject is updated so that
+ * the contents of the List change.
+ * @return the List of Properties currently used in this DataObject.
+ */
+ List /* Property */ getInstanceProperties();
+
+ /**
+ * Returns the named Property from the current instance properties,
+ * or null if not found. The instance properties are getInstanceProperties().
+ * @param propertyName the name of the Property
+ * @return the named Property from the DataObject's current instance properties, or null.
+ */
+ Property getInstanceProperty(String propertyName);
+
+ /**
+ * @deprecated replaced by {@link #getInstanceProperty(String)} in 2.1.0
+ */
+ Property getProperty(String propertyName);
+
+ /**
+ * Returns the root {@link DataObject data object}.
+ * @return the root data object.
+ */
+ DataObject getRootObject();
+
+ /**
+ * Returns the ChangeSummary with scope covering this dataObject, or null
+ * if there is no ChangeSummary.
+ * @return the ChangeSummary with scope covering this dataObject, or null.
+ */
+ ChangeSummary getChangeSummary();
+
+ /**
+ * Removes this DataObject from its container, if any.
+ * Same as
+ * getContainer().getList(getContainmentProperty()).remove(this) or
+ * getContainer().unset(getContainmentProperty())
+ * depending on getContainmentProperty().isMany() respectively.
+ */
+ void detach();
+}
diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Property.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Property.java
new file mode 100644
index 0000000000..89a3857a75
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Property.java
@@ -0,0 +1,115 @@
+/**
+ * true
if the Property is many-valued.
+ */
+ boolean isMany();
+
+ /**
+ * Returns whether the Property is containment, i.e., whether it represents by-value composition.
+ * @return true
if the Property is containment.
+ */
+ boolean isContainment();
+
+ /**
+ * Returns the containing type of this Property.
+ * @return the Property's containing type.
+ * @see Type#getProperties()
+ */
+ Type getContainingType();
+
+ /**
+ * Returns the default value this Property will have in a {@link DataObject data object} where the Property hasn't been set.
+ * @return the default value.
+ */
+ Object getDefault();
+
+ /**
+ * Returns true if values for this Property cannot be modified using the SDO APIs.
+ * When true, DataObject.set(Property property, Object value) throws an exception.
+ * Values may change due to other factors, such as services operating on DataObjects.
+ * @return true if values for this Property cannot be modified.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Returns the opposite Property if the Property is bi-directional or null otherwise.
+ * @return the opposite Property if the Property is bi-directional or null
+ */
+ Property getOpposite();
+
+ /**
+ * Returns a list of alias names for this Property.
+ * @return a list of alias names for this Property.
+ */
+ List /*String*/ getAliasNames();
+
+ /**
+ * Returns whether or not instances of this property can be set to null. The effect of calling set(null) on a non-nullable
+ * property is not specified by SDO.
+ * @return true if this property is nullable.
+ */
+ boolean isNullable();
+
+ /**
+ * Returns whether or not this is an open content Property.
+ * @return true if this property is an open content Property.
+ */
+ boolean isOpenContent();
+
+ /**
+ * Returns a read-only List of instance Properties available on this Property.
+ *
+ * This list includes, at a minimum, any open content properties (extensions) added to
+ * the object before {@link commonj.sdo.helper.TypeHelper#define(DataObject) defining
+ * the Property's Type}. Implementations may, but are not required to in the 2.1 version
+ * of SDO, provide additional instance properties.
+ * @return the List of instance Properties on this Property.
+ */
+ List /*Property*/ getInstanceProperties();
+
+ /**
+ * Returns the value of the specified instance property of this Property.
+ * @param property one of the properties returned by {@link #getInstanceProperties()}.
+ * @return the value of the specified property.
+ * @see DataObject#get(Property)
+ */
+ Object get(Property property);
+
+}
diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Sequence.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Sequence.java
new file mode 100644
index 0000000000..d015633fa5
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Sequence.java
@@ -0,0 +1,140 @@
+/**
+ * null
for mixed text entries.
+ * @param index the index of the entry.
+ * @return the property or null
for the given entry index.
+ */
+ Property getProperty(int index);
+
+ /**
+ * Returns the property value for the given entry index.
+ * @param index the index of the entry.
+ * @return the value for the given entry index.
+ */
+ Object getValue(int index);
+
+ /**
+ * Sets the entry at a specified index to the new value.
+ * @param index the index of the entry.
+ * @param value the new value for the entry.
+ */
+ Object setValue(int index, Object value);
+
+ /**
+ * Adds a new entry with the specified property name and value
+ * to the end of the entries.
+ * @param propertyName the name of the entry's property.
+ * @param value the value for the entry.
+ */
+ boolean add(String propertyName, Object value);
+
+ /**
+ * Adds a new entry with the specified property index and value
+ * to the end of the entries.
+ * @param propertyIndex the index of the entry's property.
+ * @param value the value for the entry.
+ */
+ boolean add(int propertyIndex, Object value);
+
+ /**
+ * Adds a new entry with the specified property and value
+ * to the end of the entries.
+ * @param property the property of the entry.
+ * @param value the value for the entry.
+ */
+ boolean add(Property property, Object value);
+
+ /**
+ * Adds a new entry with the specified property name and value
+ * at the specified entry index.
+ * @param index the index at which to add the entry.
+ * @param propertyName the name of the entry's property.
+ * @param value the value for the entry.
+ */
+ void add(int index, String propertyName, Object value);
+
+ /**
+ * Adds a new entry with the specified property index and value
+ * at the specified entry index.
+ * @param index the index at which to add the entry.
+ * @param propertyIndex the index of the entry's property.
+ * @param value the value for the entry.
+ */
+ void add(int index, int propertyIndex, Object value);
+
+ /**
+ * Adds a new entry with the specified property and value
+ * at the specified entry index.
+ * @param index the index at which to add the entry.
+ * @param property the property of the entry.
+ * @param value the value for the entry.
+ */
+ void add(int index, Property property, Object value);
+
+ /**
+ * Removes the entry at the given entry index.
+ * @param index the index of the entry.
+ */
+ void remove(int index);
+
+ /**
+ * Moves the entry at fromIndex
to toIndex
.
+ * @param toIndex the index of the entry destination.
+ * @param fromIndex the index of the entry to move.
+ */
+ void move(int toIndex, int fromIndex);
+
+ /**
+ * @deprecated replaced by {@link #addText(String)} in 2.1.0
+ */
+ void add(String text);
+
+ /**
+ * @deprecated replaced by {@link #addText(int, String)} in 2.1.0
+ */
+ void add(int index, String text);
+
+ /**
+ * Adds a new text entry to the end of the Sequence.
+ * @param text value of the entry.
+ */
+ void addText(String text);
+
+ /**
+ * Adds a new text entry at the given index.
+ * @param index the index at which to add the entry.
+ * @param text value of the entry.
+ */
+ void addText(int index, String text);
+
+}
diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Type.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Type.java
new file mode 100644
index 0000000000..c8d54a6ca0
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/Type.java
@@ -0,0 +1,166 @@
+/**
+ * true
if the object is an instance.
+ * @see Class#isInstance
+ */
+ boolean isInstance(Object object);
+
+ /**
+ * Returns the List of the {@link Property Properties} of this type.
+ *
+ * The expression + *
+ * type.getProperties().indexOf(property) + *+ * yields the property's index relative to this type. + * As such, these expressions are equivalent: + *
+ * dataObject.{@link DataObject#get(int) get}(i) + * dataObject.{@link DataObject#get(Property) get}((Property)dataObject.getType().getProperties().get(i)); + *+ * + * @return the Properties of the type. + * @see Property#getContainingType + */ + List /*Property*/ getProperties(); + + /** + * Returns from {@link #getProperties all the Properties} of this type, the one with the specified name. + * As such, these expressions are equivalent: + *
+ * dataObject.{@link DataObject#get(String) get}("name") + * dataObject.{@link DataObject#get(Property) get}(dataObject.getType().getProperty("name")) + *+ * + * @return the Property with the specified name. + * @see #getProperties + */ + Property getProperty(String propertyName); + + /** + * Indicates if this Type specifies DataTypes (true) or DataObjects (false). + * When false, any object that is an instance of this type + * also implements the DataObject interface. + * True for simple types such as Strings and numbers. + * For any object: + *
+ * isInstance(object) && !isDataType() implies + * DataObject.class.isInstance(object) returns true. + *+ * @return true if Type specifies DataTypes, false for DataObjects. + */ + boolean isDataType(); + + /** + * Indicates if this Type allows any form of open content. If false, + * dataObject.getInstanceProperties() must be the same as + * dataObject.getType().getProperties() for any DataObject dataObject of this Type. + * @return true if this Type allows open content. + */ + boolean isOpen(); + + /** + * Indicates if this Type specifies Sequenced DataObjects. + * Sequenced DataObjects are used when the order of values + * between Properties must be preserved. + * When true, a DataObject will return a Sequence. For example, + *
+ * Sequence elements = dataObject.{@link DataObject#getSequence() getSequence}(); + *+ * @return true if this Type specifies Sequenced DataObjects. + */ + boolean isSequenced(); + + /** + * Indicates if this Type is abstract. If true, this Type cannot be + * instantiated. Abstract types cannot be used in DataObject or + * DataFactory create methods. + * @return true if this Type is abstract. + */ + boolean isAbstract(); + + /** + * Returns the List of base Types for this Type. The List is empty + * if there are no base Types. XSD
+ * This list includes, at a minimum, any open content properties (extensions) added to
+ * the object before {@link commonj.sdo.helper.TypeHelper#define(DataObject) defining
+ * the Type's Type}. Implementations may, but are not required to in the 2.1 version
+ * of SDO, provide additional instance properties.
+ * @return the List of instance Properties on this Type.
+ */
+ List /*Property*/ getInstanceProperties();
+
+ /**
+ * Returns the value of the specified instance property of this Type.
+ * @param property one of the properties returned by {@link #getInstanceProperties()}.
+ * @return the value of the specified property.
+ * @see DataObject#get(Property)
+ */
+ Object get(Property property);
+
+}
diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/CopyHelper.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/CopyHelper.java
new file mode 100644
index 0000000000..d185d4d420
--- /dev/null
+++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/CopyHelper.java
@@ -0,0 +1,85 @@
+/**
+ *
Two DataObjects are equalShallow if
+ * they have the same {@link DataObject#getType Type}
+ * and all their compared Properties are equal.
+ * The set of Properties compared are the
+ * {@link DataObject#getInstanceProperties() instance properties}
+ * where property.getType().isDataType() is true
+ * and property.getType() is not ChangeSummaryType.
+ *
Two of these Property values are equal if they are both not
+ * {@link DataObject#isSet(Property) set}, or set to an equal value
+ * dataObject1.get(property).equals(dataObject2.get(property))
+ *
If the type is a sequenced type, the sequence entries must be the same.
+ * For each entry x in the sequence where the property is used in the comparison,
+ * dataObject1.getSequence().getValue(x).equals(
+ * dataObject2.getSequence().getValue(x)) and
+ * dataObject1.getSequence().getProperty(x) ==
+ * dataObject2.getSequence().getProperty(x)
+ * must be true.
+ *
Two DataObjects are equal(Deep) if they are equalShallow,
+ * all their compared Properties are equal, and all reachable DataObjects in their
+ * graphs excluding containers are equal.
+ * The set of Properties compared are the
+ * {@link DataObject#getInstanceProperties() instance properties}
+ * where property.getType().isDataType() is false,
+ * and is not a container property, ie !property.getOpposite().isContainment()
+ *
Two of these Property values are equal if they are both not
+ * {@link DataObject#isSet(Property) set}, or all the DataObjects
+ * they refer to are {@link #equal(DataObject, DataObject) equal} in the
+ * context of dataObject1 and dataObject2.
+ *
Note that properties to a containing DataObject are not compared
+ * which means two DataObject trees can be equal even if their containers are not equal.
+ *
If the type is a sequenced type, the sequence entries must be the same.
+ * For each entry x in the sequence where the property is used in the comparison,
+ * equal(dataObject1.getSequence().getValue(x),
+ * dataObject2.getSequence().getValue(x)) and
+ * dataObject1.getSequence().getProperty(x) ==
+ * dataObject2.getSequence().getProperty(x)
+ * must be true.
+ *
+ * A DataObject directly or indirectly referenced by dataObject1 or dataObject2 + * can only be equal to exactly one DataObject directly or indirectly referenced + * by dataObject1 or dataObject2, respectively. + * This ensures that dataObject1 and dataObject2 are equal if the graph formed by + * all their referenced DataObjects have the same shape. + *
+ * Returns true if the trees of DataObjects are equal(Deep). + * @param dataObject1 DataObject to be compared + * @param dataObject2 DataObject to be compared + * @return true if the trees of DataObjects are equal(Deep). + */ + boolean equal(DataObject dataObject1, DataObject dataObject2); + + /** + * The default EqualityHelper. + */ + EqualityHelper INSTANCE = HelperProvider.getEqualityHelper(); +} diff --git a/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java new file mode 100644 index 0000000000..143b29de17 --- /dev/null +++ b/sdo-java/branches/emf-2.5/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java @@ -0,0 +1,67 @@ +/** + *" + NL + " * The following features are supported:" + NL + " *
"; + protected final String TEXT_34 = NL + " * The following features are implemented:" + NL + " *
";
+ protected final String TEXT_227 = "
.";
+ protected final String TEXT_228 = NL + "\t * The literals are from the enumeration {@link ";
+ protected final String TEXT_229 = "}.";
+ protected final String TEXT_230 = NL + "\t * It is bidirectional and its opposite is '{@link ";
+ protected final String TEXT_231 = "#";
+ protected final String TEXT_232 = " ";
+ protected final String TEXT_233 = "}'.";
+ protected final String TEXT_234 = NL + "\t * ";
+ protected final String TEXT_235 = NL + "\t * " + NL + "\t * If the meaning of the '"; + protected final String TEXT_236 = "' "; + protected final String TEXT_237 = " isn't clear," + NL + "\t * there really should be more of a description here..." + NL + "\t *
"; + protected final String TEXT_238 = NL + "\t * "; + protected final String TEXT_239 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_240 = NL + "\t * "; + protected final String TEXT_241 = NL + "\t * @return the value of the '"; + protected final String TEXT_242 = "' "; + protected final String TEXT_243 = "."; + protected final String TEXT_244 = NL + "\t * @see "; + protected final String TEXT_245 = NL + "\t * @see #isSet"; + protected final String TEXT_246 = "()"; + protected final String TEXT_247 = NL + "\t * @see #unset"; + protected final String TEXT_248 = "()"; + protected final String TEXT_249 = NL + "\t * @see #set"; + protected final String TEXT_250 = "("; + protected final String TEXT_251 = ")"; + protected final String TEXT_252 = NL + "\t * @see "; + protected final String TEXT_253 = "#get"; + protected final String TEXT_254 = "()"; + protected final String TEXT_255 = NL + "\t * @see "; + protected final String TEXT_256 = "#"; + protected final String TEXT_257 = NL + "\t * @model "; + protected final String TEXT_258 = NL + "\t * "; + protected final String TEXT_259 = NL + "\t * @model"; + protected final String TEXT_260 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_261 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_262 = NL + "\t"; + protected final String TEXT_263 = " "; + protected final String TEXT_264 = "();" + NL; + protected final String TEXT_265 = NL + "\tpublic "; + protected final String TEXT_266 = " "; + protected final String TEXT_267 = "()" + NL + "\t{"; + protected final String TEXT_268 = NL + "\t\treturn "; + protected final String TEXT_269 = "("; + protected final String TEXT_270 = "("; + protected final String TEXT_271 = ")get("; + protected final String TEXT_272 = ", true)"; + protected final String TEXT_273 = ")."; + protected final String TEXT_274 = "()"; + protected final String TEXT_275 = ";"; + protected final String TEXT_276 = NL + "\t\t"; + protected final String TEXT_277 = " "; + protected final String TEXT_278 = " = ("; + protected final String TEXT_279 = ")eVirtualGet("; + protected final String TEXT_280 = ");"; + protected final String TEXT_281 = NL + "\t\tif ("; + protected final String TEXT_282 = " == null)" + NL + "\t\t{"; + protected final String TEXT_283 = NL + "\t\t\teVirtualSet("; + protected final String TEXT_284 = ", "; + protected final String TEXT_285 = " = new "; + protected final String TEXT_286 = ");"; + protected final String TEXT_287 = NL + "\t\t "; + protected final String TEXT_288 = " = createSequence(_INTERNAL_"; + protected final String TEXT_289 = ");"; + protected final String TEXT_290 = NL + "\t\t "; + protected final String TEXT_291 = " = createPropertyList("; + protected final String TEXT_292 = ", "; + protected final String TEXT_293 = ".class, "; + protected final String TEXT_294 = ", "; + protected final String TEXT_295 = ");"; + protected final String TEXT_296 = NL + "\t\t}" + NL + "\t\treturn "; + protected final String TEXT_297 = ";"; + protected final String TEXT_298 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_299 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_300 = ")eContainer();"; + protected final String TEXT_301 = NL + "\t\t"; + protected final String TEXT_302 = " "; + protected final String TEXT_303 = " = ("; + protected final String TEXT_304 = ")eVirtualGet("; + protected final String TEXT_305 = ", "; + protected final String TEXT_306 = "_DEFAULT_"; + protected final String TEXT_307 = ");"; + protected final String TEXT_308 = NL + "\t\tif ("; + protected final String TEXT_309 = " != null && isProxy("; + protected final String TEXT_310 = "))" + NL + "\t\t{" + NL + "\t\t\tObject old"; + protected final String TEXT_311 = " = "; + protected final String TEXT_312 = ";" + NL + "\t\t\t"; + protected final String TEXT_313 = " = "; + protected final String TEXT_314 = "resolveProxy(old"; + protected final String TEXT_315 = ");" + NL + "\t\t\tif ("; + protected final String TEXT_316 = " != old"; + protected final String TEXT_317 = ")" + NL + "\t\t\t{"; + protected final String TEXT_318 = NL + "\t\t\t\t"; + protected final String TEXT_319 = " new"; + protected final String TEXT_320 = " = ("; + protected final String TEXT_321 = ")"; + protected final String TEXT_322 = ";"; + protected final String TEXT_323 = NL + "\t\t\t\tChangeContext changeContext = old"; + protected final String TEXT_324 = ".eInverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_325 = ", null, null);"; + protected final String TEXT_326 = NL + "\t\t\t\t"; + protected final String TEXT_327 = " changeContext = old"; + protected final String TEXT_328 = ".eInverseRemove(this, "; + protected final String TEXT_329 = ", "; + protected final String TEXT_330 = ".class, null);"; + protected final String TEXT_331 = NL + "\t\t\t\tif (new"; + protected final String TEXT_332 = ".eInternalContainer() == null)" + NL + "\t\t\t\t{"; + protected final String TEXT_333 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_334 = ".eInverseAdd(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_335 = ", null, changeContext);"; + protected final String TEXT_336 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_337 = ".eInverseAdd(this, "; + protected final String TEXT_338 = ", "; + protected final String TEXT_339 = ".class, changeContext);"; + protected final String TEXT_340 = NL + "\t\t\t\t}" + NL + "\t\t\t\tif (changeContext != null) dispatch(changeContext);"; + protected final String TEXT_341 = NL + "\t\t\t\teVirtualSet("; + protected final String TEXT_342 = ", "; + protected final String TEXT_343 = ");"; + protected final String TEXT_344 = NL + "\t\t\t\tif (isNotifying())" + NL + "\t\t\t\t\tnotify(ChangeKind.RESOLVE, _INTERNAL_"; + protected final String TEXT_345 = ", old"; + protected final String TEXT_346 = ", "; + protected final String TEXT_347 = ");"; + protected final String TEXT_348 = NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_349 = NL + "\t\treturn ("; + protected final String TEXT_350 = ")eVirtualGet("; + protected final String TEXT_351 = ", "; + protected final String TEXT_352 = "_DEFAULT_"; + protected final String TEXT_353 = ");"; + protected final String TEXT_354 = NL + "\t\treturn ("; + protected final String TEXT_355 = " & "; + protected final String TEXT_356 = "_EFLAG) != 0;"; + protected final String TEXT_357 = NL + "\t\treturn "; + protected final String TEXT_358 = ";"; + protected final String TEXT_359 = NL + "\t\t"; + protected final String TEXT_360 = " "; + protected final String TEXT_361 = " = basicGet"; + protected final String TEXT_362 = "();" + NL + "\t\treturn "; + protected final String TEXT_363 = " != null && "; + protected final String TEXT_364 = ".isProxy() ? "; + protected final String TEXT_365 = "eResolveProxy(("; + protected final String TEXT_366 = ")"; + protected final String TEXT_367 = ") : "; + protected final String TEXT_368 = ";"; + protected final String TEXT_369 = NL + "\t\treturn create"; + protected final String TEXT_370 = "(get"; + protected final String TEXT_371 = "(), getType(), _INTERNAL_"; + protected final String TEXT_372 = ");"; + protected final String TEXT_373 = NL + "\t\treturn ("; + protected final String TEXT_374 = ")(("; + protected final String TEXT_375 = ")get"; + protected final String TEXT_376 = "()).list("; + protected final String TEXT_377 = ");"; + protected final String TEXT_378 = NL + "\t\treturn get"; + protected final String TEXT_379 = "(get"; + protected final String TEXT_380 = "(), getType(), _INTERNAL_"; + protected final String TEXT_381 = ");"; + protected final String TEXT_382 = NL + "\t\treturn (("; + protected final String TEXT_383 = ")get"; + protected final String TEXT_384 = "()).list("; + protected final String TEXT_385 = ");"; + protected final String TEXT_386 = NL + "\t\treturn "; + protected final String TEXT_387 = "("; + protected final String TEXT_388 = "("; + protected final String TEXT_389 = ")get(get"; + protected final String TEXT_390 = "(), getType(), _INTERNAL_"; + protected final String TEXT_391 = ")"; + protected final String TEXT_392 = ")."; + protected final String TEXT_393 = "()"; + protected final String TEXT_394 = ";"; + protected final String TEXT_395 = NL + "\t\treturn "; + protected final String TEXT_396 = "("; + protected final String TEXT_397 = "("; + protected final String TEXT_398 = ")get(get"; + protected final String TEXT_399 = "(), getType(), _INTERNAL_"; + protected final String TEXT_400 = ")"; + protected final String TEXT_401 = ")."; + protected final String TEXT_402 = "()"; + protected final String TEXT_403 = ";"; + protected final String TEXT_404 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_405 = "' "; + protected final String TEXT_406 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_407 = NL + "\t}"; + protected final String TEXT_408 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_409 = " basicGet"; + protected final String TEXT_410 = "()" + NL + "\t{"; + protected final String TEXT_411 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_412 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_413 = ")eInternalContainer();"; + protected final String TEXT_414 = NL + "\t\treturn ("; + protected final String TEXT_415 = ")eVirtualGet("; + protected final String TEXT_416 = ");"; + protected final String TEXT_417 = NL + "\t\treturn "; + protected final String TEXT_418 = ";"; + protected final String TEXT_419 = NL + "\t\treturn ("; + protected final String TEXT_420 = ")get(get"; + protected final String TEXT_421 = "(), getType(), _INTERNAL_"; + protected final String TEXT_422 = ");"; + protected final String TEXT_423 = NL + "\t\treturn ("; + protected final String TEXT_424 = ")get"; + protected final String TEXT_425 = "().get("; + protected final String TEXT_426 = ", false);"; + protected final String TEXT_427 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_428 = "' "; + protected final String TEXT_429 = NL + "\t\t// -> do not perform proxy resolution" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_430 = NL + "\t}" + NL; + protected final String TEXT_431 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicSet"; + protected final String TEXT_432 = "("; + protected final String TEXT_433 = " new"; + protected final String TEXT_434 = ", ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_435 = NL + "\t\tObject old"; + protected final String TEXT_436 = " = eVirtualSet("; + protected final String TEXT_437 = ", new"; + protected final String TEXT_438 = ");"; + protected final String TEXT_439 = NL + "\t\t"; + protected final String TEXT_440 = " old"; + protected final String TEXT_441 = " = "; + protected final String TEXT_442 = ";" + NL + "\t\t"; + protected final String TEXT_443 = " = new"; + protected final String TEXT_444 = ";"; + protected final String TEXT_445 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_446 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_447 = NL + "\t\tboolean old"; + protected final String TEXT_448 = "_set_ = ("; + protected final String TEXT_449 = " & "; + protected final String TEXT_450 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_451 = " |= "; + protected final String TEXT_452 = "_ESETFLAG;"; + protected final String TEXT_453 = NL + "\t\tboolean old"; + protected final String TEXT_454 = "_set_ = "; + protected final String TEXT_455 = "_set_;" + NL + "\t\t"; + protected final String TEXT_456 = "_set_ = true;"; + protected final String TEXT_457 = NL + "\t\tif (isNotifying())" + NL + "\t\t{"; + protected final String TEXT_458 = NL + "\t\t\taddNotification(this, ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_459 = ", "; + protected final String TEXT_460 = "isSetChange ? null : old"; + protected final String TEXT_461 = "old"; + protected final String TEXT_462 = ", new"; + protected final String TEXT_463 = ", "; + protected final String TEXT_464 = "isSetChange"; + protected final String TEXT_465 = "!old"; + protected final String TEXT_466 = "_set_"; + protected final String TEXT_467 = ", changeContext);"; + protected final String TEXT_468 = NL + "\t\t\taddNotification(this, ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_469 = ", "; + protected final String TEXT_470 = "old"; + protected final String TEXT_471 = " == EVIRTUAL_NO_VALUE ? null : old"; + protected final String TEXT_472 = "old"; + protected final String TEXT_473 = ", new"; + protected final String TEXT_474 = ", changeContext);"; + protected final String TEXT_475 = NL + "\t\t}"; + protected final String TEXT_476 = NL + "\t\treturn changeContext;"; + protected final String TEXT_477 = NL + "\t\treturn basicAdd(get"; + protected final String TEXT_478 = "(), getType(), _INTERNAL_"; + protected final String TEXT_479 = ", new"; + protected final String TEXT_480 = ", changeContext);"; + protected final String TEXT_481 = NL + "\t\treturn basicAdd(get"; + protected final String TEXT_482 = "(), getType(), _INTERNAL_"; + protected final String TEXT_483 = ", new"; + protected final String TEXT_484 = ", changeContext);"; + protected final String TEXT_485 = NL + "\t\t// TODO: implement this method to set the contained '"; + protected final String TEXT_486 = "' "; + protected final String TEXT_487 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_488 = NL + "\t}" + NL; + protected final String TEXT_489 = NL + "\t/**" + NL + "\t * Sets the value of the '{@link "; + protected final String TEXT_490 = "#"; + protected final String TEXT_491 = " "; + protected final String TEXT_492 = "}' "; + protected final String TEXT_493 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @param value the new value of the '"; + protected final String TEXT_494 = "' "; + protected final String TEXT_495 = "."; + protected final String TEXT_496 = NL + "\t * @see "; + protected final String TEXT_497 = NL + "\t * @see #isSet"; + protected final String TEXT_498 = "()"; + protected final String TEXT_499 = NL + "\t * @see #unset"; + protected final String TEXT_500 = "()"; + protected final String TEXT_501 = NL + "\t * @see #"; + protected final String TEXT_502 = "()" + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_503 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_504 = NL + "\tvoid set"; + protected final String TEXT_505 = "("; + protected final String TEXT_506 = " value);" + NL; + protected final String TEXT_507 = NL + "\tpublic void set"; + protected final String TEXT_508 = "("; + protected final String TEXT_509 = " new"; + protected final String TEXT_510 = ")" + NL + "\t{"; + protected final String TEXT_511 = NL + "\t\t_set_("; + protected final String TEXT_512 = ", "; + protected final String TEXT_513 = "new "; + protected final String TEXT_514 = "("; + protected final String TEXT_515 = "new"; + protected final String TEXT_516 = ")"; + protected final String TEXT_517 = ");"; + protected final String TEXT_518 = NL + "\t\tif (new"; + protected final String TEXT_519 = " != eInternalContainer() || (eContainerFeatureID != "; + protected final String TEXT_520 = " && new"; + protected final String TEXT_521 = " != null))" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_522 = ".isAncestor(this, "; + protected final String TEXT_523 = "new"; + protected final String TEXT_524 = "))" + NL + "\t\t\t\tthrow new "; + protected final String TEXT_525 = "(\"Recursive containment not allowed for \" + toString());"; + protected final String TEXT_526 = NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_527 = " != null)" + NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_528 = ")new"; + protected final String TEXT_529 = ").eInverseAdd(this, "; + protected final String TEXT_530 = ", "; + protected final String TEXT_531 = ".class, changeContext);" + NL + "\t\t\tchangeContext = eBasicSetContainer(("; + protected final String TEXT_532 = ")new"; + protected final String TEXT_533 = ", "; + protected final String TEXT_534 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}"; + protected final String TEXT_535 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_536 = ", new"; + protected final String TEXT_537 = ", new"; + protected final String TEXT_538 = ");"; + protected final String TEXT_539 = NL + "\t\t"; + protected final String TEXT_540 = " "; + protected final String TEXT_541 = " = ("; + protected final String TEXT_542 = ")eVirtualGet("; + protected final String TEXT_543 = ");"; + protected final String TEXT_544 = NL + "\t\tif (new"; + protected final String TEXT_545 = " != "; + protected final String TEXT_546 = ")" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif ("; + protected final String TEXT_547 = " != null)"; + protected final String TEXT_548 = NL + "\t\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_549 = ", this, OPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_550 = ", null, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_551 = " != null)" + NL + "\t\t\t\tchangeContext = inverseAdd(new"; + protected final String TEXT_552 = ", this, OPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_553 = ", null, changeContext);"; + protected final String TEXT_554 = NL + "\t\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_555 = ", this, "; + protected final String TEXT_556 = ", "; + protected final String TEXT_557 = ".class, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_558 = " != null)" + NL + "\t\t\t\tchangeContext = inverseAdd(new"; + protected final String TEXT_559 = ", this, "; + protected final String TEXT_560 = ", "; + protected final String TEXT_561 = ".class, changeContext);"; + protected final String TEXT_562 = NL + "\t\t\tchangeContext = basicSet"; + protected final String TEXT_563 = "("; + protected final String TEXT_564 = "new"; + protected final String TEXT_565 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}"; + protected final String TEXT_566 = NL + "\t\telse" + NL + "\t\t{"; + protected final String TEXT_567 = NL + "\t\t\tboolean old"; + protected final String TEXT_568 = "_set_ = eVirtualIsSet("; + protected final String TEXT_569 = ");"; + protected final String TEXT_570 = NL + "\t\t\tboolean old"; + protected final String TEXT_571 = "_set_ = ("; + protected final String TEXT_572 = " & "; + protected final String TEXT_573 = "_ESETFLAG) != 0;"; + protected final String TEXT_574 = NL + "\t\t\t"; + protected final String TEXT_575 = " |= "; + protected final String TEXT_576 = "_ESETFLAG;"; + protected final String TEXT_577 = NL + "\t\t\tboolean old"; + protected final String TEXT_578 = "_set_ = "; + protected final String TEXT_579 = "_set_;"; + protected final String TEXT_580 = NL + "\t\t\t"; + protected final String TEXT_581 = "_set_ = true;"; + protected final String TEXT_582 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_583 = ", new"; + protected final String TEXT_584 = ", new"; + protected final String TEXT_585 = ", !old"; + protected final String TEXT_586 = "_set_);"; + protected final String TEXT_587 = NL + "\t\t}"; + protected final String TEXT_588 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_589 = ", new"; + protected final String TEXT_590 = ", new"; + protected final String TEXT_591 = ");"; + protected final String TEXT_592 = NL + "\t\t"; + protected final String TEXT_593 = " old"; + protected final String TEXT_594 = " = ("; + protected final String TEXT_595 = " & "; + protected final String TEXT_596 = "_EFLAG) != 0;"; + protected final String TEXT_597 = NL + "\t\tif (new"; + protected final String TEXT_598 = ") "; + protected final String TEXT_599 = " |= "; + protected final String TEXT_600 = "_EFLAG; else "; + protected final String TEXT_601 = " &= ~"; + protected final String TEXT_602 = "_EFLAG;"; + protected final String TEXT_603 = NL + "\t\t"; + protected final String TEXT_604 = " old"; + protected final String TEXT_605 = " = "; + protected final String TEXT_606 = ";"; + protected final String TEXT_607 = NL + "\t\t"; + protected final String TEXT_608 = " "; + protected final String TEXT_609 = " = new"; + protected final String TEXT_610 = " == null ? "; + protected final String TEXT_611 = "_DEFAULT_ : new"; + protected final String TEXT_612 = ";"; + protected final String TEXT_613 = NL + "\t\t"; + protected final String TEXT_614 = " = new"; + protected final String TEXT_615 = " == null ? "; + protected final String TEXT_616 = "_DEFAULT_ : new"; + protected final String TEXT_617 = ";"; + protected final String TEXT_618 = NL + "\t\t"; + protected final String TEXT_619 = " "; + protected final String TEXT_620 = " = "; + protected final String TEXT_621 = "new"; + protected final String TEXT_622 = ";"; + protected final String TEXT_623 = NL + "\t\t"; + protected final String TEXT_624 = " = "; + protected final String TEXT_625 = "new"; + protected final String TEXT_626 = ";"; + protected final String TEXT_627 = NL + "\t\tObject old"; + protected final String TEXT_628 = " = eVirtualSet("; + protected final String TEXT_629 = ", "; + protected final String TEXT_630 = ");"; + protected final String TEXT_631 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_632 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_633 = NL + "\t\tboolean old"; + protected final String TEXT_634 = "_set_ = ("; + protected final String TEXT_635 = " & "; + protected final String TEXT_636 = "_ESETFLAG) != 0;"; + protected final String TEXT_637 = NL + "\t\t"; + protected final String TEXT_638 = " |= "; + protected final String TEXT_639 = "_ESETFLAG;"; + protected final String TEXT_640 = NL + "\t\tboolean old"; + protected final String TEXT_641 = "_set_ = "; + protected final String TEXT_642 = "_set_;"; + protected final String TEXT_643 = NL + "\t\t"; + protected final String TEXT_644 = "_set_ = true;"; + protected final String TEXT_645 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_646 = ", "; + protected final String TEXT_647 = "isSetChange ? "; + protected final String TEXT_648 = "null"; + protected final String TEXT_649 = "_DEFAULT_"; + protected final String TEXT_650 = " : old"; + protected final String TEXT_651 = "old"; + protected final String TEXT_652 = ", "; + protected final String TEXT_653 = "new"; + protected final String TEXT_654 = ", "; + protected final String TEXT_655 = "isSetChange"; + protected final String TEXT_656 = "!old"; + protected final String TEXT_657 = "_set_"; + protected final String TEXT_658 = ");"; + protected final String TEXT_659 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, _INTERNAL_"; + protected final String TEXT_660 = ", "; + protected final String TEXT_661 = "old"; + protected final String TEXT_662 = " == EVIRTUAL_NO_VALUE ? "; + protected final String TEXT_663 = "null"; + protected final String TEXT_664 = "_DEFAULT_"; + protected final String TEXT_665 = " : old"; + protected final String TEXT_666 = "old"; + protected final String TEXT_667 = ", "; + protected final String TEXT_668 = "new"; + protected final String TEXT_669 = ");"; + protected final String TEXT_670 = NL + "\t\tset(get"; + protected final String TEXT_671 = "(), getType(), _INTERNAL_"; + protected final String TEXT_672 = ", "; + protected final String TEXT_673 = " new "; + protected final String TEXT_674 = "("; + protected final String TEXT_675 = "new"; + protected final String TEXT_676 = ")"; + protected final String TEXT_677 = ");"; + protected final String TEXT_678 = NL + "\t\t(("; + protected final String TEXT_679 = ".Internal)get"; + protected final String TEXT_680 = "()).set("; + protected final String TEXT_681 = ", "; + protected final String TEXT_682 = "new "; + protected final String TEXT_683 = "("; + protected final String TEXT_684 = "new"; + protected final String TEXT_685 = ")"; + protected final String TEXT_686 = ");"; + protected final String TEXT_687 = NL + "\t\t// TODO: implement this method to set the '"; + protected final String TEXT_688 = "' "; + protected final String TEXT_689 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_690 = NL + "\t}" + NL; + protected final String TEXT_691 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicUnset"; + protected final String TEXT_692 = "(ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_693 = NL + "\t\tObject old"; + protected final String TEXT_694 = " = eVirtualUnset("; + protected final String TEXT_695 = ");"; + protected final String TEXT_696 = NL + "\t\t"; + protected final String TEXT_697 = " old"; + protected final String TEXT_698 = " = "; + protected final String TEXT_699 = ";" + NL + "\t\t"; + protected final String TEXT_700 = " = null;"; + protected final String TEXT_701 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_702 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_703 = NL + "\t\tboolean old"; + protected final String TEXT_704 = "_set_ = ("; + protected final String TEXT_705 = " & "; + protected final String TEXT_706 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_707 = " &= ~"; + protected final String TEXT_708 = "_ESETFLAG;"; + protected final String TEXT_709 = NL + "\t\tboolean old"; + protected final String TEXT_710 = "_set_ = "; + protected final String TEXT_711 = "_set_;" + NL + "\t\t"; + protected final String TEXT_712 = "_set_ = false;"; + protected final String TEXT_713 = NL + "\t\tif (isNotifying())" + NL + "\t\t{"; + protected final String TEXT_714 = NL + "\t\t\taddNotification(this, ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_715 = ", "; + protected final String TEXT_716 = "isSetChange ? null : old"; + protected final String TEXT_717 = "old"; + protected final String TEXT_718 = ", null, "; + protected final String TEXT_719 = "isSetChange"; + protected final String TEXT_720 = "!old"; + protected final String TEXT_721 = "_set_"; + protected final String TEXT_722 = ", changeContext);"; + protected final String TEXT_723 = NL + "\t\t\taddNotification(this, ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_724 = ", "; + protected final String TEXT_725 = "old"; + protected final String TEXT_726 = " == EVIRTUAL_NO_VALUE ? null : old"; + protected final String TEXT_727 = "old"; + protected final String TEXT_728 = ", null, changeContext);"; + protected final String TEXT_729 = NL + "\t\t}"; + protected final String TEXT_730 = NL + "\t\treturn changeContext;"; + protected final String TEXT_731 = NL + "\t\t// TODO: implement this method to unset the contained '"; + protected final String TEXT_732 = "' "; + protected final String TEXT_733 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_734 = NL + "\t}" + NL; + protected final String TEXT_735 = NL + "\t/**" + NL + "\t * Unsets the value of the '{@link "; + protected final String TEXT_736 = "#"; + protected final String TEXT_737 = " "; + protected final String TEXT_738 = "}' "; + protected final String TEXT_739 = "." + NL + "\t * " + NL + "\t * "; + protected final String TEXT_740 = NL + "\t * @see #isSet"; + protected final String TEXT_741 = "()"; + protected final String TEXT_742 = NL + "\t * @see #"; + protected final String TEXT_743 = "()"; + protected final String TEXT_744 = NL + "\t * @see #set"; + protected final String TEXT_745 = "("; + protected final String TEXT_746 = ")"; + protected final String TEXT_747 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_748 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_749 = NL + "\tvoid unset"; + protected final String TEXT_750 = "();" + NL; + protected final String TEXT_751 = NL + "\tpublic void unset"; + protected final String TEXT_752 = "()" + NL + "\t{"; + protected final String TEXT_753 = NL + "\t\tunset("; + protected final String TEXT_754 = ");"; + protected final String TEXT_755 = NL + "\t\t(("; + protected final String TEXT_756 = ".Unsettable)get"; + protected final String TEXT_757 = "()).unset();"; + protected final String TEXT_758 = NL + "\t\t"; + protected final String TEXT_759 = " "; + protected final String TEXT_760 = " = ("; + protected final String TEXT_761 = ")eVirtualGet("; + protected final String TEXT_762 = ");"; + protected final String TEXT_763 = NL + "\t\tif ("; + protected final String TEXT_764 = " != null)" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;"; + protected final String TEXT_765 = NL + "\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_766 = ", this, EOPPOSITE_FEATURE_BASE - _INTERNAL_"; + protected final String TEXT_767 = ", null, changeContext);"; + protected final String TEXT_768 = NL + "\t\t\tchangeContext = inverseRemove("; + protected final String TEXT_769 = ", this, "; + protected final String TEXT_770 = ", "; + protected final String TEXT_771 = ".class, changeContext);"; + protected final String TEXT_772 = NL + "\t\t\tchangeContext = basicUnset"; + protected final String TEXT_773 = "(changeContext);" + NL + "\t\t\tif (changeContext != null) dispatch(changeContext);" + NL + "\t\t}" + NL + "\t\telse" + NL + " \t{"; + protected final String TEXT_774 = NL + "\t\t\tboolean old"; + protected final String TEXT_775 = "_set_ = eVirtualIsSet("; + protected final String TEXT_776 = ");"; + protected final String TEXT_777 = NL + "\t\t\tboolean old"; + protected final String TEXT_778 = "_set_ = ("; + protected final String TEXT_779 = " & "; + protected final String TEXT_780 = "_ESETFLAG) != 0;"; + protected final String TEXT_781 = NL + "\t\t\t"; + protected final String TEXT_782 = " &= ~"; + protected final String TEXT_783 = "_ESETFLAG;"; + protected final String TEXT_784 = NL + "\t\t\tboolean old"; + protected final String TEXT_785 = "_set_ = "; + protected final String TEXT_786 = "_set_;"; + protected final String TEXT_787 = NL + "\t\t\t"; + protected final String TEXT_788 = "_set_ = false;"; + protected final String TEXT_789 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_790 = ", null, null, old"; + protected final String TEXT_791 = "_set_);"; + protected final String TEXT_792 = NL + " \t}"; + protected final String TEXT_793 = NL + "\t\t"; + protected final String TEXT_794 = " old"; + protected final String TEXT_795 = " = ("; + protected final String TEXT_796 = " & "; + protected final String TEXT_797 = "_EFLAG) != 0;"; + protected final String TEXT_798 = NL + "\t\tObject old"; + protected final String TEXT_799 = " = eVirtualUnset("; + protected final String TEXT_800 = ");"; + protected final String TEXT_801 = NL + "\t\t"; + protected final String TEXT_802 = " old"; + protected final String TEXT_803 = " = "; + protected final String TEXT_804 = ";"; + protected final String TEXT_805 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_806 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_807 = NL + "\t\tboolean old"; + protected final String TEXT_808 = "_set_ = ("; + protected final String TEXT_809 = " & "; + protected final String TEXT_810 = "_ESETFLAG) != 0;"; + protected final String TEXT_811 = NL + "\t\tboolean old"; + protected final String TEXT_812 = "_set_ = "; + protected final String TEXT_813 = "_set_;"; + protected final String TEXT_814 = NL + "\t\t"; + protected final String TEXT_815 = " = null;"; + protected final String TEXT_816 = NL + "\t\t"; + protected final String TEXT_817 = " &= ~"; + protected final String TEXT_818 = "_ESETFLAG;"; + protected final String TEXT_819 = NL + "\t\t"; + protected final String TEXT_820 = "_set_ = false;"; + protected final String TEXT_821 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_822 = ", "; + protected final String TEXT_823 = "isSetChange ? old"; + protected final String TEXT_824 = " : null"; + protected final String TEXT_825 = "old"; + protected final String TEXT_826 = ", null, "; + protected final String TEXT_827 = "isSetChange"; + protected final String TEXT_828 = "old"; + protected final String TEXT_829 = "_set_"; + protected final String TEXT_830 = ");"; + protected final String TEXT_831 = NL + "\t\tif ("; + protected final String TEXT_832 = "_DEFAULT_) "; + protected final String TEXT_833 = " |= "; + protected final String TEXT_834 = "_EFLAG; else "; + protected final String TEXT_835 = " &= ~"; + protected final String TEXT_836 = "_EFLAG;"; + protected final String TEXT_837 = NL + "\t\t"; + protected final String TEXT_838 = " = "; + protected final String TEXT_839 = "_DEFAULT_;"; + protected final String TEXT_840 = NL + "\t\t"; + protected final String TEXT_841 = " &= ~"; + protected final String TEXT_842 = "_ESETFLAG;"; + protected final String TEXT_843 = NL + "\t\t"; + protected final String TEXT_844 = "_set_ = false;"; + protected final String TEXT_845 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, _INTERNAL_"; + protected final String TEXT_846 = ", "; + protected final String TEXT_847 = "isSetChange ? old"; + protected final String TEXT_848 = " : "; + protected final String TEXT_849 = "_DEFAULT_"; + protected final String TEXT_850 = "old"; + protected final String TEXT_851 = ", "; + protected final String TEXT_852 = "_DEFAULT_, "; + protected final String TEXT_853 = "isSetChange"; + protected final String TEXT_854 = "old"; + protected final String TEXT_855 = "_set_"; + protected final String TEXT_856 = ");"; + protected final String TEXT_857 = NL + " unset(get"; + protected final String TEXT_858 = "(), getType(), _INTERNAL_"; + protected final String TEXT_859 = ");"; + protected final String TEXT_860 = NL + " unset"; + protected final String TEXT_861 = "(get"; + protected final String TEXT_862 = "());"; + protected final String TEXT_863 = NL + "\t\t// TODO: implement this method to unset the '"; + protected final String TEXT_864 = "' "; + protected final String TEXT_865 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_866 = NL + "\t}" + NL; + protected final String TEXT_867 = NL + "\t/**" + NL + "\t * Returns whether the value of the '{@link "; + protected final String TEXT_868 = "#"; + protected final String TEXT_869 = " "; + protected final String TEXT_870 = "}' "; + protected final String TEXT_871 = " is set." + NL + "\t * " + NL + "\t * " + NL + "\t * @return whether the value of the '"; + protected final String TEXT_872 = "' "; + protected final String TEXT_873 = " is set."; + protected final String TEXT_874 = NL + "\t * @see #unset"; + protected final String TEXT_875 = "()"; + protected final String TEXT_876 = NL + "\t * @see #"; + protected final String TEXT_877 = "()"; + protected final String TEXT_878 = NL + "\t * @see #set"; + protected final String TEXT_879 = "("; + protected final String TEXT_880 = ")"; + protected final String TEXT_881 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_882 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_883 = NL + "\tboolean isSet"; + protected final String TEXT_884 = "();" + NL; + protected final String TEXT_885 = NL + "\tpublic boolean isSet"; + protected final String TEXT_886 = "()" + NL + "\t{"; + protected final String TEXT_887 = NL + "\t\treturn isSet("; + protected final String TEXT_888 = ");"; + protected final String TEXT_889 = NL + "\t\t"; + protected final String TEXT_890 = " "; + protected final String TEXT_891 = " = ("; + protected final String TEXT_892 = ")eVirtualGet("; + protected final String TEXT_893 = ");"; + protected final String TEXT_894 = NL + "\t\treturn "; + protected final String TEXT_895 = " != null && (("; + protected final String TEXT_896 = ".Unsettable)"; + protected final String TEXT_897 = ").isSet();"; + protected final String TEXT_898 = NL + "\t\treturn eVirtualIsSet("; + protected final String TEXT_899 = ");"; + protected final String TEXT_900 = NL + "\t\treturn ("; + protected final String TEXT_901 = " & "; + protected final String TEXT_902 = "_ESETFLAG) != 0;"; + protected final String TEXT_903 = NL + "\t\treturn "; + protected final String TEXT_904 = "_set_;"; + protected final String TEXT_905 = NL + " return isSet(get"; + protected final String TEXT_906 = "(), getType(), _INTERNAL_"; + protected final String TEXT_907 = ");"; + protected final String TEXT_908 = NL + "\t\treturn !(("; + protected final String TEXT_909 = ".Internal)get"; + protected final String TEXT_910 = "()).isEmpty("; + protected final String TEXT_911 = ");"; + protected final String TEXT_912 = NL + "\t\t// TODO: implement this method to return whether the '"; + protected final String TEXT_913 = "' "; + protected final String TEXT_914 = " is set" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_915 = NL + "\t}" + NL; + protected final String TEXT_916 = NL + "\t/**" + NL + "\t * " + NL + "\t * "; + protected final String TEXT_917 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_918 = NL + "\t * "; + protected final String TEXT_919 = NL + "\t * @model "; + protected final String TEXT_920 = NL + "\t * "; + protected final String TEXT_921 = NL + "\t * @model"; + protected final String TEXT_922 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_923 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_924 = NL + "\t"; + protected final String TEXT_925 = " "; + protected final String TEXT_926 = "("; + protected final String TEXT_927 = ")"; + protected final String TEXT_928 = ";" + NL; + protected final String TEXT_929 = NL + "\tpublic "; + protected final String TEXT_930 = " "; + protected final String TEXT_931 = "("; + protected final String TEXT_932 = ")"; + protected final String TEXT_933 = NL + "\t{"; + protected final String TEXT_934 = NL + "\t\t"; + protected final String TEXT_935 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// -> specify the condition that violates the invariant" + NL + "\t\t// -> verify the details of the diagnostic, including severity and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_936 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_937 = ".add" + NL + "\t\t\t\t\t(new "; + protected final String TEXT_938 = NL + "\t\t\t\t\t\t("; + protected final String TEXT_939 = ".ERROR," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_940 = ".DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_941 = "."; + protected final String TEXT_942 = "," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_943 = ".INSTANCE.getString(\"_UI_GenericInvariant_diagnostic\", new Object[] { \""; + protected final String TEXT_944 = "\", "; + protected final String TEXT_945 = ".getObjectLabel(this, "; + protected final String TEXT_946 = ") }),"; + protected final String TEXT_947 = NL + "\t\t\t\t\t\t new Object [] { this }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;"; + protected final String TEXT_948 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_949 = NL + "\t}" + NL; + protected final String TEXT_950 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eInverseAdd("; + protected final String TEXT_951 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_952 = NL + "\t\t\tcase "; + protected final String TEXT_953 = ":"; + protected final String TEXT_954 = NL + "\t\t\t\treturn (("; + protected final String TEXT_955 = ")(("; + protected final String TEXT_956 = ".InternalMapView)"; + protected final String TEXT_957 = "()).eMap()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_958 = NL + "\t\t\t\treturn (("; + protected final String TEXT_959 = ")"; + protected final String TEXT_960 = "()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_961 = NL + "\t\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\t\treturn eBasicSetContainer(otherEnd, "; + protected final String TEXT_962 = ", changeContext);"; + protected final String TEXT_963 = NL + "\t\t\t\t"; + protected final String TEXT_964 = " "; + protected final String TEXT_965 = " = ("; + protected final String TEXT_966 = ")eVirtualGet("; + protected final String TEXT_967 = ");"; + protected final String TEXT_968 = NL + "\t\t\t\tif ("; + protected final String TEXT_969 = " != null)"; + protected final String TEXT_970 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_971 = ")"; + protected final String TEXT_972 = ").eInverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_973 = ", null, changeContext);"; + protected final String TEXT_974 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_975 = ")"; + protected final String TEXT_976 = ").eInverseRemove(this, "; + protected final String TEXT_977 = ", "; + protected final String TEXT_978 = ".class, changeContext);"; + protected final String TEXT_979 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_980 = "(("; + protected final String TEXT_981 = ")otherEnd, changeContext);"; + protected final String TEXT_982 = NL + "\t\t}"; + protected final String TEXT_983 = NL + "\t\treturn super.eInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_984 = NL + "\t\treturn eDynamicInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_985 = NL + "\t}" + NL; + protected final String TEXT_986 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext inverseRemove("; + protected final String TEXT_987 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_988 = NL + "\t\t\tcase "; + protected final String TEXT_989 = ":"; + protected final String TEXT_990 = NL + "\t\t\t\treturn (("; + protected final String TEXT_991 = ")(("; + protected final String TEXT_992 = ".InternalMapView)"; + protected final String TEXT_993 = "()).eMap()).basicRemove(otherEnd, changeContext);"; + protected final String TEXT_994 = NL + "\t\t\t\treturn removeFrom"; + protected final String TEXT_995 = "("; + protected final String TEXT_996 = "(), otherEnd, changeContext);"; + protected final String TEXT_997 = NL + "\t\t\t\treturn removeFromList("; + protected final String TEXT_998 = "(), otherEnd, changeContext);"; + protected final String TEXT_999 = NL + "\t\t\t\treturn eBasicSetContainer(null, "; + protected final String TEXT_1000 = ", changeContext);"; + protected final String TEXT_1001 = NL + "\t\t\t\treturn basicUnset"; + protected final String TEXT_1002 = "(changeContext);"; + protected final String TEXT_1003 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_1004 = "(null, changeContext);"; + protected final String TEXT_1005 = NL + "\t\t}"; + protected final String TEXT_1006 = NL + "\t\treturn super.inverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_1007 = NL + "\t\treturn eDynamicInverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_1008 = NL + "\t}" + NL; + protected final String TEXT_1009 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (eContainerFeatureID)" + NL + "\t\t{"; + protected final String TEXT_1010 = NL + "\t\t\tcase "; + protected final String TEXT_1011 = ":" + NL + "\t\t\t\treturn eInternalContainer().eInverseRemove(this, "; + protected final String TEXT_1012 = ", "; + protected final String TEXT_1013 = ".class, changeContext);"; + protected final String TEXT_1014 = NL + "\t\t}"; + protected final String TEXT_1015 = NL + "\t\treturn super.eBasicRemoveFromContainerFeature(changeContext);"; + protected final String TEXT_1016 = NL + "\t\treturn eDynamicBasicRemoveFromContainer(changeContext);"; + protected final String TEXT_1017 = NL + "\t}" + NL; + protected final String TEXT_1018 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object get(int propertyIndex, boolean resolve)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1019 = NL + "\t\t\tcase "; + protected final String TEXT_1020 = ":"; + protected final String TEXT_1021 = NL + "\t\t\t\treturn "; + protected final String TEXT_1022 = "() ? Boolean.TRUE : Boolean.FALSE;"; + protected final String TEXT_1023 = NL + "\t\t\t\treturn new "; + protected final String TEXT_1024 = "("; + protected final String TEXT_1025 = "());"; + protected final String TEXT_1026 = NL + "\t\t\t\tif (resolve) return "; + protected final String TEXT_1027 = "();" + NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1028 = "();"; + protected final String TEXT_1029 = NL + "\t\t\t\tif (coreType) return (("; + protected final String TEXT_1030 = ".InternalMapView)"; + protected final String TEXT_1031 = "()).eMap();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1032 = "();"; + protected final String TEXT_1033 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1034 = "();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1035 = "().map();"; + protected final String TEXT_1036 = NL + "\t\t\t\t// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view" + NL + "\t\t\t\t//if (coreType) " + NL + "\t\t\t\treturn "; + protected final String TEXT_1037 = "();"; + protected final String TEXT_1038 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1039 = "();" + NL + "\t\t\t\treturn (("; + protected final String TEXT_1040 = ".Internal)"; + protected final String TEXT_1041 = "()).getWrapper();"; + protected final String TEXT_1042 = NL + "\t\t\t\treturn "; + protected final String TEXT_1043 = "();"; + protected final String TEXT_1044 = NL + "\t\t}"; + protected final String TEXT_1045 = NL + "\t\treturn super.get(propertyIndex, resolve);"; + protected final String TEXT_1046 = NL + "\t\treturn eDynamicGet(propertyIndex, resolve, coreType);"; + protected final String TEXT_1047 = NL + "\t}" + NL; + protected final String TEXT_1048 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void set(int propertyIndex, Object newValue)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1049 = NL + "\t\t\tcase "; + protected final String TEXT_1050 = ":"; + protected final String TEXT_1051 = NL + " \tset"; + protected final String TEXT_1052 = "("; + protected final String TEXT_1053 = "(), newValue);"; + protected final String TEXT_1054 = NL + "\t\t\t\t(("; + protected final String TEXT_1055 = ".Internal)"; + protected final String TEXT_1056 = "()).set(newValue);"; + protected final String TEXT_1057 = NL + "\t\t\t\t(("; + protected final String TEXT_1058 = ".Setting)(("; + protected final String TEXT_1059 = ".InternalMapView)"; + protected final String TEXT_1060 = "()).eMap()).set(newValue);"; + protected final String TEXT_1061 = NL + "\t\t\t\t(("; + protected final String TEXT_1062 = ".Setting)"; + protected final String TEXT_1063 = "()).set(newValue);"; + protected final String TEXT_1064 = NL + "\t\t\t\t"; + protected final String TEXT_1065 = "().clear();" + NL + "\t\t\t\t"; + protected final String TEXT_1066 = "().addAll(("; + protected final String TEXT_1067 = ")newValue);"; + protected final String TEXT_1068 = NL + "\t\t\t\tset"; + protected final String TEXT_1069 = "((("; + protected final String TEXT_1070 = ")newValue)."; + protected final String TEXT_1071 = "());"; + protected final String TEXT_1072 = NL + "\t\t\t\tset"; + protected final String TEXT_1073 = "(("; + protected final String TEXT_1074 = ")newValue);"; + protected final String TEXT_1075 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1076 = NL + "\t\t}"; + protected final String TEXT_1077 = NL + "\t\tsuper.set(propertyIndex, newValue);"; + protected final String TEXT_1078 = NL + "\t\teDynamicSet(propertyIndex, newValue);"; + protected final String TEXT_1079 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void unset(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1080 = NL + "\t\t\tcase "; + protected final String TEXT_1081 = ":"; + protected final String TEXT_1082 = NL + "\t\t\t\tunset"; + protected final String TEXT_1083 = "("; + protected final String TEXT_1084 = "());"; + protected final String TEXT_1085 = NL + "\t\t\t\t"; + protected final String TEXT_1086 = "().clear();"; + protected final String TEXT_1087 = NL + "\t\t\t\tunset"; + protected final String TEXT_1088 = "();"; + protected final String TEXT_1089 = NL + "\t\t\t\tset"; + protected final String TEXT_1090 = "(("; + protected final String TEXT_1091 = ")null);"; + protected final String TEXT_1092 = NL + "\t\t\t\tset"; + protected final String TEXT_1093 = "("; + protected final String TEXT_1094 = "_DEFAULT_);"; + protected final String TEXT_1095 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1096 = NL + "\t\t}"; + protected final String TEXT_1097 = NL + "\t\tsuper.unset(propertyIndex);"; + protected final String TEXT_1098 = NL + "\t\teDynamicUnset(propertyIndex);"; + protected final String TEXT_1099 = NL + "\t}" + NL; + protected final String TEXT_1100 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSet(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1101 = NL + "\t\t\tcase "; + protected final String TEXT_1102 = ":"; + protected final String TEXT_1103 = NL + "\t\t\t\treturn !is"; + protected final String TEXT_1104 = "Empty("; + protected final String TEXT_1105 = "());"; + protected final String TEXT_1106 = NL + "\t\t\t\treturn "; + protected final String TEXT_1107 = " != null && !is"; + protected final String TEXT_1108 = "Empty("; + protected final String TEXT_1109 = "());"; + protected final String TEXT_1110 = NL + "\t\t\t\treturn "; + protected final String TEXT_1111 = " != null && !"; + protected final String TEXT_1112 = ".isEmpty();"; + protected final String TEXT_1113 = NL + "\t\t\t\t"; + protected final String TEXT_1114 = " "; + protected final String TEXT_1115 = " = ("; + protected final String TEXT_1116 = ")eVirtualGet("; + protected final String TEXT_1117 = ");" + NL + "\t\t\t\treturn "; + protected final String TEXT_1118 = " != null && !"; + protected final String TEXT_1119 = ".isEmpty();"; + protected final String TEXT_1120 = NL + "\t\t\t\treturn !"; + protected final String TEXT_1121 = "().isEmpty();"; + protected final String TEXT_1122 = NL + "\t\t\t\treturn isSet"; + protected final String TEXT_1123 = "();"; + protected final String TEXT_1124 = NL + "\t\t\t\treturn "; + protected final String TEXT_1125 = " != null;"; + protected final String TEXT_1126 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1127 = ") != null;"; + protected final String TEXT_1128 = NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1129 = "() != null;"; + protected final String TEXT_1130 = NL + "\t\t\t\treturn "; + protected final String TEXT_1131 = " != null;"; + protected final String TEXT_1132 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1133 = ") != null;"; + protected final String TEXT_1134 = NL + "\t\t\t\treturn "; + protected final String TEXT_1135 = "() != null;"; + protected final String TEXT_1136 = NL + "\t\t\t\treturn (("; + protected final String TEXT_1137 = " & "; + protected final String TEXT_1138 = "_EFLAG) != 0) != "; + protected final String TEXT_1139 = "_DEFAULT_;"; + protected final String TEXT_1140 = NL + "\t\t\t\treturn "; + protected final String TEXT_1141 = " != "; + protected final String TEXT_1142 = "_DEFAULT_;"; + protected final String TEXT_1143 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1144 = ", "; + protected final String TEXT_1145 = "_DEFAULT_) != "; + protected final String TEXT_1146 = "_DEFAULT_;"; + protected final String TEXT_1147 = NL + "\t\t\t\treturn "; + protected final String TEXT_1148 = "() != "; + protected final String TEXT_1149 = "_DEFAULT_;"; + protected final String TEXT_1150 = NL + "\t\t\t\treturn "; + protected final String TEXT_1151 = "_DEFAULT_ == null ? "; + protected final String TEXT_1152 = " != null : !"; + protected final String TEXT_1153 = "_DEFAULT_.equals("; + protected final String TEXT_1154 = ");"; + protected final String TEXT_1155 = NL + "\t\t\t\t"; + protected final String TEXT_1156 = " "; + protected final String TEXT_1157 = " = ("; + protected final String TEXT_1158 = ")eVirtualGet("; + protected final String TEXT_1159 = ", "; + protected final String TEXT_1160 = "_DEFAULT_);" + NL + "\t\t\t\treturn "; + protected final String TEXT_1161 = "_DEFAULT_ == null ? "; + protected final String TEXT_1162 = " != null : !"; + protected final String TEXT_1163 = "_DEFAULT_.equals("; + protected final String TEXT_1164 = ");"; + protected final String TEXT_1165 = NL + "\t\t\t\treturn "; + protected final String TEXT_1166 = "_DEFAULT_ == null ? "; + protected final String TEXT_1167 = "() != null : !"; + protected final String TEXT_1168 = "_DEFAULT_.equals("; + protected final String TEXT_1169 = "());"; + protected final String TEXT_1170 = NL + "\t\t}"; + protected final String TEXT_1171 = NL + "\t\treturn super.isSet(propertyIndex);"; + protected final String TEXT_1172 = NL + "\t\treturn eDynamicIsSet(propertyIndex);"; + protected final String TEXT_1173 = NL + "\t}" + NL; + protected final String TEXT_1174 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1175 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1176 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (derivedFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1177 = NL + "\t\t\t\tcase "; + protected final String TEXT_1178 = ": return "; + protected final String TEXT_1179 = ";"; + protected final String TEXT_1180 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1181 = NL + "\t\treturn super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1182 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1183 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (baseFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1184 = NL + "\t\t\t\tcase "; + protected final String TEXT_1185 = ": return "; + protected final String TEXT_1186 = ";"; + protected final String TEXT_1187 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1188 = NL + "\t\treturn super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);" + NL + "\t}" + NL; + protected final String TEXT_1189 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Object[] eVirtualValues()" + NL + "\t{" + NL + "\t\treturn "; + protected final String TEXT_1190 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualValues(Object[] newValues)" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_1191 = " = newValues;" + NL + "\t}" + NL; + protected final String TEXT_1192 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int eVirtualIndexBits(int offset)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1193 = NL + "\t\t\tcase "; + protected final String TEXT_1194 = " :" + NL + "\t\t\t\treturn "; + protected final String TEXT_1195 = ";"; + protected final String TEXT_1196 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualIndexBits(int offset, int newIndexBits)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1197 = NL + "\t\t\tcase "; + protected final String TEXT_1198 = " :" + NL + "\t\t\t\t"; + protected final String TEXT_1199 = " = newIndexBits;" + NL + "\t\t\t\tbreak;"; + protected final String TEXT_1200 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_1201 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String toString()" + NL + "\t{" + NL + "\t\tif (isProxy(this)) return super.toString();" + NL + "" + NL + "\t\tStringBuffer result = new StringBuffer(super.toString());"; + protected final String TEXT_1202 = NL + "\t\tresult.append(\" ("; + protected final String TEXT_1203 = ": \");"; + protected final String TEXT_1204 = NL + "\t\tresult.append(\", "; + protected final String TEXT_1205 = ": \");"; + protected final String TEXT_1206 = NL + "\t\tif (eVirtualIsSet("; + protected final String TEXT_1207 = ")) result.append(eVirtualGet("; + protected final String TEXT_1208 = ")); else result.append(\"+ * The following features are supported: + *
+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'S' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'S' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'S' attribute list. + * @generated + */ + List getS(); + + /** + * Returns the value of the 'I' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'I' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'I' attribute list. + * @generated + */ + List getI(); + + /** + * Returns the value of the 'F' attribute list. + * The list contents are of type {@link java.lang.Float}. + * + *+ * If the meaning of the 'F' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'F' attribute list. + * @generated + */ + List getF(); + +} // RCType diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java new file mode 100644 index 0000000000..9a7c3033a5 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/RepchoiceFactory.java @@ -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 com.example.repchoice; + +import commonj.sdo.helper.HelperContext; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface RepchoiceFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + RepchoiceFactory INSTANCE = com.example.repchoice.impl.RepchoiceFactoryImpl.init(); + + /** + * Returns a new object of class 'RC Type'. + * + * + * @return a new object of class 'RC Type'. + * @generated + */ + RCType createRCType(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //RepchoiceFactory diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java new file mode 100644 index 0000000000..322dc5a8e0 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/repchoice/impl/RCTypeImpl.java @@ -0,0 +1,332 @@ +/** + * + * 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 com.example.repchoice.impl; + +import com.example.repchoice.RCType; +import com.example.repchoice.RepchoiceFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'RC Type'. + * + *+ * The following features are implemented: + *
+ * The following features are supported: + *
+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Symbol' attribute. + * + *+ * If the meaning of the 'Symbol' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #setSymbol(String) + * @generated + */ + String getSymbol(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute. + * + * + * @param value the new value of the 'Symbol' attribute. + * @see #isSetSymbol() + * @see #unsetSymbol() + * @see #getSymbol() + * @generated + */ + void setSymbol(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute. + * + * + * @see #isSetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + void unsetSymbol(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute is set. + * + * + * @return whether the value of the 'Symbol' attribute is set. + * @see #unsetSymbol() + * @see #getSymbol() + * @see #setSymbol(String) + * @generated + */ + boolean isSetSymbol(); + + /** + * Returns the value of the 'Company Name' attribute. + * + *+ * If the meaning of the 'Company Name' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #setCompanyName(String) + * @generated + */ + String getCompanyName(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute. + * + * + * @param value the new value of the 'Company Name' attribute. + * @see #isSetCompanyName() + * @see #unsetCompanyName() + * @see #getCompanyName() + * @generated + */ + void setCompanyName(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute. + * + * + * @see #isSetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + void unsetCompanyName(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute is set. + * + * + * @return whether the value of the 'Company Name' attribute is set. + * @see #unsetCompanyName() + * @see #getCompanyName() + * @see #setCompanyName(String) + * @generated + */ + boolean isSetCompanyName(); + + /** + * Returns the value of the 'Price' attribute. + * + *+ * If the meaning of the 'Price' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + BigDecimal getPrice(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute. + * + * + * @param value the new value of the 'Price' attribute. + * @see #isSetPrice() + * @see #unsetPrice() + * @see #getPrice() + * @generated + */ + void setPrice(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute. + * + * + * @see #isSetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + void unsetPrice(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute is set. + * + * + * @return whether the value of the 'Price' attribute is set. + * @see #unsetPrice() + * @see #getPrice() + * @see #setPrice(BigDecimal) + * @generated + */ + boolean isSetPrice(); + + /** + * Returns the value of the 'Open1' attribute. + * + *+ * If the meaning of the 'Open1' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + BigDecimal getOpen1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute. + * + * + * @param value the new value of the 'Open1' attribute. + * @see #isSetOpen1() + * @see #unsetOpen1() + * @see #getOpen1() + * @generated + */ + void setOpen1(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute. + * + * + * @see #isSetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + void unsetOpen1(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute is set. + * + * + * @return whether the value of the 'Open1' attribute is set. + * @see #unsetOpen1() + * @see #getOpen1() + * @see #setOpen1(BigDecimal) + * @generated + */ + boolean isSetOpen1(); + + /** + * Returns the value of the 'High' attribute. + * + *+ * If the meaning of the 'High' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + BigDecimal getHigh(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute. + * + * + * @param value the new value of the 'High' attribute. + * @see #isSetHigh() + * @see #unsetHigh() + * @see #getHigh() + * @generated + */ + void setHigh(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute. + * + * + * @see #isSetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + void unsetHigh(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute is set. + * + * + * @return whether the value of the 'High' attribute is set. + * @see #unsetHigh() + * @see #getHigh() + * @see #setHigh(BigDecimal) + * @generated + */ + boolean isSetHigh(); + + /** + * Returns the value of the 'Low' attribute. + * + *+ * If the meaning of the 'Low' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #setLow(BigDecimal) + * @generated + */ + BigDecimal getLow(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute. + * + * + * @param value the new value of the 'Low' attribute. + * @see #isSetLow() + * @see #unsetLow() + * @see #getLow() + * @generated + */ + void setLow(BigDecimal value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute. + * + * + * @see #isSetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + void unsetLow(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute is set. + * + * + * @return whether the value of the 'Low' attribute is set. + * @see #unsetLow() + * @see #getLow() + * @see #setLow(BigDecimal) + * @generated + */ + boolean isSetLow(); + + /** + * Returns the value of the 'Volume' attribute. + * + *+ * If the meaning of the 'Volume' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #setVolume(double) + * @generated + */ + double getVolume(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @param value the new value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #getVolume() + * @generated + */ + void setVolume(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @see #isSetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + void unsetVolume(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute is set. + * + * + * @return whether the value of the 'Volume' attribute is set. + * @see #unsetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + boolean isSetVolume(); + + /** + * Returns the value of the 'Change1' attribute. + * + *+ * If the meaning of the 'Change1' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #setChange1(double) + * @generated + */ + double getChange1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @param value the new value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #getChange1() + * @generated + */ + void setChange1(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @see #isSetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + void unsetChange1(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute is set. + * + * + * @return whether the value of the 'Change1' attribute is set. + * @see #unsetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + boolean isSetChange1(); + + /** + * Returns the value of the 'Quotes' containment reference list. + * The list contents are of type {@link com.example.sequences.MixedQuote}. + * + *+ * If the meaning of the 'Quotes' containment reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Quotes' containment reference list. + * @generated + */ + List getQuotes(); + +} // MixedQuote diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java new file mode 100644 index 0000000000..dba64b0487 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java @@ -0,0 +1,102 @@ +/** + * + * 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 com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Mixed Repeating Choice'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // MixedRepeatingChoice diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/RepeatingChoice.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/RepeatingChoice.java new file mode 100644 index 0000000000..3f0b0839f2 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/RepeatingChoice.java @@ -0,0 +1,88 @@ +/** + * + * 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 com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Repeating Choice'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // RepeatingChoice diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/SequencesFactory.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/SequencesFactory.java new file mode 100644 index 0000000000..900b51ddc3 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/SequencesFactory.java @@ -0,0 +1,97 @@ +/** + * + * 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 com.example.sequences; + +import commonj.sdo.helper.HelperContext; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface SequencesFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SequencesFactory INSTANCE = com.example.sequences.impl.SequencesFactoryImpl.init(); + + /** + * Returns a new object of class 'Mixed Quote'. + * + * + * @return a new object of class 'Mixed Quote'. + * @generated + */ + MixedQuote createMixedQuote(); + + /** + * Returns a new object of class 'Mixed Repeating Choice'. + * + * + * @return a new object of class 'Mixed Repeating Choice'. + * @generated + */ + MixedRepeatingChoice createMixedRepeatingChoice(); + + /** + * Returns a new object of class 'Repeating Choice'. + * + * + * @return a new object of class 'Repeating Choice'. + * @generated + */ + RepeatingChoice createRepeatingChoice(); + + /** + * Returns a new object of class 'Two RCs'. + * + * + * @return a new object of class 'Two RCs'. + * @generated + */ + TwoRCs createTwoRCs(); + + /** + * Returns a new object of class 'Two RCs Mixed'. + * + * + * @return a new object of class 'Two RCs Mixed'. + * @generated + */ + TwoRCsMixed createTwoRCsMixed(); + + /** + * Registers the types supported by this Factory within the supplied scope.argument + * + * + * @param scope an instance of HelperContext used to manage the scoping of types. + * @generated + */ + public void register(HelperContext scope); + +} //SequencesFactory diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCs.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCs.java new file mode 100644 index 0000000000..c6e54e6598 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCs.java @@ -0,0 +1,184 @@ +/** + * + * 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 com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *+ * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute. + * + * + * @see #isSetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + void unsetSplit(); + + /** + * Returns whether the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute is set. + * + * + * @return whether the value of the 'Split' attribute is set. + * @see #unsetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + boolean isSetSplit(); + + /** + * Returns the value of the 'Group1' attribute list. + * + *+ * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCs diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCsMixed.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCsMixed.java new file mode 100644 index 0000000000..90d5f942b6 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/TwoRCsMixed.java @@ -0,0 +1,198 @@ +/** + * + * 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 com.example.sequences; + +import commonj.sdo.Sequence; + +import java.io.Serializable; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs Mixed'. + * + * + *+ * The following features are supported: + *
+ * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *+ * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *+ * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #isSetSplit() + * @see #unsetSplit() + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Unsets the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute. + * + * + * @see #isSetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + void unsetSplit(); + + /** + * Returns whether the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute is set. + * + * + * @return whether the value of the 'Split' attribute is set. + * @see #unsetSplit() + * @see #getSplit() + * @see #setSplit(String) + * @generated + */ + boolean isSetSplit(); + + /** + * Returns the value of the 'Group1' attribute list. + * + *+ * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *+ * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *+ * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCsMixed diff --git a/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java new file mode 100644 index 0000000000..96fe832ef3 --- /dev/null +++ b/sdo-java/branches/emf-2.5/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java @@ -0,0 +1,766 @@ +/** + * + * 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 com.example.sequences.impl; + +import com.example.sequences.MixedQuote; +import com.example.sequences.SequencesFactory; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import java.math.BigDecimal; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +/** + * + * An implementation of the model object 'Mixed Quote'. + * + *+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are implemented: + *
+ * The following features are supported: + *
+<%if (!genClass.getImplementedGenFeatures().isEmpty()) {%> + * The following features are implemented: + *
<%=genFeature.getDefaultValue()%>
.
+ <%}%>
+ <%if (genFeature.getTypeGenEnum() != null) {%>
+ * The literals are from the enumeration {@link <%=genFeature.getTypeGenEnum().getQualifiedName()%>}.
+ <%}%>
+ <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %>
+ <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%>
+ * It is bidirectional and its opposite is '{@link <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> <%=reverseGenFeature.getFormattedName()%>}'.
+ <%}%>
+ <%}%>
+ *
+ <%if (!genFeature.hasDocumentation()) {%>
+ * + * If the meaning of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> isn't clear, + * there really should be more of a description here... + *
+ <%}%> + * + <%if (genFeature.hasDocumentation()) {%> + * + * <%=genFeature.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + * @return the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.getTypeGenEnum() != null) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + <%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#get<%=genFeature.getFeatureAccessorName()%>() + <%}%> + <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %> + <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%> + * @see <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> + <%}%> + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genFeature.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>(); + +<%} else {%> + public <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>() + { +<%@ include file="Class/getGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isReflectiveDelegation()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(<%=genFeature.getQualifiedFeatureAccessor()%>, true)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> == null) + { + <%if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%> = new <%=genClass.getListConstructor(genFeature)%>); + <%} else { + if (genFeature.getType().equals("commonj.sdo.Sequence")){%> + <%=genFeature.getSafeName()%> = createSequence(_INTERNAL_<%=genFeature.getUpperName()%>);<%} else {%> + <%=genFeature.getSafeName()%> = createPropertyList(<%=SDOGenUtil.getListKind(genFeature, genFeature.isUnsettable())%>, <%=genFeature.getListItemType()%>.class, <%=genFeature.getUpperName()%>, <%=genFeature.isBidirectional()?genFeature.getReverse().getUpperName():"0" %>);<%}}%> + } + return <%=genFeature.getSafeName()%><%=genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes() ? ".map()" : ""%>; + <%} else if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eContainer(); + <%} else {%> + <%if (genFeature.isResolveProxies()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null && isProxy(<%=genFeature.getSafeName()%>)) + { + Object old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = <%=genFeature.getNonEObjectInternalTypeCast()%>resolveProxy(old<%=genFeature.getCapName()%>); + if (<%=genFeature.getSafeName()%> != old<%=genFeature.getCapName()%>) + { + <%if (genFeature.isEffectiveContains()) {%> + <%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> new<%=genFeature.getCapName()%> = (<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>; + <%if (!genFeature.isBidirectional()) {%> + ChangeContext changeContext = old<%=genFeature.getCapName()%>.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, null); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%=genModel.getImportedName("org.eclipse.emf.common.notify.ChangeContext")%> changeContext = old<%=genFeature.getCapName()%>.eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, null); + <%}%> + if (new<%=genFeature.getCapName()%>.eInternalContainer() == null) + { + <%if (!genFeature.isBidirectional()) {%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + } + if (changeContext != null) dispatch(changeContext); + <%} else if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.RESOLVE, _INTERNAL_<%=genFeature.getUpperName()%>, old<%=genFeature.getCapName()%>, <%=genFeature.getSafeName()%>); + <%}%> + } + } + <%}%> + <%if (!genFeature.isResolveProxies() && genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%} else if (genClass.isFlag(genFeature)) {%> + return (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%} else {//volatile%> + <%if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = basicGet<%=genFeature.getAccessorName()%>(); + return <%=genFeature.getSafeName()%> != null && <%=genFeature.getSafeName()%>.isProxy() ? <%=genFeature.getNonEObjectInternalTypeCast()%>eResolveProxy((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>) : <%=genFeature.getSafeName()%>; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // AAAA%> + <%if (genFeature.isFeatureMapType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return create<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else if (genFeature.isListType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return get<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%}%> + <%}%> + <%} else {%> +<%@ include file="Class/getGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/getGenFeature.todo.override.javajetinc%> + <%}%> + <%}%> + } +<%}%> +<%@ end %><%//Class/getGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicGet()) {%> +<%@ include file="Class/basicGetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public <%=genFeature.getImportedType()%> basicGet<%=genFeature.getAccessorName()%>() + { +<%@ include file="Class/basicGetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eInternalContainer(); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //BBBB%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return (<%=genFeature.getImportedType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genFeature.getImportedType()%>)get<%=delegateFeature.getAccessorName()%>().get(<%=genFeature.getQualifiedFeatureAccessor()%>, false); + <%}%> + <%} else {%> +<%@ include file="Class/basicGetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> do not perform proxy resolution + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicGetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicGetGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicSet()) {%> +<%@ include file="Class/basicSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedInternalType()%> new<%=genFeature.getCapName()%>, ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> +<%@ include file="Class/basicSetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%>; + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%if (genFeature.isUnsettable()) {%> + addNotification(this, ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>, changeContext); + <%} else {%> + addNotification(this, ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>, changeContext); + <%}%> + } + <%}%> +<%@ include file="Class/basicSetGenFeature.post.insert.javajetinc" fail="silent" %> + return changeContext; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //CCCC%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return basicAdd(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, changeContext); + <%} else {%> + return basicAdd(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, changeContext); + <%}%> + <%} else {%> +<%@ include file="Class/basicSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicSetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isSet() && (isImplementation || !genFeature.isSuppressedSetVisibility())) {%> +<%@ include file="Class/setGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) { %> + /** + * Sets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @param value the new value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.isEnumType()) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (!genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) { %> + void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> value); + +<%} else {%> + public void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> new<%=genFeature.getCapName()%>) + { +<%@ include file="Class/setGenFeature.pre.insert.javajetinc" fail="alternative" %> + <%if (genModel.isReflectiveDelegation()) {%> + _set_(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()) {%>)<%}%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isContainer()) { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + if (new<%=genFeature.getCapName()%> != eInternalContainer() || (eContainerFeatureID != <%=genFeature.getUpperName()%> && new<%=genFeature.getCapName()%> != null)) + { + if (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")%>.isAncestor(this, <%=genFeature.getEObjectCast()%>new<%=genFeature.getCapName()%>)) + throw new <%=genModel.getImportedName("java.lang.IllegalArgumentException")%>("Recursive containment not allowed for " + toString());<%=genModel.getNonNLS()%> + ChangeContext changeContext = null; + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>).eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + changeContext = eBasicSetContainer((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>, <%=genFeature.getUpperName()%>, changeContext); + if (changeContext != null) dispatch(changeContext); + } + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (new<%=genFeature.getCapName()%> != <%=genFeature.getSafeName()%>) + { + ChangeContext changeContext = null; + if (<%=genFeature.getSafeName()%> != null) + <%if (!genFeature.isBidirectional()) {%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, OPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = inverseAdd(new<%=genFeature.getCapName()%>, this, OPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = inverseAdd(new<%=genFeature.getCapName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>, changeContext); + if (changeContext != null) dispatch(changeContext); + } + <%if (genFeature.isUnsettable()) {%> + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>, !old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + if (new<%=genFeature.getCapName()%>) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else {%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genFeature.isEnumType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%}%> + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>); + <%}%> + <%}%> + <%}%> +<%@ include file="Class/setGenFeature.post.insert.javajetinc" fail="silent" %> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); // DDDD%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + set(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genFeature.isPrimitiveType()){%> new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).set(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%}%> + <%} else {%> +<%@ include file="Class/setGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/setGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/setGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicUnset()) {%> +<%@ include file="Class/basicUnsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicUnset<%=genFeature.getAccessorName()%>(ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = null; + <%}%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%if (genFeature.isUnsettable()) {%> + addNotification(this, ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>, changeContext); + <%} else {%> + addNotification(this, ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, null, changeContext); + <%}%> + } + <%}%> + return changeContext; + <%} else {%> +<%@ include file="Class/basicUnsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicUnsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class.basicUnsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isUnset() && (isImplementation || !genFeature.isSuppressedUnsetVisibility())) {%> +<%@ include file="Class/unsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Unsets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + void unset<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public void unset<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + unset(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)get<%=genFeature.getAccessorName()%>()).unset(); + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + { + ChangeContext changeContext = null; + <%if (!genFeature.isBidirectional()) {%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, EOPPOSITE_FEATURE_BASE - _INTERNAL_<%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = inverseRemove(<%=genFeature.getSafeName()%>, this, <%=SDOGenUtil.getQualifiedInternalPropertyID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicUnset<%=genFeature.getAccessorName()%>(changeContext); + if (changeContext != null) dispatch(changeContext); + } + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, null, null, old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + <%} else if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%if (genFeature.isReferenceType()) {%> + <%=genFeature.getSafeName()%> = null; + <%if (!genModel.isVirtualDelegation()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? old<%=genFeature.getCapName()%> : null<%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + if (<%=genFeature.getUpperName()%>_DEFAULT_) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, _INTERNAL_<%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? old<%=genFeature.getCapName()%> : <%=genFeature.getUpperName()%>_DEFAULT_<%} else {%>old<%=genFeature.getCapName()%><%}%>, <%=genFeature.getUpperName()%>_DEFAULT_, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //EEEE%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + unset(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + unset<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>()); + <%}%> + <%} else {%> +<%@ include file="Class/unsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/unsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/unsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isIsSet() && (isImplementation || !genFeature.isSuppressedIsSetVisibility())) {%> +<%@ include file="Class/isSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Returns whether the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%> is set. + * + * + * @return whether the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set. + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && genFeature.isChangeable() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + boolean isSet<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public boolean isSet<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + return isSet(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + return <%=genFeature.getSafeName()%> != null && ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)<%=genFeature.getSafeName()%>).isSet(); + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + return (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + return <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); //FFFF%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return isSet(get<%=delegateFeature.getAccessorName()%>(), getType(), _INTERNAL_<%=genFeature.getUpperName()%>); + <%} else {%> + return !((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).isEmpty(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> +<%@ include file="Class/isSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return whether the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/isSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/isSetGenFeature.override.javajetinc%> + <%}%> +<%@ include file="Class/genFeature.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/genFeature.override.javajetinc%> +<%}// end output getter and setter interfaces or impls%> +<%for (Iterator i= (isImplementation ? genClass.getImplementedGenOperations() : genClass.getDeclaredGenOperations()).iterator(); i.hasNext();) { GenOperation genOperation = (GenOperation)i.next();%> +<%@ include file="Class/genOperation.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * + * + <%if (genOperation.hasDocumentation()) {%> + * + * <%=genOperation.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genOperation.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%>; + +<%} else {%> + public <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%> + { + <%if (genOperation.hasBody()) {%> + <%=genOperation.getBody(genModel.getIndentation(stringBuffer))%> + <%} else if (genOperation.isInvariant()) {GenClass opClass = genOperation.getGenClass(); String diagnostics = ((GenParameter)genOperation.getGenParameters().get(0)).getName(); String context = ((GenParameter)genOperation.getGenParameters().get(1)).getName();%> + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) + { + if (<%=diagnostics%> != null) + { + <%=diagnostics%>.add + (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%> + (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.DIAGNOSTIC_SOURCE, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.<%=opClass.getOperationID(genOperation)%>, + <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "<%=genOperation.getName()%>", <%=genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")%>.getObjectLabel(this, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + new Object [] { this })); + } + return false; + } + return true; + <%} else {%> +<%@ include file="Class/implementedGenOperation.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/implementedGenOperation.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/implementedGenOperation.override.javajetinc%> +<%}//for%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseAddGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eInverseAdd(<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseAddGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicAdd(otherEnd, changeContext); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)<%=genFeature.getGetAccessor()%>()).basicAdd(otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + return eBasicSetContainer(otherEnd, <%=genFeature.getUpperName()%>, changeContext); + <%} else {%> + <%if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + <%if (genFeature.isEffectiveContains()) {%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + return basicSet<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)otherEnd, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eInverseAdd(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseAdd(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseRemoveGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(<%=genModel.getImportedName("java.lang.Object")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseRemoveGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicRemove(otherEnd, changeContext); + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + return removeFrom<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%} else {%> + return removeFromList(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + return eBasicSetContainer(null, <%=genFeature.getUpperName()%>, changeContext); + <%} else if (genFeature.isUnsettable()) {%> + return basicUnset<%=genFeature.getAccessorName()%>(changeContext); + <%} else {%> + return basicSet<%=genFeature.getAccessorName()%>(null, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.inverseRemove(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseRemove(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEBasicRemoveFromContainerGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext) + { + switch (eContainerFeatureID) + { +<%for (Iterator i=genClass.getEBasicRemoveFromContainerGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + return eInternalContainer().eInverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eBasicRemoveFromContainerFeature(changeContext); +<%} else {%> + return eDynamicBasicRemoveFromContainer(changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isPrimitiveType()) {%> + <%if (genFeature.isBooleanType()) {%> + return <%=genFeature.getGetAccessor()%>() ? Boolean.TRUE : Boolean.FALSE; + <%} else {%> + return new <%=genFeature.getObjectType()%>(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + if (resolve) return <%=genFeature.getGetAccessor()%>(); + return basicGet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + if (coreType) return ((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap(); + else return <%=genFeature.getGetAccessor()%>(); + <%} else {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + else return <%=genFeature.getGetAccessor()%>().map(); + <%}%> + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + // 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 <%=genFeature.getGetAccessor()%>(); + <%} else if (genFeature.isFeatureMapType()) {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).getWrapper(); + <%} else {%> + return <%=genFeature.getGetAccessor()%>(); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.get(propertyIndex, resolve); +<%} else {%> + return eDynamicGet(propertyIndex, resolve, coreType); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getESetGenFeatures())) {%> + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + set<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), newValue); + <%} else if (genFeature.isFeatureMapType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).set(newValue); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%}%> + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%=genFeature.getGetAccessor()%>().addAll((<%=genModel.getImportedName("java.util.Collection")%>)newValue); + <%}%> + <%} else if (genFeature.isPrimitiveType()) {%> + set<%=genFeature.getAccessorName()%>(((<%=genFeature.getObjectType()%>)newValue).<%=genFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)newValue); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.set(propertyIndex, newValue); +<%} else {%> + eDynamicSet(propertyIndex, newValue); +<%}%> + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + unset<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + unset<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isReferenceType()) {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)null); + <%} else {%> + set<%=genFeature.getAccessorName()%>(<%=genFeature.getUpperName()%>_DEFAULT_); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.unset(propertyIndex); +<%} else {%> + eDynamicUnset(propertyIndex); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> +<%@ include file="Class/eIsSet.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + <%if (genFeature.isVolatile()) {%> + return !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + return <%=genFeature.getSafeName()%> != null && !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + return !<%=genFeature.getGetAccessor()%>().isEmpty(); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + return isSet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isResolveProxies()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return basicGet<%=genFeature.getAccessorName()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isReferenceType()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isPrimitiveType() || genFeature.isEnumType()) {%> + <%if (genClass.isField(genFeature)) {%> + <%if (genClass.isFlag(genFeature)) {%> + return ((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getSafeName()%> != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%} else {%> + <%if (genFeature.isEnumType() && genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%}%> + <%} else {//datatype%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_); + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getGetAccessor()%>() != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%}%> + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.isSet(propertyIndex); +<%} else {%> + return eDynamicIsSet(propertyIndex); +<%}%> + } + +<%@ end %><%//Class/eIsSet.override.javajetinc%> +<%}%> +<%if (isImplementation && !genClass.getMixinGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (derivedFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=genFeature.getUpperName()%>: return <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (baseFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>: return <%=genFeature.getUpperName()%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + +<%}%> +<%if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField();%> + <%if (eVirtualValuesField != null) {%> + /** + * + * + * @generated + */ + protected Object[] eVirtualValues() + { + return <%=eVirtualValuesField%>; + } + + /** + * + * + * @generated + */ + protected void setVirtualValues(Object[] newValues) + { + <%=eVirtualValuesField%> = newValues; + } + + <%}%> + <%{ List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList());%> + <%if (!eVirtualIndexBitFields.isEmpty()) { List allEVirtualIndexBitFields = genClass.getAllEVirtualIndexBitFields(new ArrayList());%> + /** + * + * + * @generated + */ + protected int eVirtualIndexBits(int offset) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + return <%=allEVirtualIndexBitFields.get(i)%>; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + /** + * + * + * @generated + */ + protected void setVirtualIndexBits(int offset, int newIndexBits) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + <%=allEVirtualIndexBitFields.get(i)%> = newIndexBits; + break; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + <%}%> + <%}%> +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getToStringGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy(this)) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + <%{ boolean first = true;%> + <%for (Iterator i=genClass.getToStringGenFeatures().iterator(); i.hasNext(); ) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (first) { first = false;%> + result.append(" (<%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%} else {%> + result.append(", <%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%}%> + <%if (genFeature.isUnsettable() && !genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + if (eVirtualIsSet(<%=genFeature.getUpperName()%>)) result.append(eVirtualGet(<%=genFeature.getUpperName()%>)); else result.append("