Modified: tuscany/java/sdo/sample/src/main/resources/MedicalTest_CS.xsd
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/sample/src/main/resources/MedicalTest_CS.xsd?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/sample/src/main/resources/MedicalTest_CS.xsd (original)
+++ tuscany/java/sdo/sample/src/main/resources/MedicalTest_CS.xsd Mon Jul 28
07:30:12 2008
@@ -1,58 +1,58 @@
-<?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.
- -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:people="www.example.org/people" xmlns:sdo="commonj.sdo"
- xmlns:sdoxml="commonj.sdo/xml"
- xmlns:tns="www.example.org/MedicalTest"
- targetNamespace="www.example.org/MedicalTest">
-
- <import namespace="www.example.org/people"
- schemaLocation="People.xsd" />
-
- <element name="test" type="tns:Test" />
- <element name="condition" type="tns:Condition" />
-
- <complexType name="Test">
- <sequence>
- <element name="referrals" type="people:PersonSet" />
- <element name="patients" type="people:PersonSet" />
- <element name="relatives" type="people:PersonSet" />
- <element name="changes" type="sdo:ChangeSummaryType" />
- </sequence>
- </complexType>
-
- <complexType name="Condition">
- <sequence>
- <element name="diagnosed" type="date" />
- </sequence>
- <attribute name="name" type="tns:ConditionName" />
- </complexType>
-
- <simpleType name="ConditionName">
- <restriction base="string">
- <enumeration value="Rigellian fever" />
- <enumeration value="Vegan choriomeningitis" />
- <enumeration value="Scrofungulus" />
- <enumeration value="Panar Syndrome" />
- </restriction>
- </simpleType>
-
-
-</schema>
+<?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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:people="www.example.org/people" xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:tns="www.example.org/MedicalTest"
+ targetNamespace="www.example.org/MedicalTest">
+
+ <import namespace="www.example.org/people"
+ schemaLocation="People.xsd" />
+
+ <element name="test" type="tns:Test" />
+ <element name="condition" type="tns:Condition" />
+
+ <complexType name="Test">
+ <sequence>
+ <element name="referrals" type="people:PersonSet" />
+ <element name="patients" type="people:PersonSet" />
+ <element name="relatives" type="people:PersonSet" />
+ <element name="changes" type="sdo:ChangeSummaryType" />
+ </sequence>
+ </complexType>
+
+ <complexType name="Condition">
+ <sequence>
+ <element name="diagnosed" type="date" />
+ </sequence>
+ <attribute name="name" type="tns:ConditionName" />
+ </complexType>
+
+ <simpleType name="ConditionName">
+ <restriction base="string">
+ <enumeration value="Rigellian fever" />
+ <enumeration value="Vegan choriomeningitis" />
+ <enumeration value="Scrofungulus" />
+ <enumeration value="Panar Syndrome" />
+ </restriction>
+ </simpleType>
+
+
+</schema>
Propchange: tuscany/java/sdo/sample/src/main/resources/MedicalTest_CS.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tuscany/java/sdo/sample/src/main/resources/People.xsd
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/sample/src/main/resources/People.xsd?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/sample/src/main/resources/People.xsd (original)
+++ tuscany/java/sdo/sample/src/main/resources/People.xsd Mon Jul 28 07:30:12
2008
@@ -1,70 +1,70 @@
-<?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.
- -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="www.example.org/people"
- xmlns:sdo="commonj.sdo"
- xmlns:sdoxml="commonj.sdo/xml"
- xmlns:tns="www.example.org/people">
-
- <!-- <import namespace="commonj.sdo/xml" schemaLocation="sdoXML.xsd"
/> -->
-
- <complexType name="Person">
- <sequence>
- <element name="dob" type="date"/>
- <element name="relative" maxOccurs="unbounded"
type="tns:Relative"/>
- <any namespace="##other" processContents="lax"
maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="ID"/>
- <attribute name="name" type="string"/>
- <attribute name="gender" type = "tns:Gender"/>
- </complexType>
-
- <!-- <complexType name="Parent">
- <attribute name="parent" type="IDREF"
sdoxml:propertyType="tns:Person" use="required"/>
- <attribute name="genetic" use="optional" type="boolean"/>
- </complexType> -->
-
- <complexType name="Relative">
- <attribute name="target" type="IDREF"
sdoxml:propertyType="tns:Person" use="required"/>
- <attribute name="relationship" type="string" />
- <attribute name="genetic" use="optional" type="boolean"/>
- </complexType>
-
- <!-- <complexType name="GeneticParent">
- <complexContent>
- <extension base="tns:Parent">
- </extension>
- </complexContent>
- </complexType> -->
-
- <complexType name="PersonSet">
- <sequence>
- <element name="person" type="tns:Person"
maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <simpleType name="Gender">
- <restriction base="string">
- <enumeration value="male" />
- <enumeration value="female" />
- </restriction>
- </simpleType>
-
-</schema>
+<?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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/people"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:tns="www.example.org/people">
+
+ <!-- <import namespace="commonj.sdo/xml" schemaLocation="sdoXML.xsd"
/> -->
+
+ <complexType name="Person">
+ <sequence>
+ <element name="dob" type="date"/>
+ <element name="relative" maxOccurs="unbounded"
type="tns:Relative"/>
+ <any namespace="##other" processContents="lax"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="ID"/>
+ <attribute name="name" type="string"/>
+ <attribute name="gender" type = "tns:Gender"/>
+ </complexType>
+
+ <!-- <complexType name="Parent">
+ <attribute name="parent" type="IDREF"
sdoxml:propertyType="tns:Person" use="required"/>
+ <attribute name="genetic" use="optional" type="boolean"/>
+ </complexType> -->
+
+ <complexType name="Relative">
+ <attribute name="target" type="IDREF"
sdoxml:propertyType="tns:Person" use="required"/>
+ <attribute name="relationship" type="string" />
+ <attribute name="genetic" use="optional" type="boolean"/>
+ </complexType>
+
+ <!-- <complexType name="GeneticParent">
+ <complexContent>
+ <extension base="tns:Parent">
+ </extension>
+ </complexContent>
+ </complexType> -->
+
+ <complexType name="PersonSet">
+ <sequence>
+ <element name="person" type="tns:Person"
maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <simpleType name="Gender">
+ <restriction base="string">
+ <enumeration value="male" />
+ <enumeration value="female" />
+ </restriction>
+ </simpleType>
+
+</schema>
Propchange: tuscany/java/sdo/sample/src/main/resources/People.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tuscany/java/sdo/sdo-api/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/sdo-api/pom.xml?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/sdo-api/pom.xml (original)
+++ tuscany/java/sdo/sdo-api/pom.xml Mon Jul 28 07:30:12 2008
@@ -95,13 +95,19 @@
<target>1.4</target>
</configuration>
</plugin>
+
<plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
-
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+
<Implementation-Version>1.1-incubating</Implementation-Version>
+ <X-Compile-Source-JDK>1.4</X-Compile-Source-JDK>
+ <X-Compile-Target-JDK>1.4</X-Compile-Target-JDK>
+ </manifestEntries>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Modified:
tuscany/java/sdo/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
---
tuscany/java/sdo/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java
(original)
+++
tuscany/java/sdo/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java
Mon Jul 28 07:30:12 2008
@@ -1,67 +1,67 @@
-/**
- * <copyright>
- *
- * Service Data Objects
- * Version 2.1.0
- * Licensed Materials
- *
- * (c) Copyright BEA Systems, Inc., International Business Machines
Corporation,
- * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP
AG.,
- * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
- * 2005, 2006. All rights reserved.
- *
- * </copyright>
- *
- */
-
-package commonj.sdo.helper;
-
-/**
- * This interface represents a helper execution context.
- * The set of helpers returned by the methods in this interface have visibility
- * to the same SDO metadata, that is, they execute in the same "scope".
- */
-public interface HelperContext
-{
- /**
- * Gets the CopyHelper to use in this context.
- * @return a CopyHelper object
- */
- CopyHelper getCopyHelper();
-
- /**
- * Gets the DataFactory to use in this context.
- * @return a DataFactory object
- */
- DataFactory getDataFactory();
-
- /**
- * Gets the DataHelper to use in this context.
- * @return a DataHelper object
- */
- DataHelper getDataHelper();
-
- /**
- * Gets the EqualityHelper to use in this context.
- * @return an EqualityHelper object
- */
- EqualityHelper getEqualityHelper();
-
- /**
- * Gets the TypeHelper to use in this context.
- * @return a TypeHelper object
- */
- TypeHelper getTypeHelper();
-
- /**
- * Gets the XMLHelper to use in this context.
- * @return an XMLHelper object
- */
- XMLHelper getXMLHelper();
-
- /**
- * Gets the XSDHelper to use in this context.
- * @return an XSDHelper object
- */
- XSDHelper getXSDHelper();
-}
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines
Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP
AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+
+package commonj.sdo.helper;
+
+/**
+ * This interface represents a helper execution context.
+ * The set of helpers returned by the methods in this interface have visibility
+ * to the same SDO metadata, that is, they execute in the same "scope".
+ */
+public interface HelperContext
+{
+ /**
+ * Gets the CopyHelper to use in this context.
+ * @return a CopyHelper object
+ */
+ CopyHelper getCopyHelper();
+
+ /**
+ * Gets the DataFactory to use in this context.
+ * @return a DataFactory object
+ */
+ DataFactory getDataFactory();
+
+ /**
+ * Gets the DataHelper to use in this context.
+ * @return a DataHelper object
+ */
+ DataHelper getDataHelper();
+
+ /**
+ * Gets the EqualityHelper to use in this context.
+ * @return an EqualityHelper object
+ */
+ EqualityHelper getEqualityHelper();
+
+ /**
+ * Gets the TypeHelper to use in this context.
+ * @return a TypeHelper object
+ */
+ TypeHelper getTypeHelper();
+
+ /**
+ * Gets the XMLHelper to use in this context.
+ * @return an XMLHelper object
+ */
+ XMLHelper getXMLHelper();
+
+ /**
+ * Gets the XSDHelper to use in this context.
+ * @return an XSDHelper object
+ */
+ XSDHelper getXSDHelper();
+}
Propchange:
tuscany/java/sdo/sdo-api/src/main/java/commonj/sdo/helper/HelperContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tuscany/java/sdo/tools/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/pom.xml?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/tools/pom.xml (original)
+++ tuscany/java/sdo/tools/pom.xml Mon Jul 28 07:30:12 2008
@@ -95,6 +95,19 @@
<build>
<plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+
<Implementation-Version>1.1-incubating</Implementation-Version>
+ <X-Compile-Source-JDK>1.4</X-Compile-Source-JDK>
+ <X-Compile-Target-JDK>1.4</X-Compile-Target-JDK>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Modified:
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
---
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java
(original)
+++
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java
Mon Jul 28 07:30:12 2008
@@ -1,38 +1,38 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sdo.generate.adapter;
-
-import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory;
-import
org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter;
-import org.eclipse.emf.common.util.Monitor;
-
-public class SDOGenModelGeneratorAdapter extends GenModelGeneratorAdapter {
-
- public SDOGenModelGeneratorAdapter(
- GeneratorAdapterFactory generatorAdapterFactory) {
- super(generatorAdapterFactory);
- }
-
- protected void ensureProjectExists(String workspacePath, Object object,
- Object projectType, boolean force, Monitor monitor) {
- // Do nothing -- this avoids differential behaviour according to whether we
- // are running in Eclipse or not
- }
-}
+/**
+ *
+ * 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.generate.adapter;
+
+import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory;
+import
org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter;
+import org.eclipse.emf.common.util.Monitor;
+
+public class SDOGenModelGeneratorAdapter extends GenModelGeneratorAdapter {
+
+ public SDOGenModelGeneratorAdapter(
+ GeneratorAdapterFactory generatorAdapterFactory) {
+ super(generatorAdapterFactory);
+ }
+
+ protected void ensureProjectExists(String workspacePath, Object object,
+ Object projectType, boolean force, Monitor monitor) {
+ // Do nothing -- this avoids differential behaviour according to whether we
+ // are running in Eclipse or not
+ }
+}
Propchange:
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
---
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java
(original)
+++
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java
Mon Jul 28 07:30:12 2008
@@ -1,326 +1,326 @@
-/**
- *
- * 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.generate.util;
-
-import java.util.Iterator;
-
-import org.apache.tuscany.sdo.model.ModelFactory;
-import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
-import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
-import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier;
-import org.eclipse.emf.codegen.ecore.genmodel.GenDataType;
-import org.eclipse.emf.codegen.ecore.genmodel.GenDelegationKind;
-import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-import org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl;
-import org.eclipse.emf.codegen.ecore.genmodel.impl.Literals;
-import org.eclipse.emf.codegen.util.CodeGenUtil;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EcorePackage;
-
-import commonj.sdo.Type;
-
-public class SDOGenUtil {
-
- public static String getQualifiedTypeAccessor(GenClassifier
genClassifier)
- {
- GenPackage genPackage = genClassifier.getGenPackage();
- return getFactoryImpl(genPackage) + ".get" +
genClassifier.getClassifierAccessorName() + "()";
- }
-
- public static String getDependentFactoryArgumentList(GenPackage
genPackage, boolean isFormalArguments)
- {
- StringBuffer result = new StringBuffer();
- for (Iterator iter =
genPackage.getPackageInitializationDependencies().iterator(); iter.hasNext(); )
- {
- GenPackage dep = (GenPackage)iter.next();
- if (isFormalArguments)
- {
- result.append(dep.getImportedFactoryClassName());
- result.append(" ");
- }
- result.append(genPackage.getPackageInstanceVariable(dep));
- if (iter.hasNext()) result.append(", ");
- }
- return result.toString();
- }
-
- public static String getFactoryImpl(GenPackage genPackage)
- {
- return "((" + genPackage.getImportedFactoryClassName() + ")"
- + genPackage.getImportedFactoryInterfaceName() + ".INSTANCE)";
- }
-
- public static String getListKind(GenFeature genFeature, boolean
suppressNotification )
- {
- boolean unsettable = genFeature.isUnsettable();
-
- if (suppressNotification)
- {
- return "ListKind.BASIC";
- }
- else if (genFeature.isEffectiveContains())
- {
- if (genFeature.isBidirectional())
- {
- if (genFeature.isResolveProxies())
- {
- if( unsettable )
- return
"ListKind.CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE";
- else
- return "ListKind.CONTAINMENT_INVERSE_RESOLVING";
- }
- else
- {
- if( unsettable )
- return "ListKind.CONTAINMENT_INVERSE_UNSETTABLE";
- else
- return "ListKind.CONTAINMENT_INVERSE";
- }
- }
- else
- {
- if (genFeature.isResolveProxies())
- {
- if( unsettable )
- return "ListKind.CONTAINMENT_RESOLVING_UNSETTABLE";
- else
- return "ListKind.CONTAINMENT_RESOLVING";
- }
- else
- {
- if( unsettable )
- return "ListKind.CONTAINMENT_UNSETTABLE";
- else
- return "ListKind.CONTAINMENT";
- }
- }
- }
- else if (genFeature.isReferenceType())
- {
- if (genFeature.isBidirectional())
- {
- GenFeature reverseFeature = genFeature.getReverse();
- if (genFeature.isResolveProxies())
- {
- if (reverseFeature.isListType())
- {
- if( unsettable )
- return
"ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE";
- else
- return
"ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING";
- }
- else
- {
- if( unsettable )
- return
"ListKind.NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE";
- else
- return "ListKind.NONCONTAINMENT_INVERSE_RESOLVING";
- }
- }
- else
- {
- if (reverseFeature.isListType())
- {
- if( unsettable )
- return
"ListKind.NONCONTAINMENT_MANYINVERSE_UNSETTABLE";
- else
- return "ListKind.NONCONTAINMENT_MANYINVERSE";
- }
- else
- {
- if( unsettable )
- return
"ListKind.NONCONTAINMENT_INVERSE_UNSETTABLE";
- else
- return "ListKind.NONCONTAINMENT_INVERSE";
- }
- }
- }
- else
- {
- if (genFeature.isResolveProxies())
- {
- if( unsettable )
- return "ListKind.NONCONTAINMENT_RESOLVING_UNSETTABLE";
- else
- return "ListKind.NONCONTAINMENT_RESOLVING";
- }
- else
- {
- if( unsettable )
- return "ListKind.NONCONTAINMENT_UNSETTABLE";
- else
- return "ListKind.NONCONTAINMENT";
- }
- }
- }
- else
- { //datatype
- if (genFeature.isUnique())
- {
- if( unsettable )
- return "ListKind.DATATYPE_UNIQUE_UNSETTABLE";
- else
- return "ListKind.DATATYPE_UNIQUE";
- }
- else
- {
- if( unsettable )
- return "ListKind.DATATYPE_UNSETTABLE";
- else
- return "ListKind.DATATYPE";
- }
- }
- }
-
- public static boolean hasChangeSummaryProperty(GenClass genClass)
- {
- return getChangeSummaryProperty(genClass) != null;
- }
-
- public static String getQualifiedInternalPropertyID(GenFeature genFeature)
- {
- return genFeature.getGenClass().getImportedClassName() + ".INTERNAL_" +
genFeature.getUpperName();
- }
-
- public static String getChangeSummaryProperty(GenClass genClass)
- {
- Type csType =
((ModelFactoryImpl)ModelFactory.INSTANCE).getChangeSummaryType();
- for (Iterator i = genClass.getGenFeatures().iterator(); i.hasNext(); )
- {
- GenFeature genFeature = (GenFeature)i.next();
- EClassifier eClassifier = genFeature.getEcoreFeature().getEType();
- if (eClassifier instanceof Type)
- {
- Type type = (Type)eClassifier;
- //if (csType == type)// this doesn't work when generating
sdoModel.xsd
- if (csType.getName().equals(type.getName()) &&
csType.getURI().equals(type.getURI()))
- {
- return genFeature.getUpperName();
- }
- }
- }
- return null;
- }
-
- public static String printArguments(GenPackage genPackage, GenModel
genModel) {
- StringBuffer result = new StringBuffer();
-
if(!CodeGenUtil.capName(genPackage.getNSName()).equals(genPackage.getPrefix()))
{
- result.append(" -prefix " + genPackage.getPrefix());
- }
- if (genModel.isSuppressInterfaces()) {
- result.append(" -noInterfaces");
- }
- if ( genModel.getFeatureDelegation() ==
GenDelegationKind.VIRTUAL_LITERAL) {
- result.append(" -sparsePattern");
- }
- if
("org.apache.tuscany.sdo.impl.StoreDataObjectImpl".equals(genModel.getRootExtendsClass()))
{
- result.append(" -storePattern");
- }
- if (genModel.isSuppressNotification()) {
- result.append(" -noNotification");
- }
- if (genModel.isSuppressContainment()) {
- result.append(" -noContainment");
- }
- if (genModel.isArrayAccessors()) {
- result.append(" -arrayAccessors");
- }
- if (genModel.isSuppressUnsettable()) {
- result.append(" -noUnsettable");
- }
-
- return result.toString();
- }
-
- /*
- * EMF doesn't do what we want in all cases, so filter the cases we need
to handle
- * and drop through to EMF for all others.
- */
- public static String getStaticDefaultValue(GenFeature genFeature) {
- String result = "null";
- boolean defaultFound = false;
-
- String defaultString = genFeature.getEcoreFeature()
- .getDefaultValueLiteral();
- EClassifier eType = genFeature.getEcoreFeature().getEType();
- if (eType instanceof EDataType) {
- GenPackage genPackage = ((GenFeatureImpl) genFeature)
-
.findGenPackage(genFeature.getEcoreFeature().getEType().getEPackage());
- GenDataType gdt = null;
- if (genPackage != null) {
- for (Iterator iter = genPackage.getGenDataTypes().iterator(); iter
- .hasNext()
- && gdt == null;) {
- GenDataType genDataType = (GenDataType) iter.next();
- if
(eType.getName().equals(genDataType.getEcoreDataType().getName())) {
- gdt = genDataType;
- }
- }
- }
- EClassifier eDataType = gdt.getEcoreDataType();
- if (eDataType.getEPackage() != EcorePackage.eINSTANCE
- && defaultString != null) {
- boolean replaced = false;
- for (Iterator i =
EcorePackage.eINSTANCE.getEClassifiers().iterator(); i
- .hasNext();) {
- EClassifier eClassifier = (EClassifier) i.next();
- if (eClassifier instanceof EDataType
- && eClassifier.getInstanceClassName().equals(
- eDataType.getInstanceClassName())
- && ((EDataType) eClassifier).isSerializable()
- && eClassifier != EcorePackage.eINSTANCE.getEDate()) {
- replaced = true;
- eDataType = eClassifier;
- break;
- }
- }
- if (!replaced) {
- result = "((" + genPackage.getFactoryClassName() + ")"
- + genPackage.getFactoryInterfaceName() + "."
- + genPackage.getFactoryInstanceName() + ")." + "create"
- + gdt.getName() + "FromString("
- + Literals.toLiteral(defaultString) + ")";
-
-
- if (gdt.isPrimitiveType())
- {
- result = "((" + gdt.getObjectInstanceClassName() + ")" + result
- + ")." + gdt.getPrimitiveValueFunction() + "()";
- } else if (!gdt.isObjectType()) {
- result = "(" + gdt.getImportedInstanceClassName() + ")" + result;
- }
-
- defaultFound = true;
- }
- }
- }
-
- if (!defaultFound) {
- // the input didn't match any special case that we want to handle
differently
- // from EMF's default approach, so go ahead and get EMF to do it
- result = genFeature.getStaticDefaultValue();
- }
-
- return result;
- }
-}
+/**
+ *
+ * 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.generate.util;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sdo.model.ModelFactory;
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
+import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier;
+import org.eclipse.emf.codegen.ecore.genmodel.GenDataType;
+import org.eclipse.emf.codegen.ecore.genmodel.GenDelegationKind;
+import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl;
+import org.eclipse.emf.codegen.ecore.genmodel.impl.Literals;
+import org.eclipse.emf.codegen.util.CodeGenUtil;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import commonj.sdo.Type;
+
+public class SDOGenUtil {
+
+ public static String getQualifiedTypeAccessor(GenClassifier
genClassifier)
+ {
+ GenPackage genPackage = genClassifier.getGenPackage();
+ return getFactoryImpl(genPackage) + ".get" +
genClassifier.getClassifierAccessorName() + "()";
+ }
+
+ public static String getDependentFactoryArgumentList(GenPackage
genPackage, boolean isFormalArguments)
+ {
+ StringBuffer result = new StringBuffer();
+ for (Iterator iter =
genPackage.getPackageInitializationDependencies().iterator(); iter.hasNext(); )
+ {
+ GenPackage dep = (GenPackage)iter.next();
+ if (isFormalArguments)
+ {
+ result.append(dep.getImportedFactoryClassName());
+ result.append(" ");
+ }
+ result.append(genPackage.getPackageInstanceVariable(dep));
+ if (iter.hasNext()) result.append(", ");
+ }
+ return result.toString();
+ }
+
+ public static String getFactoryImpl(GenPackage genPackage)
+ {
+ return "((" + genPackage.getImportedFactoryClassName() + ")"
+ + genPackage.getImportedFactoryInterfaceName() + ".INSTANCE)";
+ }
+
+ public static String getListKind(GenFeature genFeature, boolean
suppressNotification )
+ {
+ boolean unsettable = genFeature.isUnsettable();
+
+ if (suppressNotification)
+ {
+ return "ListKind.BASIC";
+ }
+ else if (genFeature.isEffectiveContains())
+ {
+ if (genFeature.isBidirectional())
+ {
+ if (genFeature.isResolveProxies())
+ {
+ if( unsettable )
+ return
"ListKind.CONTAINMENT_INVERSE_RESOLVING_UNSETTABLE";
+ else
+ return "ListKind.CONTAINMENT_INVERSE_RESOLVING";
+ }
+ else
+ {
+ if( unsettable )
+ return "ListKind.CONTAINMENT_INVERSE_UNSETTABLE";
+ else
+ return "ListKind.CONTAINMENT_INVERSE";
+ }
+ }
+ else
+ {
+ if (genFeature.isResolveProxies())
+ {
+ if( unsettable )
+ return "ListKind.CONTAINMENT_RESOLVING_UNSETTABLE";
+ else
+ return "ListKind.CONTAINMENT_RESOLVING";
+ }
+ else
+ {
+ if( unsettable )
+ return "ListKind.CONTAINMENT_UNSETTABLE";
+ else
+ return "ListKind.CONTAINMENT";
+ }
+ }
+ }
+ else if (genFeature.isReferenceType())
+ {
+ if (genFeature.isBidirectional())
+ {
+ GenFeature reverseFeature = genFeature.getReverse();
+ if (genFeature.isResolveProxies())
+ {
+ if (reverseFeature.isListType())
+ {
+ if( unsettable )
+ return
"ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING_UNSETTABLE";
+ else
+ return
"ListKind.NONCONTAINMENT_MANYINVERSE_RESOLVING";
+ }
+ else
+ {
+ if( unsettable )
+ return
"ListKind.NONCONTAINMENT_INVERSE_RESOLVING_UNSETTABLE";
+ else
+ return "ListKind.NONCONTAINMENT_INVERSE_RESOLVING";
+ }
+ }
+ else
+ {
+ if (reverseFeature.isListType())
+ {
+ if( unsettable )
+ return
"ListKind.NONCONTAINMENT_MANYINVERSE_UNSETTABLE";
+ else
+ return "ListKind.NONCONTAINMENT_MANYINVERSE";
+ }
+ else
+ {
+ if( unsettable )
+ return
"ListKind.NONCONTAINMENT_INVERSE_UNSETTABLE";
+ else
+ return "ListKind.NONCONTAINMENT_INVERSE";
+ }
+ }
+ }
+ else
+ {
+ if (genFeature.isResolveProxies())
+ {
+ if( unsettable )
+ return "ListKind.NONCONTAINMENT_RESOLVING_UNSETTABLE";
+ else
+ return "ListKind.NONCONTAINMENT_RESOLVING";
+ }
+ else
+ {
+ if( unsettable )
+ return "ListKind.NONCONTAINMENT_UNSETTABLE";
+ else
+ return "ListKind.NONCONTAINMENT";
+ }
+ }
+ }
+ else
+ { //datatype
+ if (genFeature.isUnique())
+ {
+ if( unsettable )
+ return "ListKind.DATATYPE_UNIQUE_UNSETTABLE";
+ else
+ return "ListKind.DATATYPE_UNIQUE";
+ }
+ else
+ {
+ if( unsettable )
+ return "ListKind.DATATYPE_UNSETTABLE";
+ else
+ return "ListKind.DATATYPE";
+ }
+ }
+ }
+
+ public static boolean hasChangeSummaryProperty(GenClass genClass)
+ {
+ return getChangeSummaryProperty(genClass) != null;
+ }
+
+ public static String getQualifiedInternalPropertyID(GenFeature genFeature)
+ {
+ return genFeature.getGenClass().getImportedClassName() + ".INTERNAL_" +
genFeature.getUpperName();
+ }
+
+ public static String getChangeSummaryProperty(GenClass genClass)
+ {
+ Type csType =
((ModelFactoryImpl)ModelFactory.INSTANCE).getChangeSummaryType();
+ for (Iterator i = genClass.getGenFeatures().iterator(); i.hasNext(); )
+ {
+ GenFeature genFeature = (GenFeature)i.next();
+ EClassifier eClassifier = genFeature.getEcoreFeature().getEType();
+ if (eClassifier instanceof Type)
+ {
+ Type type = (Type)eClassifier;
+ //if (csType == type)// this doesn't work when generating
sdoModel.xsd
+ if (csType.getName().equals(type.getName()) &&
csType.getURI().equals(type.getURI()))
+ {
+ return genFeature.getUpperName();
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String printArguments(GenPackage genPackage, GenModel
genModel) {
+ StringBuffer result = new StringBuffer();
+
if(!CodeGenUtil.capName(genPackage.getNSName()).equals(genPackage.getPrefix()))
{
+ result.append(" -prefix " + genPackage.getPrefix());
+ }
+ if (genModel.isSuppressInterfaces()) {
+ result.append(" -noInterfaces");
+ }
+ if ( genModel.getFeatureDelegation() ==
GenDelegationKind.VIRTUAL_LITERAL) {
+ result.append(" -sparsePattern");
+ }
+ if
("org.apache.tuscany.sdo.impl.StoreDataObjectImpl".equals(genModel.getRootExtendsClass()))
{
+ result.append(" -storePattern");
+ }
+ if (genModel.isSuppressNotification()) {
+ result.append(" -noNotification");
+ }
+ if (genModel.isSuppressContainment()) {
+ result.append(" -noContainment");
+ }
+ if (genModel.isArrayAccessors()) {
+ result.append(" -arrayAccessors");
+ }
+ if (genModel.isSuppressUnsettable()) {
+ result.append(" -noUnsettable");
+ }
+
+ return result.toString();
+ }
+
+ /*
+ * EMF doesn't do what we want in all cases, so filter the cases we need
to handle
+ * and drop through to EMF for all others.
+ */
+ public static String getStaticDefaultValue(GenFeature genFeature) {
+ String result = "null";
+ boolean defaultFound = false;
+
+ String defaultString = genFeature.getEcoreFeature()
+ .getDefaultValueLiteral();
+ EClassifier eType = genFeature.getEcoreFeature().getEType();
+ if (eType instanceof EDataType) {
+ GenPackage genPackage = ((GenFeatureImpl) genFeature)
+
.findGenPackage(genFeature.getEcoreFeature().getEType().getEPackage());
+ GenDataType gdt = null;
+ if (genPackage != null) {
+ for (Iterator iter = genPackage.getGenDataTypes().iterator(); iter
+ .hasNext()
+ && gdt == null;) {
+ GenDataType genDataType = (GenDataType) iter.next();
+ if
(eType.getName().equals(genDataType.getEcoreDataType().getName())) {
+ gdt = genDataType;
+ }
+ }
+ }
+ EClassifier eDataType = gdt.getEcoreDataType();
+ if (eDataType.getEPackage() != EcorePackage.eINSTANCE
+ && defaultString != null) {
+ boolean replaced = false;
+ for (Iterator i =
EcorePackage.eINSTANCE.getEClassifiers().iterator(); i
+ .hasNext();) {
+ EClassifier eClassifier = (EClassifier) i.next();
+ if (eClassifier instanceof EDataType
+ && eClassifier.getInstanceClassName().equals(
+ eDataType.getInstanceClassName())
+ && ((EDataType) eClassifier).isSerializable()
+ && eClassifier != EcorePackage.eINSTANCE.getEDate()) {
+ replaced = true;
+ eDataType = eClassifier;
+ break;
+ }
+ }
+ if (!replaced) {
+ result = "((" + genPackage.getFactoryClassName() + ")"
+ + genPackage.getFactoryInterfaceName() + "."
+ + genPackage.getFactoryInstanceName() + ")." + "create"
+ + gdt.getName() + "FromString("
+ + Literals.toLiteral(defaultString) + ")";
+
+
+ if (gdt.isPrimitiveType())
+ {
+ result = "((" + gdt.getObjectInstanceClassName() + ")" + result
+ + ")." + gdt.getPrimitiveValueFunction() + "()";
+ } else if (!gdt.isObjectType()) {
+ result = "(" + gdt.getImportedInstanceClassName() + ")" + result;
+ }
+
+ defaultFound = true;
+ }
+ }
+ }
+
+ if (!defaultFound) {
+ // the input didn't match any special case that we want to handle
differently
+ // from EMF's default approach, so go ahead and get EMF to do it
+ result = genFeature.getStaticDefaultValue();
+ }
+
+ return result;
+ }
+}
Propchange:
tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/util/SDOGenUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tuscany/java/sdo/tools/src/main/resources/META-INF/NOTICE
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/main/resources/META-INF/NOTICE?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/tools/src/main/resources/META-INF/NOTICE (original)
+++ tuscany/java/sdo/tools/src/main/resources/META-INF/NOTICE Mon Jul 28
07:30:12 2008
@@ -4,5 +4,4 @@
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.
Modified: tuscany/java/sdo/tools/src/main/resources/META-INF/README.txt
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/main/resources/META-INF/README.txt?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/tools/src/main/resources/META-INF/README.txt (original)
+++ tuscany/java/sdo/tools/src/main/resources/META-INF/README.txt Mon Jul 28
07:30:12 2008
@@ -1,5 +1,5 @@
-Apache Tuscany 1.1-incubating build (February 2008)
-===============================================
+Apache Tuscany 1.1-incubating build (April 2008)
+================================================
http://incubator.apache.org/tuscany/
Modified:
tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
---
tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java
(original)
+++
tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java
Mon Jul 28 07:30:12 2008
@@ -1,70 +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.test;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
-
-import junit.framework.TestCase;
-
-
-public class GeneratedPackagesTestCase extends TestCase
-{
- static String expectedNamespace = "http://www.example.com/sequences";
-
- public void testPackageValidity()
- {
- XSD2JavaGenerator codeGen = new XSD2JavaGenerator();
- String [] genArgs = { "-schemaNamespace", "all", "-noGenerate",
"src/test/resources/sequences.xsd" };
- codeGen.generateFromXMLSchema( genArgs );
- List packages = codeGen.getGeneratedPackageInfo();
-
- for (Iterator iter = packages.iterator(); iter.hasNext();)
- {
- XSD2JavaGenerator.GeneratedPackage packageInfo =
(XSD2JavaGenerator.GeneratedPackage)iter.next();
- assertTrue(expectedNamespace.equals(packageInfo.getNamespace()));
-
- String name;
- boolean validatedMixedQuote = false;
- boolean validatedRC = false;
- for (Iterator iterClass = packageInfo.getClasses().iterator();
iterClass.hasNext();)
- {
- XSD2JavaGenerator.GeneratedPackage.PackageClassInfo classInfo
= (XSD2JavaGenerator.GeneratedPackage.PackageClassInfo)iterClass.next();
- name = classInfo.getName();
-
- if( "mixedStockQuote".equals(name))
- {
-
assertTrue("com.example.sequences.MixedQuote".equals(classInfo.getClassName()));
- validatedMixedQuote = true;
- }
-
- if( "rc".equals(name))
- {
-
assertTrue("com.example.sequences.RepeatingChoice".equals(classInfo.getClassName()));
- validatedRC = true;
- }
- }
- assertTrue(validatedMixedQuote);
- assertTrue(validatedRC);
- }
- }
-}
+/*
+ * 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.test;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
+
+import junit.framework.TestCase;
+
+
+public class GeneratedPackagesTestCase extends TestCase
+{
+ static String expectedNamespace = "http://www.example.com/sequences";
+
+ public void testPackageValidity()
+ {
+ XSD2JavaGenerator codeGen = new XSD2JavaGenerator();
+ String [] genArgs = { "-schemaNamespace", "all", "-noGenerate",
"src/test/resources/sequences.xsd" };
+ codeGen.generateFromXMLSchema( genArgs );
+ List packages = codeGen.getGeneratedPackageInfo();
+
+ for (Iterator iter = packages.iterator(); iter.hasNext();)
+ {
+ XSD2JavaGenerator.GeneratedPackage packageInfo =
(XSD2JavaGenerator.GeneratedPackage)iter.next();
+ assertTrue(expectedNamespace.equals(packageInfo.getNamespace()));
+
+ String name;
+ boolean validatedMixedQuote = false;
+ boolean validatedRC = false;
+ for (Iterator iterClass = packageInfo.getClasses().iterator();
iterClass.hasNext();)
+ {
+ XSD2JavaGenerator.GeneratedPackage.PackageClassInfo classInfo
= (XSD2JavaGenerator.GeneratedPackage.PackageClassInfo)iterClass.next();
+ name = classInfo.getName();
+
+ if( "mixedStockQuote".equals(name))
+ {
+
assertTrue("com.example.sequences.MixedQuote".equals(classInfo.getClassName()));
+ validatedMixedQuote = true;
+ }
+
+ if( "rc".equals(name))
+ {
+
assertTrue("com.example.sequences.RepeatingChoice".equals(classInfo.getClassName()));
+ validatedRC = true;
+ }
+ }
+ assertTrue(validatedMixedQuote);
+ assertTrue(validatedRC);
+ }
+ }
+}
Propchange:
tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/GeneratedPackagesTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tuscany/java/sdo/tools/src/test/resources/sdoModel.xsd
URL:
http://svn.apache.org/viewvc/tuscany/java/sdo/tools/src/test/resources/sdoModel.xsd?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/tools/src/test/resources/sdoModel.xsd (original)
+++ tuscany/java/sdo/tools/src/test/resources/sdoModel.xsd Mon Jul 28 07:30:12
2008
@@ -1,28 +1,28 @@
-<?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"
targetNamespace="commonj.sdo">
-
- <!-- Dummy XSD definition of special SDO ChangeSummaryType -->
- <xsd:simpleType name="ChangeSummaryType"
sdoJava:instanceClass="commonj.sdo.ChangeSummary">
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
-
-</xsd:schema>
+<?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"
targetNamespace="commonj.sdo">
+
+ <!-- Dummy XSD definition of special SDO ChangeSummaryType -->
+ <xsd:simpleType name="ChangeSummaryType"
sdoJava:instanceClass="commonj.sdo.ChangeSummary">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+
+</xsd:schema>
Propchange: tuscany/java/sdo/tools/src/test/resources/sdoModel.xsd
------------------------------------------------------------------------------
svn:eol-style = native