Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-12-20 11:07:49 +0000
committerEike Stepper2010-12-20 11:07:49 +0000
commit8f8dcd31143c522eda8bc7f8175860c54e505d73 (patch)
tree1ee30605d72a934ad409e819dde560311e983c08 /plugins/org.eclipse.emf.cdo.server.hibernate
parentec1cc870745bd5278c3374e8bce61482d9fa285e (diff)
downloadcdo-8f8dcd31143c522eda8bc7f8175860c54e505d73.tar.gz
cdo-8f8dcd31143c522eda8bc7f8175860c54e505d73.tar.xz
cdo-8f8dcd31143c522eda8bc7f8175860c54e505d73.zip
[332888] Remove the concept of MetaIDs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=332888
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.hibernate')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml20
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/ContainerInfoConverter.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDExternalUserType.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java132
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java7
9 files changed, 18 insertions, 177 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml b/plugins/org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
index 602ac165cf..2bbfdc284a 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
@@ -1,9 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.eclipse.emf.cdo.internal.common.model">
-
- <class name="org.eclipse.emf.cdo.server.internal.hibernate.HibernateCDOPackageUnitDTO" table="cdo_package_unit" lazy="false" entity-name="CDOPackageUnit">
+ <class name="org.eclipse.emf.cdo.server.internal.hibernate.HibernateCDOPackageUnitDTO" table="cdo_package_unit" lazy="false" entity-name="CDOPackageUnit">
<id name="nsUri" access="property"/>
<property name="originalType" access="field" />
@@ -12,7 +11,7 @@
<!-- Need to set an explicit length for derby:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2614
setting it to an arbitrary large value
- -->
+ -->
<property name="EPackageBlob" access="property" type="blob" length="65500"/>
<array name="packageInfos" cascade="all, delete-orphan" access="field">
@@ -20,28 +19,21 @@
<list-index column="idx"/>
<one-to-many class="CDOPackageInfoImpl"/>
</array>
-
+
</class>
-
- <class name="CDOPackageInfoImpl" table="cdo_package_info" lazy="false">
+ <class name="CDOPackageInfoImpl" table="cdo_package_info" lazy="false">
<id name="packageURI" access="property"/>
-
<property name="parentURI" length="255" access="field" />
- <property name="metaIDRange" type="org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOIDMetaRangeUserType"
- not-null="true" access="field">
- <column name="metaIDStart" />
- <column name="metaIDSize" />
- </property>
</class>
-
+
<class name="org.eclipse.emf.cdo.server.internal.hibernate.SystemInformation" table="cdo_system_information" lazy="false">
<id column="id" type="int">
<generator class="native" />
</id>
<property name="creationTime"/>
</class>
-
+
<class name="org.eclipse.emf.cdo.server.internal.hibernate.SystemProperty" table="cdo_system_property" lazy="false">
<id name="name" type="string" length="255"/>
<property name="value" type="text" length="2000"/>
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/ContainerInfoConverter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/ContainerInfoConverter.java
index b8bc4d321e..45f94aec28 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/ContainerInfoConverter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/ContainerInfoConverter.java
@@ -12,7 +12,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
@@ -139,7 +138,7 @@ public class ContainerInfoConverter
cdoRevision.setContainerID(containerID);
final String containerFeatureStr = containerInfo.substring(index + SEPARATOR.length());
- if (containerID instanceof CDOIDMeta || containerID instanceof CDOIDExternal)
+ if (containerID instanceof CDOIDExternal)
{
cdoRevision.setContainingFeatureID(Integer.parseInt(containerFeatureStr));
return;
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
index e65bebcef4..225ff864f9 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
@@ -14,7 +14,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
@@ -275,7 +274,7 @@ public class HibernateUtil
/**
* Converts a CDOID to an unique String representations. Null, {@link CDOIDTemp} and null CDOID's are returned as null
- * value. Supports {@link CDOID}, {@link CDOIDMeta} and {@link CDOIDExternal}.
+ * value. Supports {@link CDOID} and {@link CDOIDExternal}.
*
* @param cdoID
* the cdoID to convert
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDExternalUserType.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDExternalUserType.java
index f345c42d55..9192bb5d89 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDExternalUserType.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDExternalUserType.java
@@ -12,7 +12,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
@@ -28,15 +27,12 @@ import java.sql.Types;
import java.util.Properties;
/**
- * A user type which can handle both {@link CDOIDMeta} as well as {@link CDOIDExternal}. Both are stored in a single
- * varchar field.
+ * A user type which can handle {@link CDOIDExternal}. It's stored in a single varchar field.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
*/
public class CDOIDExternalUserType implements UserType, ParameterizedType
{
- private static final String META_PREFIX = "MID"; //$NON-NLS-1$
-
private static final int[] SQL_TYPES = { Types.VARCHAR };
public CDOIDExternalUserType()
@@ -86,11 +82,6 @@ public class CDOIDExternalUserType implements UserType, ParameterizedType
return null;
}
- if (data.startsWith(META_PREFIX))
- {
- return CDOIDUtil.createMeta(Long.parseLong(data.substring(META_PREFIX.length())));
- }
-
return CDOIDUtil.createExternal(data);
}
@@ -112,11 +103,7 @@ public class CDOIDExternalUserType implements UserType, ParameterizedType
localValue = value;
}
- if (localValue instanceof CDOIDMeta)
- {
- statement.setString(index, META_PREFIX + ((CDOIDMeta)localValue).getLongValue());
- }
- else if (localValue instanceof CDOIDExternal)
+ if (localValue instanceof CDOIDExternal)
{
statement.setString(index, ((CDOIDExternal)localValue).getURI());
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java
deleted file mode 100644
index 17081305b9..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Taal - initial api
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
-
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-
-import org.hibernate.Hibernate;
-import org.hibernate.usertype.UserType;
-
-import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-
-/**
- * @author Martin Taal
- */
-public class CDOIDMetaRangeUserType implements UserType
-{
- private static final int[] SQL_TYPES = { Types.INTEGER, Types.INTEGER };
-
- public CDOIDMetaRangeUserType()
- {
- }
-
- public int[] sqlTypes()
- {
- return SQL_TYPES;
- }
-
- public Class<?> returnedClass()
- {
- return CDOIDMetaRange.class;
- }
-
- public boolean isMutable()
- {
- return true;
- }
-
- public Object deepCopy(Object value)
- {
- if (value == null)
- {
- return null;
- }
-
- CDOIDMetaRange cdoRange = (CDOIDMetaRange)value;
- CDOIDMeta newCdoIDMeta = CDOIDUtil.createMeta(((CDOIDMeta)cdoRange.getLowerBound()).getLongValue());
- return CDOIDUtil.createMetaRange(newCdoIDMeta, cdoRange.size());
- }
-
- public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws SQLException
- {
- Integer start = (Integer)Hibernate.INTEGER.nullSafeGet(rs, names[0]);
- if (rs.wasNull())
- {
- return null;
- }
-
- Integer size = (Integer)Hibernate.INTEGER.nullSafeGet(rs, names[1]);
- if (rs.wasNull())
- {
- return null;
- }
-
- CDOIDMeta newCdoIDMeta = CDOIDUtil.createMeta(start);
- return CDOIDUtil.createMetaRange(newCdoIDMeta, size);
- }
-
- public void nullSafeSet(PreparedStatement statement, Object value, int index) throws SQLException
- {
- if (value != null)
- {
- CDOIDMetaRange cdoRange = (CDOIDMetaRange)value;
- statement.setLong(index, ((CDOIDMeta)cdoRange.getLowerBound()).getLongValue());
- statement.setInt(index + 1, cdoRange.size());
- }
- else
- {
- statement.setNull(index, Types.INTEGER);
- statement.setNull(index + 1, Types.INTEGER);
- }
- }
-
- public Serializable disassemble(Object value)
- {
- return (Serializable)value;
- }
-
- public Object assemble(Serializable cachedValue, Object owner)
- {
- return cachedValue;
- }
-
- public Object replace(Object original, Object target, Object owner)
- {
- return original;
- }
-
- public boolean equals(Object x, Object y)
- {
- if (x == y)
- {
- return true;
- }
-
- if (x == null || y == null)
- {
- return false;
- }
-
- return x.equals(y);
- }
-
- public int hashCode(Object x)
- {
- return x.hashCode();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java
index 448b5a842d..4cdf98a2af 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
@@ -28,7 +27,7 @@ import java.sql.SQLException;
import java.sql.Types;
/**
- * Persists a CDOID in the DB. Currently {@link CDOIDMeta} and {@link CDOIDExternal} are supported.
+ * Persists a CDOID in the DB. Currently {@link CDOIDExternal} is supported.
*/
public class CDOIDUserType implements UserType
{
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java
index 5bec96ccd9..03abc592d7 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java
@@ -4,7 +4,7 @@
* 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:
* Martin Taal - copied from CDORevisionPropertyHandler and adapted
* Eike Stepper - maintenance
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
@@ -39,7 +38,7 @@ public class CDOReferenceGetter extends CDOPropertyGetter
{
return null;
}
- else if (o instanceof CDOIDMeta || o instanceof CDOIDExternal)
+ else if (o instanceof CDOIDExternal)
{
return o;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
index 079eb600f6..1c548727de 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
@@ -4,7 +4,7 @@
* 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:
* Martin Taal - copied from CDORevisionPropertyHandler and adapted
* Eike Stepper - maintenance
@@ -12,7 +12,6 @@
package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
import org.hibernate.HibernateException;
@@ -37,7 +36,7 @@ public class CDOReferenceSetter extends CDOPropertySetter
{
super.set(target, null, factory);
}
- else if (value instanceof CDOIDMeta || value instanceof CDOIDExternal)
+ else if (value instanceof CDOIDExternal)
{
super.set(target, value, factory);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java
index d82a0da16f..1463902c23 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
-import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
@@ -46,7 +45,7 @@ public class HibernateMoveableListWrapper implements MoveableList<Object>
int size = size();
if (sourceIndex >= size)
{
- throw new IndexOutOfBoundsException("sourceIndex=" + sourceIndex + ", size=" + size); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IndexOutOfBoundsException("sourceIndex=" + sourceIndex + ", size=" + size); //$NON-NLS-1$ //$NON-NLS-2$
}
if (targetIndex >= size)
@@ -117,7 +116,7 @@ public class HibernateMoveableListWrapper implements MoveableList<Object>
{
return null;
}
- else if (o instanceof CDOIDMeta || o instanceof CDOIDExternal)
+ else if (o instanceof CDOIDExternal)
{
return o;
}
@@ -144,7 +143,7 @@ public class HibernateMoveableListWrapper implements MoveableList<Object>
protected Object getValue(Object o)
{
- if (o instanceof CDOIDMeta || o instanceof CDOIDExternal)
+ if (o instanceof CDOIDExternal)
{
return o;
}

Back to the top