summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-17 17:06:50 (EDT)
committerEike Stepper2007-07-17 17:06:50 (EDT)
commit1a1018aa60f6fcc9821316ee6ac27d3bb538b287 (patch)
tree64d1eb6360b00ec9f1ad6b1c2de79835ecabf8ee
parent1edfe35a59a4f30f7f76e31f8bb15560c2a1e0c8 (diff)
downloadcdo-1a1018aa60f6fcc9821316ee6ac27d3bb538b287.zip
cdo-1a1018aa60f6fcc9821316ee6ac27d3bb538b287.tar.gz
cdo-1a1018aa60f6fcc9821316ee6ac27d3bb538b287.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/OverridablePackageRegistry.java103
4 files changed, 15 insertions, 123 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
index 9e3bca5..4fa0dcf 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
@@ -25,7 +25,6 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-
/**
* @author Eike Stepper
*/
@@ -45,7 +44,7 @@ public final class EMFUtil
result.add((EClass)classifier);
}
}
-
+
return result;
}
@@ -59,13 +58,13 @@ public final class EMFUtil
result.add(feature);
}
}
-
+
return result;
}
- public static boolean isDynamicPackage(EPackage ePackage)
+ public static boolean isDynamicEPackage(Object value)
{
- return ePackage.getClass() == EPackageImpl.class;
+ return value.getClass() == EPackageImpl.class;
}
public static boolean isMany(EStructuralFeature eFeature)
@@ -85,7 +84,7 @@ public final class EMFUtil
EReference ref = (EReference)eFeature;
return ref.isContainment();
}
-
+
return false;
}
@@ -101,7 +100,7 @@ public final class EMFUtil
{
method.setAccessible(true);
}
-
+
method.invoke(ePackage, ReflectUtil.NO_ARGUMENTS);
}
catch (Exception ex)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
index af7e98e..6959dee 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOPackageRegistryImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import java.util.Map;
@@ -58,19 +57,16 @@ public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOP
@Override
public Object put(String key, Object value)
{
- EPackage ePackage = (EPackage)value;
- if (EMFUtil.isDynamicPackage(ePackage))
+ if (EMFUtil.isDynamicEPackage(value))
{
- EPackageImpl copy = (EPackageImpl)EcoreUtil.copy(ePackage);
- ModelUtil.prepareEPackage(copy);
-
- CDOPackageImpl cdoPackage = ModelUtil.getCDOPackage(copy, session.getPackageManager());
+ EPackageImpl ePackage = (EPackageImpl)value;
+ ModelUtil.prepareEPackage(ePackage);
+ CDOPackageImpl cdoPackage = ModelUtil.getCDOPackage(ePackage, session.getPackageManager());
cdoPackage.setPersistent(false);
-
- ePackage = copy;
+ value = ePackage;
}
- return internalPut(key, ePackage);
+ return internalPut(key, value);
}
public Object internalPut(String key, Object value)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
index 6c98bc2..625ade4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
@@ -115,7 +115,7 @@ public final class ModelUtil
private static CDOPackageImpl createCDOPackage(EPackage ePackage, CDOPackageManagerImpl packageManager)
{
String ecore = null;
- if (EMFUtil.isDynamicPackage(ePackage))
+ if (EMFUtil.isDynamicEPackage(ePackage))
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
XMIResource resource = new XMIResourceImpl();
@@ -178,8 +178,8 @@ public final class ModelUtil
private static CDOFeatureImpl createCDOFeature(CDOClassImpl containingClass, EStructuralFeature eFeature,
CDOPackageManagerImpl packageManager)
{
- CDOFeatureImpl cdoFeature = EMFUtil.isReference(eFeature) ? createCDOReference(containingClass, eFeature, packageManager)
- : createCDOAttribute(containingClass, eFeature);
+ CDOFeatureImpl cdoFeature = EMFUtil.isReference(eFeature) ? createCDOReference(containingClass, eFeature,
+ packageManager) : createCDOAttribute(containingClass, eFeature);
cdoFeature.setClientInfo(eFeature);
return cdoFeature;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/OverridablePackageRegistry.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/OverridablePackageRegistry.java
deleted file mode 100644
index c5a15ad..0000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/OverridablePackageRegistry.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.emf.internal.cdo.util;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EPackage.Registry;
-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class OverridablePackageRegistry extends EPackageRegistryImpl
-{
- private static final long serialVersionUID = 1L;
-
- public OverridablePackageRegistry()
- {
- }
-
- public OverridablePackageRegistry(Registry delegateRegistry)
- {
- super(delegateRegistry);
- }
-
- @Override
- public final void clear()
- {
- if (!isEmpty())
- {
- List<EPackage> ePackages = new ArrayList(values());
- super.clear();
- removed(ePackages);
- }
- }
-
- @Override
- public final Set<java.util.Map.Entry<String, Object>> entrySet()
- {
- return super.entrySet();
- }
-
- @Override
- public final Object get(Object key)
- {
- return filterGet(super.get(key));
- }
-
- @Override
- public final Set<String> keySet()
- {
- Set<String> keySet = super.keySet();
- Iterator<String> iterator = keySet().iterator();
- return keySet;
- }
-
- @Override
- public final Object put(String key, Object value)
- {
- return super.put(key, value);
- }
-
- @Override
- public final void putAll(Map<? extends String, ? extends Object> m)
- {
- super.putAll(m);
- }
-
- @Override
- public final Object remove(Object key)
- {
- return super.remove(key);
- }
-
- @Override
- public final Collection<Object> values()
- {
- return super.values();
- }
-
- protected Object filterGet(Object object)
- {
- return object;
- }
-
- protected void removed(List<EPackage> ePackages)
- {
- }
-}