diff options
Diffstat (limited to 'tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper')
12 files changed, 0 insertions, 2280 deletions
diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CopyHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CopyHelperImpl.java deleted file mode 100644 index 060bd381dc..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CopyHelperImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.CopyHelper; - - -/** - * A helper for copying DataObjects. - */ -public class CopyHelperImpl implements CopyHelper -{ - public DataObject copyShallow(DataObject dataObject) - { - Copier copier = new Copier() - { - protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) - { - } - }; - EObject result = copier.copy((EObject)dataObject); - copier.copyReferences(); - return (DataObject)result; - } - - public DataObject copy(DataObject dataObject) - { - return (DataObject)EcoreUtil.copy((EObject)dataObject); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataFactoryImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataFactoryImpl.java deleted file mode 100644 index ab5ee13af9..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataFactoryImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.TypeHelper; - -/** - * A Factory for creating DataObjects. - * The created DataObjects are not connected to any other DataObjects. - */ -public class DataFactoryImpl implements DataFactory -{ - protected TypeHelper typeHelper; - - public DataFactoryImpl(TypeHelper typeHelper) - { - this.typeHelper = typeHelper; - } - - public DataObject create(String uri, String typeName) - { - Type type = typeHelper.getType(uri, typeName); - return create(type); - } - - public DataObject create(Class interfaceClass) - { - //TODO more efficient implementation ... this is a really bad one! - Type type = typeHelper.getType(interfaceClass); - return create(type); - } - - public DataObject create(Type type) - { - if (type instanceof EClass) - { - EClass eClass = (EClass)type; - return (DataObject)EcoreUtil.create(eClass); - } - throw new IllegalArgumentException(); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataHelperImpl.java deleted file mode 100644 index 3986fa4be7..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataHelperImpl.java +++ /dev/null @@ -1,303 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Locale; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; - - -import commonj.sdo.helper.DataHelper; - -/** - * Data helper methods. - */ -public class DataHelperImpl implements DataHelper -{ - /** - * @param dateString - Must comply to the pattern of yyyy-MM-dd'T'HH:mm:ss'.'SSS Z - * @return null if dataString couldn't be parsed - */ - public synchronized Date toDate(String dateString) - { - if (dateString == null) - { - return null; - } - - DateFormat [] DATE_PATTERNS = - { - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS Z"), - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS"), - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"), - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"), - new SimpleDateFormat("yyyy-MM-dd") - }; - - for (int i = 0; i < DATE_PATTERNS.length; ++i) - { - try - { - return DATE_PATTERNS[i].parse(dateString); - } - catch (ParseException parseException) - { - } - } - - return null; - } - - public synchronized Calendar toCalendar(String dateString) - { - if (dateString == null) - { - return null; - } - - Date date = toDate(dateString); - if (date == null) - { - return null; - } - - Calendar calendar = new GregorianCalendar(); - calendar.setTime(date); - - return calendar; - } - - public synchronized Calendar toCalendar(String dateString, Locale locale) - { - if (dateString == null || locale == null) - { - return null; - } - - Date date = toDate(dateString); - if (date == null) - { - return null; - } - - Calendar calendar = new GregorianCalendar(locale); - calendar.setTime(date); - return calendar; - } - - public synchronized String toDateTime(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS zz"); - - return f.format(date); - } - - public synchronized String toDuration(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("'P'yyyy'Y' MM'M' dd'D' 'T' HH'H' mm'M' ss'S.'SSS"); - - return f.format(date); - } - - public synchronized String toTime(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss'.'SSS zz"); - - return f.format(date); - } - - public synchronized String toDay(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("---dd zz"); - - return f.format(date); - } - - public synchronized String toMonth(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("--MM zz"); - - return f.format(date); - } - - public synchronized String toMonthDay(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("--MM-dd zz"); - - return f.format(date); - } - - public synchronized String toYear(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("yyyy zz"); - - return f.format(date); - } - - public synchronized String toYearMonth(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM zz"); - - return f.format(date); - } - - public synchronized String toYearMonthDay(Date date) - { - if (date == null) - { - return null; - } - - SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd zz"); - - return f.format(date); - } - - public synchronized String toDateTime(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toDateTime(calendar.getTime()); - } - - public synchronized String toDuration(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toDuration(calendar.getTime()); - } - - public synchronized String toTime(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toTime(calendar.getTime()); - } - - public synchronized String toDay(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toDay(calendar.getTime()); - } - - public synchronized String toMonth(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toMonth(calendar.getTime()); - } - - public synchronized String toMonthDay(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toMonthDay(calendar.getTime()); - } - - public synchronized String toYear(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toYear(calendar.getTime()); - } - - public synchronized String toYearMonth(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toYearMonth(calendar.getTime()); - } - - public synchronized String toYearMonthDay(Calendar calendar) - { - if (calendar == null) - { - return null; - } - - return toYearMonthDay(calendar.getTime()); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/EqualityHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/EqualityHelperImpl.java deleted file mode 100644 index a31066d598..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/EqualityHelperImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.EqualityHelper; - - -/** - * A helper for comparing DataObjects. - */ -public class EqualityHelperImpl implements EqualityHelper -{ - public boolean equalShallow(DataObject dataObject1, DataObject dataObject2) - { - EcoreUtil.EqualityHelper equalityHelper = new EcoreUtil.EqualityHelper() - { - protected boolean haveEqualFeature(EObject eObject1, EObject eObject2, EStructuralFeature feature) - { - if (feature instanceof EAttribute) - { - boolean eIsSet = eObject1.eIsSet(feature); - if (eIsSet != eObject2.eIsSet(feature) || !haveEqualAttribute(eObject1, eObject2, (EAttribute)feature)) - { - return false; - } - } - return true; - } - - protected boolean equalFeatureMapValues(Object value1, Object value2, EStructuralFeature feature) - { - if (feature instanceof EAttribute) - { - return value1 == null ? value2 == null : value1.equals(value2); - } - return true; - } - }; - return equalityHelper.equals((EObject)dataObject1, (EObject)dataObject2); - } - - public boolean equal(DataObject dataObject1, DataObject dataObject2) - { - return EcoreUtil.equals((EObject)dataObject1, (EObject)dataObject2); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/HelperProviderImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/HelperProviderImpl.java deleted file mode 100644 index d0ece134e3..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/HelperProviderImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import org.apache.tuscany.sdo.helper.CopyHelperImpl; -import org.apache.tuscany.sdo.helper.DataHelperImpl; -import org.apache.tuscany.sdo.helper.EqualityHelperImpl; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.CopyHelper; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.DataHelper; -import commonj.sdo.helper.EqualityHelper; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import commonj.sdo.impl.ExternalizableDelegator.Resolvable; -import commonj.sdo.impl.HelperProvider; - - -/** - * Create and manage all the default helper INSTANCEs - */ -public class HelperProviderImpl extends HelperProvider -{ - protected CopyHelper copyHelper; - - protected DataFactory dataFactory; - - protected DataHelper dataHelper; - - protected EqualityHelper equalityHelper; - - protected TypeHelper typeHelper; - - protected XMLHelper xmlHelper; - - protected XSDHelper xsdHelper; - - public HelperProviderImpl() - { - typeHelper = SDOUtil.createTypeHelper(); - dataFactory = SDOUtil.createDataFactory(typeHelper); - xmlHelper = SDOUtil.createXMLHelper(typeHelper); - xsdHelper = SDOUtil.createXSDHelper(typeHelper); - copyHelper = new CopyHelperImpl(); - equalityHelper = new EqualityHelperImpl(); - dataHelper = new DataHelperImpl(); - } - - 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 XSDHelper xsdHelper() - { - return xsdHelper; - } - - public Resolvable resolvable() - { - throw new UnsupportedOperationException(); //TODO - } - - public Resolvable resolvable(Object target) - { - throw new UnsupportedOperationException(); //TODO - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOExtendedMetaDataImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOExtendedMetaDataImpl.java deleted file mode 100644 index 1b1313c4f8..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOExtendedMetaDataImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- */
-package org.apache.tuscany.sdo.helper;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.apache.tuscany.sdo.SDOExtendedMetaData;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EPackage.Registry;
-import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
-
-public class SDOExtendedMetaDataImpl
- extends BasicExtendedMetaData
- implements SDOExtendedMetaData {
-
-
-
- public SDOExtendedMetaDataImpl() {
- super();
- }
-
- public SDOExtendedMetaDataImpl(Registry registry) {
- super(registry);
- }
-
- public SDOExtendedMetaDataImpl(String annotationURI, Registry registry, Map annotationMap) {
- super(annotationURI, registry, annotationMap);
- }
-
- public SDOExtendedMetaDataImpl(String annotationURI, Registry registry) {
- super(annotationURI, registry);
- }
-
- /**
- * Returns the listing of alias names as specified by the sdo:aliasNames
- * property.
- */
- public List getAliasNames(EModelElement modelElement) {
- EAnnotation eAnnotation = getAnnotation(modelElement, false);
- List list = null;
- if (eAnnotation != null) {
- String aliasNames = (String)eAnnotation.getDetails().get("aliasNames");
- if (aliasNames != null) {
- list = new ArrayList();
- StringTokenizer st = new StringTokenizer(aliasNames, " ");
- while (st.hasMoreTokens()) {
- String t = st.nextToken();
- list.add(t);
- }
- }
- }
- return list;
- }
-
-
- public void setAliasNames(EModelElement modelElement, List aliasNames) {
- if (aliasNames == null || aliasNames.isEmpty()) {
- setAliasNames(modelElement, (String)null);
- } else {
- StringBuffer buf = new StringBuffer();
- for (int n = 0; n < aliasNames.size(); n++) {
- String name = (String) aliasNames.get(n);
- buf.append(name);
- buf.append(" ");
- }
- setAliasNames(modelElement, buf.toString());
- }
- }
-
- /**
- * Adds an alias name per sdo:aliasName
- */
- public void setAliasNames(EModelElement modelElement, String aliasNames) {
- EAnnotation eAnnotation = getAnnotation(modelElement, true);
- eAnnotation.getDetails().put("aliasNames", aliasNames);
- }
-
-}
diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java deleted file mode 100644 index 9867393ca4..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java +++ /dev/null @@ -1,434 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- */
-package org.apache.tuscany.sdo.helper;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sdo.SDOExtendedMetaData;
-import org.apache.tuscany.sdo.util.SDOUtil;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.ExtendedMetaData;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDFeature;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.ecore.XSDEcoreBuilder;
-import org.w3c.dom.Element;
-
-/**
- * TODO:
- * - Implement support for the SDO XSD Schema annotations
- * - Override the default ecore type mappings
- *
- * DONE:
- * - Override the default XSDEcoreBuilder name mangling
- */
-public class SDOXSDEcoreBuilder extends XSDEcoreBuilder
-{
-
- public SDOXSDEcoreBuilder(ExtendedMetaData extendedMetaData)
- {
- super(extendedMetaData);
- }
-
- public EClassifier getEClassifier(XSDTypeDefinition xsdTypeDefinition) {
- EClassifier eClassifier = null;
- if (rootSchema.getSchemaForSchemaNamespace().equals(xsdTypeDefinition.getTargetNamespace())) {
- eClassifier =
- getBuiltInEClassifier(
- xsdTypeDefinition.getURI(),
- xsdTypeDefinition.getName());
- } else {
- eClassifier = super.getEClassifier(xsdTypeDefinition);
- }
- return eClassifier;
- }
-
- public EDataType getEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
- EDataType eClassifier = null;
- if (rootSchema.getSchemaForSchemaNamespace().equals(xsdSimpleTypeDefinition.getTargetNamespace())) {
- eClassifier =
- (EDataType)getBuiltInEClassifier(
- xsdSimpleTypeDefinition.getURI(),
- xsdSimpleTypeDefinition.getName());
- } else {
- eClassifier = super.getEDataType(xsdSimpleTypeDefinition);
- }
- return (EDataType)eClassifier;
- }
-
- protected EClassifier getBuiltInEClassifier(String namespace, String name)
- {
- EClassifier eClassifier = (EClassifier)SDOUtil.getXSDSDOType(name);
- if (eClassifier == null) {
- eClassifier = super.getBuiltInEClassifier(namespace, name);
- }
- return eClassifier;
- }
-
- public EClass computeEClass(XSDComplexTypeDefinition xsdComplexTypeDefinition) {
- EClass eclass = super.computeEClass(xsdComplexTypeDefinition);
- String aliasNames = getEcoreAttribute(xsdComplexTypeDefinition.getElement(), "aliasName");
- if (aliasNames != null) {
- SDOExtendedMetaData.INSTANCE.setAliasNames(eclass, aliasNames);
- }
- return eclass;
- }
-
- protected EClassifier computeEClassifier(XSDTypeDefinition xsdTypeDefinition) {
- EClassifier eclassifier = super.computeEClassifier(xsdTypeDefinition);
- EClassifier etype = (EClassifier) typeToTypeObjectMap.get(eclassifier);
- String aliasNames = getEcoreAttribute(xsdTypeDefinition.getElement(), "aliasName");
- if (aliasNames != null) {
- SDOExtendedMetaData.INSTANCE.setAliasNames(eclassifier, aliasNames);
- if (etype != null) {
- SDOExtendedMetaData.INSTANCE.setAliasNames(etype, aliasNames);
- }
- }
- return eclassifier;
- }
-
- protected EDataType computeEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
- EDataType edatatype = super.computeEDataType(xsdSimpleTypeDefinition);
- String aliasNames = getEcoreAttribute(xsdSimpleTypeDefinition.getElement(), "aliasName");
- if (aliasNames != null) {
- SDOExtendedMetaData.INSTANCE.setAliasNames(edatatype, aliasNames);
- }
- return edatatype;
- }
-
- protected EEnum computeEEnum(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
- return null;
- }
-
- protected EStructuralFeature createFeature(EClass eClass, String name, EClassifier type, XSDComponent xsdComponent, int minOccurs, int maxOccurs) {
- EStructuralFeature feature =
- super.createFeature(eClass, name, type, xsdComponent, minOccurs, maxOccurs);
- feature.setName(name); // this is needed because super.createFeature() does EMF name mangling (toLower)
- if (xsdComponent != null) {
- String aliasNames = getEcoreAttribute(xsdComponent.getElement(), "aliasName");
- if (aliasNames != null) {
- SDOExtendedMetaData.INSTANCE.setAliasNames(feature, aliasNames);
- }
- }
- return feature;
- }
-
- protected String getInstanceClassName(XSDTypeDefinition typeDefinition, EDataType baseEDataType) {
- String name = getEcoreAttribute(typeDefinition, "extendedInstanceClass");
- return (name != null) ? name : super.getInstanceClassName(typeDefinition, baseEDataType);
- }
-
- protected String getEcoreAttribute(Element element, String attribute)
- {
- String sdoAttribute = null;
-
- if ("name".equals(attribute))
- sdoAttribute = "name";
- else if ("opposite".equals(attribute))
- sdoAttribute = "oppositeProperty";
- else if ("mixed".equals(attribute))
- sdoAttribute = "sequence";
- else if ("string".equals(attribute))
- sdoAttribute = "string";
- else if ("changeable".equals(attribute))
- sdoAttribute = "readOnly";
- else if ("aliasName".equals(attribute))
- sdoAttribute = "aliasName";
-
- if (sdoAttribute != null)
- {
- String value =
- element != null && element.hasAttributeNS("commonj.sdo/xml", sdoAttribute) ?
- element.getAttributeNS("commonj.sdo/xml", sdoAttribute) :
- null;
- if ("changeable".equals(attribute)) {
- if ("true".equals(value)) value = "false";
- else if ("false".equals(value)) value = "true";
- }
- return value;
- }
-
- if ("package".equals(attribute))
- sdoAttribute = "package";
- else if ("instanceClass".equals(attribute))
- sdoAttribute = "instanceClass";
- else if ("extendedInstanceClass".equals(attribute))
- sdoAttribute = "extendedInstanceClass";
- else if ("nestedInterfaces".equals(attribute))
- sdoAttribute = "nestedInterfaces";
-
- if (sdoAttribute != null)
- {
- return
- element != null && element.hasAttributeNS("commonj.sdo/java", sdoAttribute) ?
- element.getAttributeNS("commonj.sdo/java", sdoAttribute) :
- null;
- }
-
- return super.getEcoreAttribute(element, attribute);
- }
-
- protected String getEcoreAttribute(XSDConcreteComponent xsdConcreteComponent, String attribute)
- {
- String value = super.getEcoreAttribute(xsdConcreteComponent, attribute);
- if ("package".equals(attribute) && value == null)
- {
- XSDSchema xsdSchema = (XSDSchema)xsdConcreteComponent;
- value = getDefaultPackageName(xsdSchema.getTargetNamespace());
- }
- return value;
- }
-
- protected XSDTypeDefinition getEcoreTypeQNameAttribute(XSDConcreteComponent xsdConcreteComponent, String attribute)
- {
- if (xsdConcreteComponent == null) return null;
- String sdoAttribute = null;
-
- if ("reference".equals(attribute)) sdoAttribute = "propertyType";
- if ("dataType".equals(attribute)) sdoAttribute = "dataType";
-
- if (sdoAttribute != null)
- {
- Element element = xsdConcreteComponent.getElement();
- return element == null ? null : getEcoreTypeQNameAttribute(xsdConcreteComponent, element, "commonj.sdo/xml", sdoAttribute);
- }
-
- return super.getEcoreTypeQNameAttribute(xsdConcreteComponent, attribute);
- }
-
- /**
- * Override default EMF behavior so that the name is not mangled.
- */
- protected String validName(String name, int casing, String prefix) {
- return name;
- }
-
- /**
- * Override default EMF name mangling for anonymous types (simple and complex)
- */
- protected String validAliasName(XSDTypeDefinition xsdTypeDefinition, boolean isUpperCase) {
- return getAliasName(xsdTypeDefinition);
- }
-
- protected String getAliasName(XSDNamedComponent xsdNamedComponent) {
- String result = xsdNamedComponent.getName();
- if (result == null)
- {
- XSDConcreteComponent container = xsdNamedComponent.getContainer();
- if (container instanceof XSDNamedComponent)
- {
- result = getAliasName((XSDNamedComponent)container);
- }
- }
- return result;
- }
-
- protected XSDTypeDefinition getEffectiveTypeDefinition(XSDComponent xsdComponent, XSDFeature xsdFeature) {
- XSDTypeDefinition typeDef = getEcoreTypeQNameAttribute(xsdComponent, "dataType");
-
- String isString = getEcoreAttribute(xsdComponent, xsdFeature, "string");
- if ("true".equalsIgnoreCase(isString)) {
- typeDef =
- xsdFeature.resolveSimpleTypeDefinition(rootSchema.getSchemaForSchemaNamespace(), "string");
- }
- if (typeDef == null)
- typeDef = xsdFeature.getType();
- return typeDef;
- }
-
- //Code below here to provide common URI to java packagname
-
- public static String uncapNameStatic(String name)
- {
- if (name.length() == 0)
- {
- return name;
- }
- else
- {
- String lowerName = name.toLowerCase();
- int i;
- for (i = 0; i < name.length(); i++)
- {
- if (name.charAt(i) == lowerName.charAt(i))
- {
- break;
- }
- }
- if (i > 1 && i < name.length() && !Character.isDigit(name.charAt(i)))
- {
- --i;
- }
- return name.substring(0, i).toLowerCase() + name.substring(i);
- }
- }
-
-protected static String validNameStatic(String name, int casing, String prefix)
- {
- List parsedName = parseNameStatic(name, '_');
- StringBuffer result = new StringBuffer();
- for (Iterator i = parsedName.iterator(); i.hasNext(); )
- {
- String nameComponent = (String)i.next();
- if (nameComponent.length() > 0)
- {
- if (result.length() > 0 || casing == UPPER_CASE)
- {
- result.append(Character.toUpperCase(nameComponent.charAt(0)));
- result.append(nameComponent.substring(1));
- }
- else
- {
- result.append(nameComponent);
- }
- }
- }
-
- return
- result.length() == 0 ?
- prefix :
- Character.isJavaIdentifierStart(result.charAt(0)) ?
- casing == LOWER_CASE ?
- uncapNameStatic(result.toString()) :
- result.toString() :
- prefix + result;
- }
-
- protected static List parseNameStatic(String sourceName, char separator)
- {
- List result = new ArrayList();
- if (sourceName != null)
- {
- StringBuffer currentWord = new StringBuffer();
- boolean lastIsLower = false;
- for (int index = 0, length = sourceName.length(); index < length; ++index)
- {
- char curChar = sourceName.charAt(index);
- if (!Character.isJavaIdentifierPart(curChar))
- {
- curChar = separator;
- }
- if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == separator)
- {
- if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0)
- {
- result.add(currentWord.toString());
- currentWord = new StringBuffer();
- }
- lastIsLower = false;
- }
- else
- {
- if (!lastIsLower)
- {
- int currentWordLength = currentWord.length();
- if (currentWordLength > 1)
- {
- char lastChar = currentWord.charAt(--currentWordLength);
- currentWord.setLength(currentWordLength);
- result.add(currentWord.toString());
- currentWord = new StringBuffer();
- currentWord.append(lastChar);
- }
- }
- lastIsLower = true;
- }
-
- if (curChar != separator)
- {
- currentWord.append(curChar);
- }
- }
-
- result.add(currentWord.toString());
- }
- return result;
- }
-
-public static String getDefaultPackageName(String targetNamespace)
- {
-
- URI uri = URI.createURI(targetNamespace);
- List parsedName;
- if (uri.isHierarchical())
- {
- String host = uri.host();
- if (host != null && host.startsWith("www."))
- {
- host = host.substring(4);
- }
- parsedName = parseNameStatic(host, '.');
- Collections.reverse(parsedName);
- if (!parsedName.isEmpty())
- {
- parsedName.set(0, ((String)parsedName.get(0)).toLowerCase());
- }
-
- parsedName.addAll(parseNameStatic(uri.trimFileExtension().path(), '/'));
- }
- else
- {
- String opaquePart = uri.opaquePart();
- int index = opaquePart.indexOf(":");
- if (index != -1 && "urn".equalsIgnoreCase(uri.scheme()))
- {
- parsedName = parseNameStatic(opaquePart.substring(0, index), '-');
- if (parsedName.size() > 0 && DOMAINS.contains(parsedName.get(parsedName.size() - 1)))
- {
- Collections.reverse(parsedName);
- parsedName.set(0, ((String)parsedName.get(0)).toLowerCase());
- }
- parsedName.addAll(parseNameStatic(opaquePart.substring(index + 1), '/'));
- }
- else
- {
- parsedName = parseNameStatic(opaquePart, '/');
- }
- }
-
- StringBuffer qualifiedPackageName = new StringBuffer();
- for (Iterator i = parsedName.iterator(); i.hasNext(); )
- {
- String packageName = (String)i.next();
- if (packageName.length() > 0)
- {
- if (qualifiedPackageName.length() > 0)
- {
- qualifiedPackageName.append('.');
- }
- qualifiedPackageName.append(validNameStatic(packageName, LOWER_CASE,"_"));
- }
- }
-
- return qualifiedPackageName.toString().toLowerCase(); //make sure it's lower case .. we can't work with Axis if not.
- }
-
-
-}
diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java deleted file mode 100644 index f4d39670b6..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; -import org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.util.ExtendedMetaData; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.helper.TypeHelper; - - -/** - * Look up a Type given the uri and typeName or interfaceClass. - * SDO Types are available through the - * getType("commonj.sdo", typeName) method. - * Defines Types from DataObjects. - */ -public class TypeHelperImpl implements TypeHelper -{ - protected ExtendedMetaData extendedMetaData; - - public ExtendedMetaData getExtendedMetaData() - { - return extendedMetaData; - } - - public TypeHelperImpl(ExtendedMetaData extendedMetaData) - { - this.extendedMetaData = extendedMetaData; - - // Register the standard (predefined) SDO types - ModelPackageImpl.init(); - JavaPackageImpl.init(); - MetadataPackageImpl.init(); - } - - public Type getType(String uri, String typeName) - { - EPackage ePackage = extendedMetaData.getPackage(uri); - if (ePackage != null) - { - EClassifier eClassifier = ePackage.getEClassifier(typeName); - if (eClassifier == null) - { - eClassifier = extendedMetaData.getType(ePackage, typeName); - } - return (Type)eClassifier; - } - return null; - } - - public Type getType(Class interfaceClass) - { - Type type = SDOUtil.getJavaSDOType(interfaceClass); - if (type != null) - { - return type; - } - - //TODO more efficient implementation ... this is a really bad one! - for (Iterator iter = EPackage.Registry.INSTANCE.values().iterator(); iter.hasNext(); ) - { - Object value = iter.next(); - if (value instanceof EPackage) - { - EPackage ePackage = (EPackage)value; - for (Iterator iter2 = ePackage.getEClassifiers().iterator(); iter2.hasNext(); ) - { - EClassifier eClassifier = (EClassifier)iter2.next(); - if (eClassifier.getInstanceClass() == interfaceClass) - { - return (Type)eClassifier; - } - } - } - } - - return null; - } - - public Type define(DataObject type) - { - if (!(type instanceof org.apache.tuscany.sdo.model.Type)) - throw new IllegalArgumentException(); - org.apache.tuscany.sdo.model.Type modeledType = (org.apache.tuscany.sdo.model.Type)type; - - boolean isDataType = modeledType.isDataType(); - Type definedType = SDOUtil.createType(this, modeledType.getUri(), modeledType.getName(), isDataType); - - SDOUtil.setJavaClassName(definedType, modeledType.getInstanceClassName()); - - if (!isDataType) - { - SDOUtil.setSequenced(definedType, modeledType.isSequenced()); - SDOUtil.setOpen(definedType, modeledType.isOpen()); - SDOUtil.setAbstract(definedType, modeledType.isAbstract()); - - for (Iterator iter = modeledType.getBaseType().iterator(); iter.hasNext(); ) - { - Type baseType = getDefinedType((org.apache.tuscany.sdo.model.Type)iter.next()); - SDOUtil.addBaseType(definedType, baseType); - } - - for (Iterator iter = modeledType.getAliasName().iterator(); iter.hasNext(); ) - { - String aliasName = (String)iter.next(); - SDOUtil.addAliasName(definedType, aliasName); - } - - for (Iterator iter = modeledType.getProperty().iterator(); iter.hasNext(); ) - { - org.apache.tuscany.sdo.model.Property modeledProperty = (org.apache.tuscany.sdo.model.Property)iter.next(); - - Type propertyType = getDefinedType(modeledProperty.getType_()); - Property definedProperty = SDOUtil.createProperty(definedType, modeledProperty.getName(), propertyType); - - SDOUtil.setMany(definedProperty, modeledProperty.isMany()); - SDOUtil.setDefault(definedProperty, modeledProperty.getDefault_()); - SDOUtil.setReadOnly(definedProperty, modeledProperty.isReadOnly()); - - for (Iterator iter2 = modeledProperty.getAliasName().iterator(); iter2.hasNext(); ) - { - String aliasName = (String)iter2.next(); - SDOUtil.addAliasName(definedProperty, aliasName); - } - - if (!propertyType.isDataType()) - { - SDOUtil.setContainment(definedProperty, modeledProperty.isContainment()); - if (modeledProperty.getOpposite_() != null) - { - SDOUtil.setOpposite(definedProperty, getDefinedProperty(modeledProperty.getOpposite_())); - } - } - } - } // if (!isDataType) - - return definedType; - } - - public List /*Type*/define(List /*DataObject*/types) - { - int count = types.size(); - List definedTypes = new ArrayList(count); - for (int i = 0; i < count; i++) - { - definedTypes.add(define((DataObject)types.get(i))); - } - return definedTypes; - } - - protected Type getDefinedType(org.apache.tuscany.sdo.model.Type modeledType) - { - if (modeledType instanceof Type) - { - return (Type)modeledType; - } - else - { - EClassifier eClassifier = extendedMetaData.getType(modeledType.getUri(), modeledType.getName()); - if (eClassifier != null) - { - return (Type)eClassifier; - } - else - { - return define((DataObject)modeledType); - } - } - } - - protected Property getDefinedProperty(org.apache.tuscany.sdo.model.Property modeledProperty) - { - if (modeledProperty instanceof Property) - { - return (Property)modeledProperty; - } - else - { - DataObject modeledContainingType = ((DataObject)modeledProperty).getContainer(); - - Type definedContainingType = getDefinedType((org.apache.tuscany.sdo.model.Type)modeledContainingType); - String propertyName = modeledProperty.getName(); - - return definedContainingType.getProperty(propertyName); - } - } - -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java deleted file mode 100644 index 72fdc93f60..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java +++ /dev/null @@ -1,553 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sdo.SDOFactory; -import org.apache.tuscany.sdo.SDOPackage; -import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; -import org.apache.tuscany.sdo.util.DataObjectUtil; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.eclipse.emf.common.util.EMap; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.ExtendedMetaData; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.ecore.xmi.XMLOptions; -import org.eclipse.emf.ecore.xmi.XMLParserPool; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMLOptionsImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl; -import org.eclipse.emf.ecore.xml.type.XMLTypePackage; -import org.xml.sax.InputSource; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.XMLDocument; - - -/** - * Represents an XML Document containing a tree of DataObjects. - * - * An example XMLDocument fragment is: - * <?xml version="1.0"?> - * <purchaseOrder orderDate="1999-10-20"> - * - * created from this XML Schema fragment: - * <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - * <xsd:element name="purchaseOrder" type="PurchaseOrderType"/> - * <xsd:complexType name="PurchaseOrderType"> - * - * Upon loading this XMLDocument: - * DataObject is an instance of Type PurchaseOrderType. - * RootElementURI is null because the XSD has no targetNamespace URI. - * RootElementName is purchaseOrder. - * Encoding is null because the document did not specify an encoding. - * XMLDeclaration is true because the document contained an XML declaration. - * XMLVersion is 1.0 - * SchemaLocation and noNamespaceSchemaLocation are null because they are - * not specified in the document. - * - * When saving the root element, if the type of the root dataObject is not the - * type of global element specified by rootElementURI and rootElementName, - * or if a global element does not exist for rootElementURI and rootElementName, - * then an xsi:type declaration is written to record the root DataObject's Type. - * - * When loading the root element and an xsi:type declaration is found - * it is used as the type of the root DataObject. In this case, - * if validation is not being performed, it is not an error if the - * rootElementName is not a global element. - */ -public class XMLDocumentImpl implements XMLDocument -{ - protected ExtendedMetaData extendedMetaData; - - protected EObject rootObject; - - protected XMLResource resource; - - protected EStructuralFeature rootElement; - - protected EObject documentRoot; - - protected final static String WHITESPACE_REGEX = "\\s"; - - protected static XMLParserPool globalXMLParserPool = new XMLParserPoolImpl(); - - //TODO clean up the options thing - protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, Object options) - { - this.extendedMetaData = extendedMetaData; - ResourceSet resourceSet = DataObjectUtil.createResourceSet(); - - if (options instanceof Map) - { - Class resourceFactoryClass = (Class)((Map)options).get("GENERATED_LOADER"); - if (resourceFactoryClass != null) - { - try - { - Object resourceFactory = resourceFactoryClass.newInstance(); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - - resource = (XMLResource)resourceSet.createResource(URI.createURI("http:///temp.xml")); - - 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); - } - - protected XMLDocumentImpl(ExtendedMetaData extendedMetaData) - { - this(extendedMetaData, null); - } - - protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, DataObject dataObject, String rootElementURI, String rootElementName) - { - this(extendedMetaData); - - rootObject = (EObject)dataObject; - - rootElement = extendedMetaData.getElement(rootElementURI, rootElementName); - if (rootElement == null) - { - rootElement = ExtendedMetaData.INSTANCE.demandFeature(rootElementURI, rootElementName, true); - } - - EClass documentRootClass = rootElement.getEContainingClass(); - documentRoot = EcoreUtil.create(documentRootClass); - resource.getContents().add(documentRoot); - } - - protected void save(OutputStream outputStream, Object options) throws IOException - { - EObject oldContainer = null; - EReference oldContainmentReference = null; - int oldContainmentIndex = -1; - - if (documentRoot != null) - { - //TODO also check if rootObject is directly contained in a resource - oldContainer = rootObject.eContainer(); - if (oldContainer != null) - { - oldContainmentReference = rootObject.eContainmentFeature(); - } - if (oldContainer != documentRoot || oldContainmentReference != rootElement) - { - if (oldContainmentReference != null && oldContainmentReference.isMany()) - { - oldContainmentIndex = ((List)oldContainer.eGet(oldContainmentReference)).indexOf(rootObject); - } - - Object rootValue = - rootElement instanceof EAttribute && rootObject instanceof SimpleAnyTypeDataObject ? - ((SimpleAnyTypeDataObject)rootObject).getValue() : rootObject; - - documentRoot.eSet(rootElement, rootValue); - } - } - - resource.save(outputStream, (Map)options); - - if (oldContainer != null) - { - if (oldContainer != documentRoot || oldContainmentReference != rootElement) - { - if (oldContainmentReference.isMany()) - { - ((List)oldContainer.eGet(oldContainmentReference)).add(oldContainmentIndex, rootObject); - } - else - { - oldContainer.eSet(oldContainmentReference, rootObject); - } - } - } - else if (documentRoot != null) - { - documentRoot.eSet(rootElement, null); - } - } - - protected void save(Writer outputWriter, Object options) throws IOException - { - // TODO temporary brute-force implementation ... to be replaced - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - save(outputStream, options); - outputWriter.write(new String(outputStream.toByteArray())); - } - - protected void load(InputStream inputStream, String locationURI, Object options) throws IOException - { - InputSource inputSource = new InputSource(inputStream); - load(inputSource, locationURI, options); - } - - protected void load(Reader inputReader, String locationURI, Object options) throws IOException - { - InputSource inputSource = new InputSource(inputReader); - load(inputSource, locationURI, options); - } - - protected void load(InputSource inputSource, String locationURI, Object options) throws IOException - { - rootObject = null; - rootElement = null; - documentRoot = null; - - if (locationURI != null) - { - inputSource.setSystemId(locationURI); - resource.setURI(URI.createURI(locationURI)); - } - - resource.load(inputSource, (Map)options); - - if (!resource.getContents().isEmpty()) - { - documentRoot = (EObject)resource.getContents().get(0); - EClass documentRootClass = documentRoot.eClass(); - if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this? - { - FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature - int size = featureMap.size(); - for (int index = 0; index < size; index++) - { - EStructuralFeature feature = featureMap.getEStructuralFeature(index); - boolean isText = - feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT || - feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA || - feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT; - if (!isText) - { - if (feature instanceof EReference) - { - rootObject = (EObject)featureMap.getValue(index); - documentRoot.eUnset(feature); - } - else //EAttribute - { - rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index)); - } - rootElement = feature; - break; - } - } //for - } - else - { - rootObject = documentRoot; - documentRoot = null; - } - } - } - - public DataObject getRootObject() - { - return (DataObject)rootObject; - } - - public String getRootElementURI() - { - if (rootElement != null) - { - return extendedMetaData.getNamespace(rootElement); - } - else if (rootObject != null) - { - return extendedMetaData.getNamespace(rootObject.eClass()); - } - return null; - } - - public String getRootElementName() - { - if (rootElement != null) - { - return extendedMetaData.getName(rootElement); - } - else if (rootObject != null) - { - return extendedMetaData.getName(rootObject.eClass()); - } - return null; - } - - public String getEncoding() - { - return resource.getEncoding(); - } - - public void setEncoding(String encoding) - { - resource.setEncoding(encoding); - } - - public boolean isXMLDeclaration() - { - return Boolean.FALSE.equals(resource.getDefaultSaveOptions().get(XMLResource.OPTION_DECLARE_XML)); - } - - public void setXMLDeclaration(boolean xmlDeclaration) - { - resource.getDefaultSaveOptions().put(XMLResource.OPTION_DECLARE_XML, xmlDeclaration ? Boolean.TRUE : Boolean.FALSE); - } - - public String getXMLVersion() - { - return resource.getXMLVersion(); - } - - public void setXMLVersion(String xmlVersion) - { - resource.setXMLVersion(xmlVersion); - } - - /** - * @return an EMap containing the schema locations or null when no map - */ - protected EMap getSchemaLocationMap() - { - EMap result = null; - if ((documentRoot != null) && (extendedMetaData != null)) - { - EReference xsiSchemaLocationMapFeature = extendedMetaData - .getXSISchemaLocationMapFeature(documentRoot.eClass()); - if (xsiSchemaLocationMapFeature != null) - { - result = (EMap) documentRoot.eGet(xsiSchemaLocationMapFeature); - } - } - return result; - } - - /** - * @param value - * from schema location map. - * @return string form of URI from provided value, deresolved if appropriate. - */ - protected String deresolve(String value) - { - URI location = URI.createURI(value); - URI resourceURI = resource.getURI(); - boolean shouldDeresolve = resourceURI != null && !resourceURI.isRelative() - && resourceURI.isHierarchical(); - if (shouldDeresolve && !location.isRelative()) - { - URI deresolvedURI = location.deresolve(resourceURI, true, true, false); - if (deresolvedURI.hasRelativePath()) - { - location = deresolvedURI; - } - } - return location.toString(); - } - - /** - * @param value - * for schema location from input parameter. - * @return string form of URI from provided value, resolved if appropriate. - */ - protected String resolve(String value) - { - URI location = URI.createURI(value); - URI resourceURI = resource.getURI(); - boolean shouldResolve = resourceURI != null && resourceURI.isHierarchical() - && !resourceURI.isRelative(); - if (shouldResolve && location.isRelative() && location.hasRelativePath()) - { - location = location.resolve(resourceURI, false); - } - return location.toString(); - } - - public String getSchemaLocation() - { - EMap xsiSchemaLocationMap = getSchemaLocationMap(); - if (xsiSchemaLocationMap != null) - { - if (!xsiSchemaLocationMap.isEmpty()) - { - StringBuffer xsiSchemaLocation = new StringBuffer(); - for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i - .hasNext();) - { - Map.Entry entry = (Map.Entry) i.next(); - String namespace = (String) entry.getKey(); - if (namespace != null) - { - if (xsiSchemaLocation.length() > 0) - { - xsiSchemaLocation.append(' '); - } - xsiSchemaLocation.append(namespace); - xsiSchemaLocation.append(' '); - String value = entry.getValue().toString(); - xsiSchemaLocation.append(deresolve(value)); - } - } - return xsiSchemaLocation.toString().equals("") ? null - : xsiSchemaLocation.toString(); - } - } - return null; - } - - public void setSchemaLocation(String schemaLocation) - { - EMap xsiSchemaLocationMap = getSchemaLocationMap(); - if (xsiSchemaLocationMap != null) - { - // only remove the entries from xsiSchemaLocationMap that contain a - // non-null key - for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i.hasNext();) - { - Map.Entry entry = (Map.Entry) i.next(); - if (entry.getKey() != null) - { - i.remove(); - } - } - if (xsiSchemaLocationMap.size() == 0) - { - resource.getDefaultSaveOptions().put( - XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE); - } - if (schemaLocation != null) - { - String[] values = schemaLocation.split(WHITESPACE_REGEX); - for (int i = 0; i < values.length; i++) // note: also incremented in - // loop - { - String key = values[i++]; - if (i < values.length) - { - xsiSchemaLocationMap.put(key, resolve(values[i])); - } - } - if (xsiSchemaLocationMap.size() != 0) - { - resource.getDefaultSaveOptions().put( - XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - } - } - } - } - - public String getNoNamespaceSchemaLocation() - { - EMap xsiSchemaLocationMap = getSchemaLocationMap(); - if (xsiSchemaLocationMap != null) - { - StringBuffer xsiSchemaLocation = new StringBuffer(); - if (!xsiSchemaLocationMap.isEmpty()) - { - Object valueObject = xsiSchemaLocationMap.get(null); - if (valueObject != null) - { - String valueString = (String) valueObject; - String[] values = valueString.split(WHITESPACE_REGEX); - for (int i = 0; i < values.length; i++) - { - if (xsiSchemaLocation.length() > 0) - { - xsiSchemaLocation.append(' '); - } - xsiSchemaLocation.append(deresolve(values[i])); - } - } - String result = xsiSchemaLocation.toString(); - return result.equals("") ? null : result; - } - } - return null; - } - - public void setNoNamespaceSchemaLocation(String schemaLocation) - { - EMap xsiSchemaLocationMap = getSchemaLocationMap(); - if (xsiSchemaLocationMap != null) - { - // only remove the entries from xsiSchemaLocationMap that contain a null - // key - xsiSchemaLocationMap.removeKey(null); - if (xsiSchemaLocationMap.size() == 0) - { - resource.getDefaultSaveOptions().put( - XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE); - } - if (schemaLocation != null) - { - String[] values = schemaLocation.split(WHITESPACE_REGEX); - for (int i = 0; i < values.length; i++) - { - xsiSchemaLocationMap.put(null, resolve(values[i])); - } - if (xsiSchemaLocationMap.size() != 0) - { - resource.getDefaultSaveOptions().put( - XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - } - } - } - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java deleted file mode 100644 index 653665e1b8..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -import org.eclipse.emf.ecore.util.ExtendedMetaData; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; - -/** - * A helper to convert XML documents into DataObects and - * DataObjects into XML documnets. - */ -public class XMLHelperImpl implements XMLHelper -{ - ExtendedMetaData extendedMetaData; - - public XMLHelperImpl(ExtendedMetaData extendedMetaData) - { - this.extendedMetaData = extendedMetaData; - } - - public XMLHelperImpl(TypeHelper typeHelper) - { - this.extendedMetaData = ((TypeHelperImpl)typeHelper).extendedMetaData; - } - - public XMLDocument load(String inputString) - { - try - { - return load(new StringReader(inputString), null, null); - } - catch (IOException e) - { - throw new RuntimeException(e); // should never happen - } - } - - public XMLDocument load(InputStream inputStream) throws IOException - { - return load(inputStream, null, null); - } - - public XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException - { - XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options); - document.load(inputStream, locationURI, options); - return document; - } - - public XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException - { - XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options); - document.load(inputReader, locationURI, options); - return document; - } - - public String save(DataObject dataObject, String rootElementURI, String rootElementName) - { - StringWriter stringWriter = new StringWriter(); - try - { - save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, null); - return stringWriter.toString(); - } - catch (IOException e) - { - throw new RuntimeException(e); // should never happen - } - } - - public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws IOException - { - save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null); - } - - public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException - { - ((XMLDocumentImpl)xmlDocument).save(outputStream, options); - } - - public void save(XMLDocument xmlDocument, Writer outputWriter, Object options) throws IOException - { - ((XMLDocumentImpl)xmlDocument).save(outputWriter, options); - } - - public XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName) - { - return new XMLDocumentImpl(extendedMetaData, dataObject, rootElementURI, rootElementName); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java deleted file mode 100644 index ace561e28f..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.DataObject; - -import org.apache.tuscany.sdo.XMLStreamHelper; - -/** - * @version $Rev$ $Date$ - */ -public class XMLStreamHelperImpl implements XMLStreamHelper { - public XMLDocument load(XMLStreamReader reader) throws XMLStreamException, IllegalStateException { - throw new UnsupportedOperationException(); - } - - public void save(XMLDocument document, XMLStreamWriter writer) throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public XMLStreamReader createXMLStreamReader(XMLDocument document) throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public DataObject loadObject(XMLStreamReader reader) throws XMLStreamException, IllegalStateException { - throw new UnsupportedOperationException(); - } - - public void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public XMLStreamReader createXMLStreamReader(DataObject sdo) { - throw new UnsupportedOperationException(); - } -} diff --git a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java b/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java deleted file mode 100644 index 2194b0c6ce..0000000000 --- a/tags/java-M1-final/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ -package org.apache.tuscany.sdo.helper; - - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl; -import org.apache.tuscany.sdo.util.DataObjectUtil; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.ExtendedMetaData; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.ecore.XSDEcoreBuilder; -import org.eclipse.xsd.util.XSDResourceImpl; -import org.xml.sax.InputSource; - -import commonj.sdo.Property; -import commonj.sdo.Type; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XSDHelper; - - -/** - * Provides access to additional information when the - * Type or Property is defined by an XML Schema (XSD). - * Methods return null/false otherwise or if the information is unavailable. - * Defines Types from an XSD. - */ -public class XSDHelperImpl implements XSDHelper -{ - private XSDEcoreBuilder ecoreBuilder; - - private ExtendedMetaData extendedMetaData; - - public XSDHelperImpl(ExtendedMetaData extendedMetaData) - { - this.extendedMetaData = extendedMetaData; - ecoreBuilder = new SDOXSDEcoreBuilder(extendedMetaData); - } - - public XSDHelperImpl(TypeHelper typeHelper) - { - this(((TypeHelperImpl)typeHelper).extendedMetaData); - } - - public String getLocalName(Type type) - { - return extendedMetaData.getName((EClassifier)type); - } - - public String getLocalName(Property property) - { - return extendedMetaData.getName((EStructuralFeature)property); - } - - public String getNamespaceURI(Property property) - { - return extendedMetaData.getNamespace((EStructuralFeature)property); - } - - public boolean isAttribute(Property property) - { - return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ATTRIBUTE_FEATURE; - } - - public boolean isElement(Property property) - { - return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ELEMENT_FEATURE; - } - - public boolean isMixed(Type type) - { - if (type instanceof EClass) - { - return extendedMetaData.getContentKind((EClass)type) == ExtendedMetaData.MIXED_CONTENT; - } - else - { - return false; - } - } - - public boolean isXSD(Type type) - { - return ((EModelElement)type).getEAnnotation(ExtendedMetaData.ANNOTATION_URI) != null; - } - - public Property getGlobalProperty(String uri, String propertyName, boolean isElement) - { - if (isElement) - { - return (Property)extendedMetaData.getElement(uri, propertyName); - } - else - { - return (Property)extendedMetaData.getAttribute(uri, propertyName); - } - } - - public String getAppinfo(Type type, String source) - { - return getAppinfo((EModelElement)type, source); - } - - public String getAppinfo(Property property, String source) - { - return getAppinfo((EModelElement)property, source); - } - - protected String getAppinfo(EModelElement eModelElement, String source) - { - return (String)eModelElement.getEAnnotation(source).getDetails().get("appinfo"); - } - - public List /*Type*/define(String xsd) - { - InputStream inputStream = new ByteArrayInputStream(xsd.getBytes()); - return define(inputStream, "*.xsd"); - - } - - public List /*Type*/define(Reader xsdReader, String schemaLocation) - { - - InputSource inputSource = new InputSource(xsdReader); - return define(inputSource, schemaLocation); - - } - - public List /*Type*/define(InputStream xsdInputStream, String schemaLocation) - { - InputSource inputSource = new InputSource(xsdInputStream); - return define(inputSource, schemaLocation); - } - - protected List /*Type*/define(InputSource inputSource, String schemaLocation) - { - try - { - ResourceSet resourceSet = DataObjectUtil.createResourceSet(); - Resource model = resourceSet.createResource(URI.createURI(schemaLocation != null ? schemaLocation : "null.xsd")); - ((XSDResourceImpl)model).load(inputSource, null); - - List newTypes = new ArrayList(); - for (Iterator schemaIter = model.getContents().iterator(); schemaIter.hasNext(); ) - { - XSDSchema schema = (XSDSchema)schemaIter.next(); - - EPackage ePackage = extendedMetaData.getPackage(schema.getTargetNamespace()); - if (ePackage == null) - { - Collection originalEPackages = new HashSet(ecoreBuilder.getTargetNamespaceToEPackageMap().values()); - ecoreBuilder.generate(schema); - Collection newEPackages = ecoreBuilder.getTargetNamespaceToEPackageMap().values(); - - for (Iterator iter = newEPackages.iterator(); iter.hasNext();) - { - EPackage currentPackage = (EPackage)iter.next(); - if (!originalEPackages.contains(currentPackage)) - { - currentPackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); - EcoreUtil.freeze(currentPackage); - newTypes.addAll(currentPackage.getEClassifiers()); - } - } - } - } - - return newTypes; - } - catch (Exception e) - { - //e.printStackTrace(); - throw new IllegalArgumentException(e.getMessage()); - } - } - - public String generate(List /*Type*/types) - { - throw new UnsupportedOperationException(); //TODO - } - - public String generate(List /*Type*/types, Map /*String, String*/namespaceToSchemaLocation) - { - throw new UnsupportedOperationException(); //TODO - } - -} |