You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2006/12/14 15:31:10 UTC
svn commit: r487222 - in /incubator/tuscany/java/sdo/impl/src:
main/java/org/apache/tuscany/sdo/model/impl/
main/java/org/apache/tuscany/sdo/util/ main/resources/xml/
test/java/org/apache/tuscany/sdo/test/
Author: kelvingoodson
Date: Thu Dec 14 06:31:09 2006
New Revision: 487222
URL: http://svn.apache.org/viewvc?view=rev&rev=487222
Log:
TUSCANY-933 apply patch for david adcox
Added:
incubator/tuscany/java/sdo/impl/src/main/resources/xml/
incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd (with props)
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTestCase.java
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java?view=diff&rev=487222&r1=487221&r2=487222
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java Thu Dec 14 06:31:09 2006
@@ -42,12 +42,12 @@
* setOpposite() to setOpposite_();
* 3. Change the value of the NAMESPACE_PREFIX to "sdo"
* public static final String NAMESPACE_PREFIX = "sdo"; //FB generated as "commonj"
- * 4. Copy the following method from the old to new generated Type/TypeImpl interface and implemention class:
+ * 4. Copy the following method from the old to new generated Type/TypeImpl interface and implemention class (resolve any missing imports):
* String getInstanceClassName();
- * 5. Copy the following method from the old to new generated Types/TypesImpl interface and implemention class:
+ * 5. Copy the following method from the old to new generated Types/TypesImpl interface and implemention class (resolve any missing imports):
* List getTypeList();
* 6. Delete all the createXXXFromString() and convertXXXToString() methods in the newly generated ModelFactoryImpl and
- * replace them with the ones from this file.
+ * replace them with the ones from this file (resolve any missing imports).
* 7. Move this JavaDoc comment into the newly generated ModelFactoryImpl class.
* <!-- end-user-doc -->
* @generated
@@ -69,7 +69,7 @@
* <!-- end-user-doc -->
* @generated
*/
- public static final String NAMESPACE_PREFIX = "sdo"; //FB generated as "commonj"
+ public static final String NAMESPACE_PREFIX = "sdo"; //FB generated as "commonj"
public static final int BASE_DATA_GRAPH_TYPE = 1;
public static final int DATA_GRAPH_TYPE = 2;
public static final int DATA_OBJECT = 3;
@@ -79,40 +79,41 @@
public static final int TYPE = 7;
public static final int TYPES = 8;
public static final int XSD_TYPE = 9;
- public static final int BOOLEAN = 10;
- public static final int BOOLEAN_OBJECT = 11;
- public static final int BYTE = 12;
- public static final int BYTE_OBJECT = 13;
- public static final int BYTES = 14;
- public static final int CHANGE_SUMMARY_TYPE = 15;
- public static final int CHARACTER = 16;
- public static final int CHARACTER_OBJECT = 17;
- public static final int DATE = 18;
- public static final int DATE_TIME = 19;
- public static final int DAY = 20;
- public static final int DECIMAL = 21;
- public static final int DOUBLE = 22;
- public static final int DOUBLE_OBJECT = 23;
- public static final int DURATION = 24;
- public static final int FLOAT = 25;
- public static final int FLOAT_OBJECT = 26;
- public static final int INT = 27;
- public static final int INTEGER = 28;
- public static final int INT_OBJECT = 29;
- public static final int LONG = 30;
- public static final int LONG_OBJECT = 31;
- public static final int MONTH = 32;
- public static final int MONTH_DAY = 33;
- public static final int OBJECT = 34;
- public static final int SHORT = 35;
- public static final int SHORT_OBJECT = 36;
- public static final int STRING = 37;
- public static final int STRINGS = 38;
- public static final int TIME = 39;
- public static final int URI = 40;
- public static final int YEAR = 41;
- public static final int YEAR_MONTH = 42;
- public static final int YEAR_MONTH_DAY = 43;
+ public static final int BASE64_BYTES = 10;
+ public static final int BOOLEAN = 11;
+ public static final int BOOLEAN_OBJECT = 12;
+ public static final int BYTE = 13;
+ public static final int BYTE_OBJECT = 14;
+ public static final int BYTES = 15;
+ public static final int CHANGE_SUMMARY_TYPE = 16;
+ public static final int CHARACTER = 17;
+ public static final int CHARACTER_OBJECT = 18;
+ public static final int DATE = 19;
+ public static final int DATE_TIME = 20;
+ public static final int DAY = 21;
+ public static final int DECIMAL = 22;
+ public static final int DOUBLE = 23;
+ public static final int DOUBLE_OBJECT = 24;
+ public static final int DURATION = 25;
+ public static final int FLOAT = 26;
+ public static final int FLOAT_OBJECT = 27;
+ public static final int INT = 28;
+ public static final int INTEGER = 29;
+ public static final int INT_OBJECT = 30;
+ public static final int LONG = 31;
+ public static final int LONG_OBJECT = 32;
+ public static final int MONTH = 33;
+ public static final int MONTH_DAY = 34;
+ public static final int OBJECT = 35;
+ public static final int SHORT = 36;
+ public static final int SHORT_OBJECT = 37;
+ public static final int STRING = 38;
+ public static final int STRINGS = 39;
+ public static final int TIME = 40;
+ public static final int URI = 41;
+ public static final int YEAR = 42;
+ public static final int YEAR_MONTH = 43;
+ public static final int YEAR_MONTH_DAY = 44;
/**
* Creates an instance of the factory.
@@ -154,6 +155,8 @@
{
switch (typeNumber)
{
+ case BASE64_BYTES:
+ return createBase64BytesFromString(initialValue);
case BOOLEAN:
return createBooleanFromString(initialValue);
case BOOLEAN_OBJECT:
@@ -236,6 +239,8 @@
{
switch (typeNumber)
{
+ case BASE64_BYTES:
+ return convertBase64BytesToString(instanceValue);
case BOOLEAN:
return convertBooleanToString(instanceValue);
case BOOLEAN_OBJECT:
@@ -433,6 +438,13 @@
return xsdTypeType;
}
+ protected commonj.sdo.Type base64BytesType = null;
+
+ public commonj.sdo.Type getBase64Bytes()
+ {
+ return base64BytesType;
+ }
+
protected commonj.sdo.Type boolean_Type = null;
public commonj.sdo.Type getBoolean()
@@ -754,6 +766,7 @@
createProperty(true, xsdTypeType, XSDTypeImpl.ANY);
// Create data types
+ base64BytesType = createType(true, BASE64_BYTES );
boolean_Type = createType(true, BOOLEAN );
booleanObjectType = createType(true, BOOLEAN_OBJECT );
byte_Type = createType(true, BYTE );
@@ -887,6 +900,9 @@
initializeProperty(property, getSequence(), "any", null, 0, -1, XSDType.class, false, false, false);
// Initialize data types
+ initializeType(base64BytesType, byte[].class, "Base64Bytes", true, false);
+ setInstanceProperty (base64BytesType, "commonj.sdo/java", "instanceClass", "byte[]");
+
initializeType(boolean_Type, boolean.class, "Boolean", true, false);
setInstanceProperty (boolean_Type, "commonj.sdo/java", "instanceClass", "boolean");
@@ -1395,6 +1411,13 @@
});
addXSDMapping
+ (base64BytesType,
+ new String[]
+ {
+ "name", "Base64Bytes"
+ });
+
+ addXSDMapping
(boolean_Type,
new String[]
{
@@ -1642,6 +1665,33 @@
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public byte[] createBase64BytesFromString(String initialValue)
+ {
+ return XMLTypeFactory.eINSTANCE.createBase64Binary(initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String convertBase64BytesToString(Object instanceValue)
+ {
+ if (instanceValue instanceof byte[])
+ {
+ return XMLTypeFactory.eINSTANCE.convertBase64Binary((byte[])instanceValue);
+ }
+ else
+ {
+ return XMLTypeFactory.eINSTANCE.convertBase64Binary(instanceValue.toString().getBytes());
+ }
+ }
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java?view=diff&rev=487222&r1=487221&r2=487222
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java Thu Dec 14 06:31:09 2006
@@ -665,9 +665,7 @@
xsdToSdoMappings.put("anySimpleType", "Object");
xsdToSdoMappings.put("anyType", "DataObject");
xsdToSdoMappings.put("anyURI", "URI");
- // SDO Spec issue: both base64Binary and hexBinary are mapped to Bytes. Workaround is to let base64Binary
- // fall through to use EMF's default: XMLTypePackage.base64Binary
- // xsdToSdoMappings.put("base64Binary", "Bytes");
+ xsdToSdoMappings.put("base64Binary", "Base64Bytes");
xsdToSdoMappings.put("boolean", "Boolean");
xsdToSdoMappings.put("byte", "Byte");
xsdToSdoMappings.put("date", "YearMonthDay");
Added: incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd?view=auto&rev=487222
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd (added)
+++ incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd Thu Dec 14 06:31:09 2006
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * 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.
+ -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:sdoXML="commonj.sdo/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified" targetNamespace="commonj.sdo" xsi:schemaLocation="commonj.sdo/xml sdoXML.xsd commonj.sdo/java sdoJava.xsd">
+
+<xsd:include schemaLocation="c:/sdosrc/tuscany/java/spec/sdo-api/src/main/resources/xml/sdoModel.xsd"/>
+
+<!-- Data Types -->
+<xsd:simpleType name="Base64Bytes" sdoJava:instanceClass="byte[]">
+ <xsd:restriction base="xsd:base64Binary"/>
+</xsd:simpleType>
+
+</xsd:schema>
Propchange: incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sdo/impl/src/main/resources/xml/sdoModelExtended.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTestCase.java?view=diff&rev=487222&r1=487221&r2=487222
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTestCase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTestCase.java Thu Dec 14 06:31:09 2006
@@ -28,6 +28,7 @@
import junit.framework.TestCase;
import org.apache.tuscany.sdo.util.SDOUtil;
+import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;
import commonj.sdo.Type;
import commonj.sdo.helper.DataHelper;
@@ -95,6 +96,7 @@
list.add("bar");
list.add("test");
Test[] tests = {
+ new Test(types.getType(URI, "Base64Bytes"), "SGVsbG8gV29ybGQ=", "Hello World", new BytesComparator()),
new Test(types.getType(URI, "Boolean"), "true", new Boolean(true)),
new Test(types.getType(URI, "Byte"), "49", new Byte((byte)49)),
new Test(types.getType(URI, "Bytes"), "666F6F", "foo", new BytesComparator()),
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org