You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2008/07/28 16:30:24 UTC

svn commit: r680370 [3/22] - in /tuscany/java/sdo: distribution/src/main/assembly/ distribution/src/main/release/bin/ distribution/src/main/release/bin/samples/ impl/ impl/src/main/java/org/apache/tuscany/sdo/helper/ impl/src/main/java/org/apache/tusca...

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/BaseSDOXSDEcoreBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CrossScopeCopyHelperImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CrossScopeCopyHelperImpl.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CrossScopeCopyHelperImpl.java (original)
+++ tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CrossScopeCopyHelperImpl.java Mon Jul 28 07:30:12 2008
@@ -1,255 +1,255 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.helper;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Type;
-import commonj.sdo.helper.CopyHelper;
-import commonj.sdo.helper.TypeHelper;
-
-/**
- * A CopyHelper implementation that creates the copy objects in a specific metadata scope.
- * The target scope must contain a compatible version of the Types needed to create the copy objects.
- */
-public class CrossScopeCopyHelperImpl implements CopyHelper 
-{
-  protected TypeHelper scope;
-    
-  public CrossScopeCopyHelperImpl(TypeHelper targetScope)
-  {
-    scope = targetScope;
-  }
-    
-  public DataObject copyShallow(DataObject dataObject)
-  {
-    Copier copier = new CrossScopeCopier()
-    {
-      protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject)
-      {
-      }
-      protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject)
-      {
-        if (eObject.eIsSet(eAttribute) && !FeatureMapUtil.isFeatureMap(eAttribute))
-		{
-		  super.copyAttribute(eAttribute,eObject,copyEObject);
-		}
-	  }
-    };
-    EObject result = copier.copy((EObject)dataObject);
-    copier.copyReferences();
-    return (DataObject)result;
-  }
-
-  public DataObject copy(DataObject dataObject)
-  {
-    Copier copier = new CrossScopeCopier();
-    DataObject result = (DataObject)copier.copy((EObject)dataObject);
-    copier.copyReferences();
-    return (DataObject)result;
-  }
-    
-  protected class CrossScopeCopier extends EcoreUtil.Copier
-  {
-    protected boolean useOriginalReferences = false;
-      
-    protected EClass getTarget(EClass eClass)
-    {
-      EClass target = (EClass)get(eClass);
-      if (target == null)
-      {
-        Type type = (Type)eClass;
-        target = (EClass)scope.getType(type.getURI(), type.getName());
-      }
-      return target;
-    }
-      
-    protected EStructuralFeature getTarget(EStructuralFeature eStructuralFeature)
-    {
-      EClass eClass = getTarget(eStructuralFeature.getEContainingClass());
-      EStructuralFeature targetEf = eClass.getEStructuralFeature(eStructuralFeature.getName());
-      return targetEf;
-    }
-    
-    /**
-     * This Method WILL BE REMOVED when EMF 3.0 is available
-     */
-    public void copyReferences()
-    {
-      for (Iterator i = entrySet().iterator(); i.hasNext();)
-      {
-        Map.Entry entry = (Map.Entry)i.next();
-        EObject eObject = (EObject)entry.getKey();
-        EObject copyEObject = (EObject)entry.getValue();
-        EClass eClass = eObject.eClass();
-        for (int j = 0, size = eClass.getFeatureCount(); j < size; ++j)
-        {
-          EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(j);
-          if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived())
-          {
-            if (eStructuralFeature instanceof EReference)
-            {
-              EReference eReference = (EReference)eStructuralFeature;
-              if (!eReference.isContainment() && !eReference.isContainer())
-              {
-                copyReference(eReference, eObject, copyEObject);
-              }
-            }
-            else if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
-            {
-              FeatureMap featureMap = (FeatureMap)eObject.eGet(eStructuralFeature);
-              FeatureMap copyFeatureMap = (FeatureMap)copyEObject.eGet(getTarget(eStructuralFeature));
-              int copyFeatureMapSize = copyFeatureMap.size();
-              for (int k = 0, featureMapSize = featureMap.size(); k < featureMapSize; ++k)
-              {
-                EStructuralFeature feature = featureMap.getEStructuralFeature(k);
-                if (feature instanceof EReference)
-                {
-                  Object referencedEObject = featureMap.getValue(k);
-                  Object copyReferencedEObject = get(referencedEObject);
-                  if (copyReferencedEObject == null && referencedEObject != null)
-                  {
-                    EReference reference = (EReference)feature;
-                    if (!useOriginalReferences || reference.isContainment() || reference.getEOpposite() != null)
-                    {
-                      continue;
-                    }
-                    copyReferencedEObject = referencedEObject;
-                  }
-                  // If we can't add it, it must aleady be in the list so find it and move it to the end.
-                  //
-                  if (!copyFeatureMap.add(feature, copyReferencedEObject))
-                  {
-                    for (int l = 0; l < copyFeatureMapSize; ++l) 
-                    {
-                      if (copyFeatureMap.getEStructuralFeature(l) == feature && copyFeatureMap.getValue(l) == copyReferencedEObject)
-                      {
-                        copyFeatureMap.move(copyFeatureMap.size() - 1, l);
-                        --copyFeatureMapSize;
-                        break;
-                      }
-                    }
-                  }
-                }
-                else
-                {
-                  copyFeatureMap.add(featureMap.get(k));
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-
-    /**
-     * This Method WILL BE REMOVED when EMF 3.0 is available
-     */
-    protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject)
-    {
-      if (eObject.eIsSet(eReference))
-      {
-        if (eReference.isMany())
-        {
-          InternalEList source = (InternalEList)eObject.eGet(eReference);
-          InternalEList target = (InternalEList)copyEObject.eGet(getTarget(eReference));
-          if (source.isEmpty())
-          {
-            target.clear();
-          }
-          else
-          {
-            boolean isBidirectional = eReference.getEOpposite() != null;
-            int index = 0;
-            for (Iterator k = resolveProxies ? source.iterator() : source.basicIterator(); k.hasNext();)
-            {
-              Object referencedEObject = k.next();
-              Object copyReferencedEObject = get(referencedEObject);
-              if (copyReferencedEObject == null)
-              {
-                if (useOriginalReferences && !isBidirectional)
-                {
-                  target.addUnique(index, referencedEObject);
-                  ++index;
-                }
-              }
-              else
-              {
-                if (isBidirectional)
-                {
-                  int position = target.indexOf(copyReferencedEObject);
-                  if (position == -1)
-                  {
-                    target.addUnique(index, copyReferencedEObject);
-                  }
-                  else if (index != position)
-                  {
-                    target.move(index, copyReferencedEObject);
-                  }
-                }
-                else
-                {
-                  target.addUnique(index, copyReferencedEObject);
-                }
-                ++index;
-              }
-            }
-          }
-        }
-        else
-        {
-          Object referencedEObject = eObject.eGet(eReference, resolveProxies);
-          if (referencedEObject == null)
-          {
-            copyEObject.eSet(getTarget(eReference), null);
-          }
-          else
-          {
-            Object copyReferencedEObject = get(referencedEObject);
-            if (copyReferencedEObject == null)
-            {
-              if (useOriginalReferences && eReference.getEOpposite() == null)
-              {
-                copyEObject.eSet(getTarget(eReference), referencedEObject);
-              }
-            }
-            else
-            {
-              copyEObject.eSet(getTarget(eReference), copyReferencedEObject);
-            }
-          }
-        }
-      }
-    }
-  }
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.helper;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * A CopyHelper implementation that creates the copy objects in a specific metadata scope.
+ * The target scope must contain a compatible version of the Types needed to create the copy objects.
+ */
+public class CrossScopeCopyHelperImpl implements CopyHelper 
+{
+  protected TypeHelper scope;
+    
+  public CrossScopeCopyHelperImpl(TypeHelper targetScope)
+  {
+    scope = targetScope;
+  }
+    
+  public DataObject copyShallow(DataObject dataObject)
+  {
+    Copier copier = new CrossScopeCopier()
+    {
+      protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject)
+      {
+      }
+      protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject)
+      {
+        if (eObject.eIsSet(eAttribute) && !FeatureMapUtil.isFeatureMap(eAttribute))
+		{
+		  super.copyAttribute(eAttribute,eObject,copyEObject);
+		}
+	  }
+    };
+    EObject result = copier.copy((EObject)dataObject);
+    copier.copyReferences();
+    return (DataObject)result;
+  }
+
+  public DataObject copy(DataObject dataObject)
+  {
+    Copier copier = new CrossScopeCopier();
+    DataObject result = (DataObject)copier.copy((EObject)dataObject);
+    copier.copyReferences();
+    return (DataObject)result;
+  }
+    
+  protected class CrossScopeCopier extends EcoreUtil.Copier
+  {
+    protected boolean useOriginalReferences = false;
+      
+    protected EClass getTarget(EClass eClass)
+    {
+      EClass target = (EClass)get(eClass);
+      if (target == null)
+      {
+        Type type = (Type)eClass;
+        target = (EClass)scope.getType(type.getURI(), type.getName());
+      }
+      return target;
+    }
+      
+    protected EStructuralFeature getTarget(EStructuralFeature eStructuralFeature)
+    {
+      EClass eClass = getTarget(eStructuralFeature.getEContainingClass());
+      EStructuralFeature targetEf = eClass.getEStructuralFeature(eStructuralFeature.getName());
+      return targetEf;
+    }
+    
+    /**
+     * This Method WILL BE REMOVED when EMF 3.0 is available
+     */
+    public void copyReferences()
+    {
+      for (Iterator i = entrySet().iterator(); i.hasNext();)
+      {
+        Map.Entry entry = (Map.Entry)i.next();
+        EObject eObject = (EObject)entry.getKey();
+        EObject copyEObject = (EObject)entry.getValue();
+        EClass eClass = eObject.eClass();
+        for (int j = 0, size = eClass.getFeatureCount(); j < size; ++j)
+        {
+          EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(j);
+          if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived())
+          {
+            if (eStructuralFeature instanceof EReference)
+            {
+              EReference eReference = (EReference)eStructuralFeature;
+              if (!eReference.isContainment() && !eReference.isContainer())
+              {
+                copyReference(eReference, eObject, copyEObject);
+              }
+            }
+            else if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
+            {
+              FeatureMap featureMap = (FeatureMap)eObject.eGet(eStructuralFeature);
+              FeatureMap copyFeatureMap = (FeatureMap)copyEObject.eGet(getTarget(eStructuralFeature));
+              int copyFeatureMapSize = copyFeatureMap.size();
+              for (int k = 0, featureMapSize = featureMap.size(); k < featureMapSize; ++k)
+              {
+                EStructuralFeature feature = featureMap.getEStructuralFeature(k);
+                if (feature instanceof EReference)
+                {
+                  Object referencedEObject = featureMap.getValue(k);
+                  Object copyReferencedEObject = get(referencedEObject);
+                  if (copyReferencedEObject == null && referencedEObject != null)
+                  {
+                    EReference reference = (EReference)feature;
+                    if (!useOriginalReferences || reference.isContainment() || reference.getEOpposite() != null)
+                    {
+                      continue;
+                    }
+                    copyReferencedEObject = referencedEObject;
+                  }
+                  // If we can't add it, it must aleady be in the list so find it and move it to the end.
+                  //
+                  if (!copyFeatureMap.add(feature, copyReferencedEObject))
+                  {
+                    for (int l = 0; l < copyFeatureMapSize; ++l) 
+                    {
+                      if (copyFeatureMap.getEStructuralFeature(l) == feature && copyFeatureMap.getValue(l) == copyReferencedEObject)
+                      {
+                        copyFeatureMap.move(copyFeatureMap.size() - 1, l);
+                        --copyFeatureMapSize;
+                        break;
+                      }
+                    }
+                  }
+                }
+                else
+                {
+                  copyFeatureMap.add(featureMap.get(k));
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+
+    /**
+     * This Method WILL BE REMOVED when EMF 3.0 is available
+     */
+    protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject)
+    {
+      if (eObject.eIsSet(eReference))
+      {
+        if (eReference.isMany())
+        {
+          InternalEList source = (InternalEList)eObject.eGet(eReference);
+          InternalEList target = (InternalEList)copyEObject.eGet(getTarget(eReference));
+          if (source.isEmpty())
+          {
+            target.clear();
+          }
+          else
+          {
+            boolean isBidirectional = eReference.getEOpposite() != null;
+            int index = 0;
+            for (Iterator k = resolveProxies ? source.iterator() : source.basicIterator(); k.hasNext();)
+            {
+              Object referencedEObject = k.next();
+              Object copyReferencedEObject = get(referencedEObject);
+              if (copyReferencedEObject == null)
+              {
+                if (useOriginalReferences && !isBidirectional)
+                {
+                  target.addUnique(index, referencedEObject);
+                  ++index;
+                }
+              }
+              else
+              {
+                if (isBidirectional)
+                {
+                  int position = target.indexOf(copyReferencedEObject);
+                  if (position == -1)
+                  {
+                    target.addUnique(index, copyReferencedEObject);
+                  }
+                  else if (index != position)
+                  {
+                    target.move(index, copyReferencedEObject);
+                  }
+                }
+                else
+                {
+                  target.addUnique(index, copyReferencedEObject);
+                }
+                ++index;
+              }
+            }
+          }
+        }
+        else
+        {
+          Object referencedEObject = eObject.eGet(eReference, resolveProxies);
+          if (referencedEObject == null)
+          {
+            copyEObject.eSet(getTarget(eReference), null);
+          }
+          else
+          {
+            Object copyReferencedEObject = get(referencedEObject);
+            if (copyReferencedEObject == null)
+            {
+              if (useOriginalReferences && eReference.getEOpposite() == null)
+              {
+                copyEObject.eSet(getTarget(eReference), referencedEObject);
+              }
+            }
+            else
+            {
+              copyEObject.eSet(getTarget(eReference), copyReferencedEObject);
+            }
+          }
+        }
+      }
+    }
+  }
+}

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CrossScopeCopyHelperImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DefaultHelperContextImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DefaultHelperContextImpl.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DefaultHelperContextImpl.java (original)
+++ tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DefaultHelperContextImpl.java Mon Jul 28 07:30:12 2008
@@ -1,72 +1,72 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.tuscany.sdo.helper;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
-
-public class DefaultHelperContextImpl extends HelperContextImpl {
-    public DefaultHelperContextImpl(final boolean extensibleNamespaces) {
-        super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces);
-    }
-
-    public DefaultHelperContextImpl(final boolean extensibleNamespaces, final Map options) {
-        super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces, options);
-    }
-    
-    protected static class SDOPackageRegistryDelegator extends EPackageRegistryImpl.Delegator {
-        /**
-         * A map from class loader to its associated registry.
-         */
-        protected Map classLoaderToRegistryMap = new WeakHashMap();
-        
-        /**
-         * Returns the package registry associated with the given class loader.
-         * @param classLoader the class loader.
-         * @return the package registry associated with the given class loader.
-         */
-        public synchronized EPackage.Registry getRegistry(final ClassLoader classLoader)
-        {
-          EPackage.Registry result = (EPackage.Registry)classLoaderToRegistryMap.get(classLoader);
-          if (result == null)
-          {
-            if (classLoader == null)
-            {
-              result = HelperContextImpl.getBuiltInModelRegistry();  
-            }
-            else
-            {
-              result = new EPackageRegistryImpl(getRegistry(classLoader.getParent()));
-              classLoaderToRegistryMap.put(classLoader, result);
-            }
-          }
-          return result;
-        }
-        
-        protected EPackage.Registry delegateRegistry(final ClassLoader classLoader)
-        {
-          return getRegistry(classLoader);
-        }
-    }
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tuscany.sdo.helper;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
+
+public class DefaultHelperContextImpl extends HelperContextImpl {
+    public DefaultHelperContextImpl(final boolean extensibleNamespaces) {
+        super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces);
+    }
+
+    public DefaultHelperContextImpl(final boolean extensibleNamespaces, final Map options) {
+        super(new SDOExtendedMetaDataImpl(new SDOPackageRegistryDelegator()), extensibleNamespaces, options);
+    }
+    
+    protected static class SDOPackageRegistryDelegator extends EPackageRegistryImpl.Delegator {
+        /**
+         * A map from class loader to its associated registry.
+         */
+        protected Map classLoaderToRegistryMap = new WeakHashMap();
+        
+        /**
+         * Returns the package registry associated with the given class loader.
+         * @param classLoader the class loader.
+         * @return the package registry associated with the given class loader.
+         */
+        public synchronized EPackage.Registry getRegistry(final ClassLoader classLoader)
+        {
+          EPackage.Registry result = (EPackage.Registry)classLoaderToRegistryMap.get(classLoader);
+          if (result == null)
+          {
+            if (classLoader == null)
+            {
+              result = HelperContextImpl.getBuiltInModelRegistry();  
+            }
+            else
+            {
+              result = new EPackageRegistryImpl(getRegistry(classLoader.getParent()));
+              classLoaderToRegistryMap.put(classLoader, result);
+            }
+          }
+          return result;
+        }
+        
+        protected EPackage.Registry delegateRegistry(final ClassLoader classLoader)
+        {
+          return getRegistry(classLoader);
+        }
+    }
+}

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DefaultHelperContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOHelperImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java (original)
+++ tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java Mon Jul 28 07:30:12 2008
@@ -1,78 +1,78 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.impl;
-
-import org.apache.tuscany.sdo.api.Event;
-import org.eclipse.emf.common.notify.Notification;
-
-import commonj.sdo.Property;
-
-
-public class EventImpl implements Event {
-
-  protected Notification emfEvent;
-  protected Object notifier;
-
-  public EventImpl(Notification notification)
-  {
-    this.emfEvent = notification;
-  }
-  
-  public Object getNotifier()
-  {
-    return notifier == null ? emfEvent.getNotifier() : notifier;
-  }
-
-  public int getEventType()
-  {
-    return emfEvent.getEventType();
-  }
-
-
-  public Property getProperty()
-  {
-    return (Property)emfEvent.getFeature();
-  }
-
-  public Object getOldValue()
-  {
-    return emfEvent.getOldValue();
-  }
-
-  public Object getNewValue()
-  {
-    return emfEvent.getNewValue();
-  }
-
-  public boolean wasSet()
-  {
-    return emfEvent.wasSet();
-  }
-
-  public boolean isTouch()
-  {
-    return emfEvent.isTouch();
-  }
-
-  public int getPosition()
-  {
-    return emfEvent.getPosition();
-  }
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.impl;
+
+import org.apache.tuscany.sdo.api.Event;
+import org.eclipse.emf.common.notify.Notification;
+
+import commonj.sdo.Property;
+
+
+public class EventImpl implements Event {
+
+  protected Notification emfEvent;
+  protected Object notifier;
+
+  public EventImpl(Notification notification)
+  {
+    this.emfEvent = notification;
+  }
+  
+  public Object getNotifier()
+  {
+    return notifier == null ? emfEvent.getNotifier() : notifier;
+  }
+
+  public int getEventType()
+  {
+    return emfEvent.getEventType();
+  }
+
+
+  public Property getProperty()
+  {
+    return (Property)emfEvent.getFeature();
+  }
+
+  public Object getOldValue()
+  {
+    return emfEvent.getOldValue();
+  }
+
+  public Object getNewValue()
+  {
+    return emfEvent.getNewValue();
+  }
+
+  public boolean wasSet()
+  {
+    return emfEvent.wasSet();
+  }
+
+  public boolean isTouch()
+  {
+    return emfEvent.isTouch();
+  }
+
+  public int getPosition()
+  {
+    return emfEvent.getPosition();
+  }
+}

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EventImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java (original)
+++ tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java Mon Jul 28 07:30:12 2008
@@ -1,33 +1,33 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.impl;
-
-import org.apache.tuscany.sdo.api.Event;
-import org.apache.tuscany.sdo.api.EventListener;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-
-public abstract class ListenerBase extends AdapterImpl implements EventListener  {
-
-  public void notifyChanged(Notification msg) {
-    Event e = new EventImpl(msg);
-    eventNotification(e);
-  }
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.impl;
+
+import org.apache.tuscany.sdo.api.Event;
+import org.apache.tuscany.sdo.api.EventListener;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+
+public abstract class ListenerBase extends AdapterImpl implements EventListener  {
+
+  public void notifyChanged(Notification msg) {
+    Event e = new EventImpl(msg);
+    eventNotification(e);
+  }
+}

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ListenerBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/internal/InternalFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/internal/InternalFactory.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/internal/InternalFactory.java (original)
+++ tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/internal/InternalFactory.java Mon Jul 28 07:30:12 2008
@@ -1,52 +1,52 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.model.internal;
-
-import commonj.sdo.helper.HelperContext;
-
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @generated
- */
-public interface InternalFactory
-{
-
-  /**
-   * The singleton instance of the factory.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  InternalFactory INSTANCE = org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init();
-
-  /**
-   * Registers the types supported by this Factory within the supplied scope.argument
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @param scope an instance of HelperContext used to manage the scoping of types.
-   * @generated
-   */
-  public void register(HelperContext scope);
-   
-} //InternalFactory
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.model.internal;
+
+import commonj.sdo.helper.HelperContext;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public interface InternalFactory
+{
+
+  /**
+   * The singleton instance of the factory.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  InternalFactory INSTANCE = org.apache.tuscany.sdo.model.internal.impl.InternalFactoryImpl.init();
+
+  /**
+   * Registers the types supported by this Factory within the supplied scope.argument
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @param scope an instance of HelperContext used to manage the scoping of types.
+   * @generated
+   */
+  public void register(HelperContext scope);
+   
+} //InternalFactory

Propchange: tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/internal/InternalFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native