aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-07-16 09:54:10 -0400
committerEike Stepper2011-07-16 09:54:10 -0400
commitf60a74cdff29f8e91bea51282e385e2acfe1238e (patch)
tree29bab8c0869edd4918b576f79f1185d8e712a55b
parent1f44f3b9cb3ea5a8bf0b113710581eea605d4979 (diff)
downloadcdo-f60a74cdff29f8e91bea51282e385e2acfe1238e.tar.gz
cdo-f60a74cdff29f8e91bea51282e385e2acfe1238e.tar.xz
cdo-f60a74cdff29f8e91bea51282e385e2acfe1238e.zip
Changed CDOIDObjectUUID from String to byte[]
-rw-r--r--plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java6
6 files changed, 168 insertions, 45 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
index 82d35bbc2e..dcc75cdc06 100644
--- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.common
-Bundle-Version: 4.0.100.qualifier
+Bundle-Version: 4.1.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -15,19 +15,19 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)";resoluti
org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)",
org.eclipse.net4j.util;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
Import-Package: org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
- org.eclipse.emf.cdo.common.branch;version="4.0.100",
- org.eclipse.emf.cdo.common.commit;version="4.0.100",
- org.eclipse.emf.cdo.common.commit.handler;version="4.0.100",
- org.eclipse.emf.cdo.common.id;version="4.0.100",
- org.eclipse.emf.cdo.common.lob;version="4.0.100",
- org.eclipse.emf.cdo.common.lock;version="4.0.100",
- org.eclipse.emf.cdo.common.model;version="4.0.100",
- org.eclipse.emf.cdo.common.protocol;version="4.0.100",
- org.eclipse.emf.cdo.common.revision;version="4.0.100",
- org.eclipse.emf.cdo.common.revision.delta;version="4.0.100",
- org.eclipse.emf.cdo.common.util;version="4.0.100",
- org.eclipse.emf.cdo.internal.common;version="4.0.100";
+Export-Package: org.eclipse.emf.cdo.common;version="4.1.0",
+ org.eclipse.emf.cdo.common.branch;version="4.1.0",
+ org.eclipse.emf.cdo.common.commit;version="4.1.0",
+ org.eclipse.emf.cdo.common.commit.handler;version="4.1.0",
+ org.eclipse.emf.cdo.common.id;version="4.1.0",
+ org.eclipse.emf.cdo.common.lob;version="4.1.0",
+ org.eclipse.emf.cdo.common.lock;version="4.1.0",
+ org.eclipse.emf.cdo.common.model;version="4.1.0",
+ org.eclipse.emf.cdo.common.protocol;version="4.1.0",
+ org.eclipse.emf.cdo.common.revision;version="4.1.0",
+ org.eclipse.emf.cdo.common.revision.delta;version="4.1.0",
+ org.eclipse.emf.cdo.common.util;version="4.1.0",
+ org.eclipse.emf.cdo.internal.common;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -36,9 +36,9 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.branch;version="4.0.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.bundle;version="4.0.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.common.commit;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.branch;version="4.1.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.common.bundle;version="4.1.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.commit;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -47,7 +47,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.id;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.id;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -56,8 +56,8 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.messages;version="4.0.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.common.model;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.messages;version="4.1.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.model;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -66,7 +66,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.protocol;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.protocol;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -75,7 +75,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.revision;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -84,7 +84,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.delta;version="4.0.100";
+ org.eclipse.emf.cdo.internal.common.revision.delta;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -93,9 +93,9 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.0.100",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.spi.common;version="4.0.100",
- org.eclipse.emf.cdo.spi.common.branch;version="4.0.100",
- org.eclipse.emf.cdo.spi.common.commit;version="4.0.100",
- org.eclipse.emf.cdo.spi.common.id;version="4.0.100",
- org.eclipse.emf.cdo.spi.common.model;version="4.0.100",
- org.eclipse.emf.cdo.spi.common.revision;version="4.0.100"
+ org.eclipse.emf.cdo.spi.common;version="4.1.0",
+ org.eclipse.emf.cdo.spi.common.branch;version="4.1.0",
+ org.eclipse.emf.cdo.spi.common.commit;version="4.1.0",
+ org.eclipse.emf.cdo.spi.common.id;version="4.1.0",
+ org.eclipse.emf.cdo.spi.common.model;version="4.1.0",
+ org.eclipse.emf.cdo.spi.common.revision;version="4.1.0"
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
index 0f290e4a0c..66cfd1caae 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -197,6 +197,14 @@ public final class CDOIDUtil
}
/**
+ * @since 4.1
+ */
+ public static CDOID createUUID(byte[] value)
+ {
+ return new CDOIDObjectUUIDImpl(value);
+ }
+
+ /**
* @since 2.0
*/
public static CDOIDExternal createExternal(String uri)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
index c1f5e4e9e3..d4a967b246 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
@@ -12,14 +12,14 @@
package org.eclipse.emf.cdo.internal.common.id;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDString;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray;
import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
/**
* @author Martin Taal
* @since 3.0
*/
-public class CDOIDObjectUUIDImpl extends AbstractCDOIDString implements InternalCDOIDObject
+public class CDOIDObjectUUIDImpl extends AbstractCDOIDByteArray implements InternalCDOIDObject
{
private static final long serialVersionUID = 1L;
@@ -27,7 +27,7 @@ public class CDOIDObjectUUIDImpl extends AbstractCDOIDString implements Internal
{
}
- public CDOIDObjectUUIDImpl(String value)
+ public CDOIDObjectUUIDImpl(byte[] value)
{
super(value);
}
@@ -68,14 +68,37 @@ public class CDOIDObjectUUIDImpl extends AbstractCDOIDString implements Internal
}
@Override
- public String toString()
- {
- return getStringValue();
- }
-
- @Override
protected int doCompareTo(CDOID o) throws ClassCastException
{
- return getStringValue().compareTo(((CDOIDObjectUUIDImpl)o).getStringValue());
+ byte[] thisValue = getByteArrayValue();
+ byte[] thatValue = ((CDOIDObjectUUIDImpl)o).getByteArrayValue();
+ int minLength = Math.min(thisValue.length, thatValue.length);
+
+ for (int i = 0; i < minLength; i++)
+ {
+ byte thisByte = thisValue[i];
+ byte thatByte = thatValue[i];
+ if (thisByte < thatByte)
+ {
+ return -1;
+ }
+
+ if (thisByte > thatByte)
+ {
+ return 1;
+ }
+ }
+
+ if (thisValue.length < thatValue.length)
+ {
+ return -1;
+ }
+
+ if (thisValue.length > thatValue.length)
+ {
+ return 1;
+ }
+
+ return 0;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
index c1aa185a59..a8e9cd9a26 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
@@ -31,6 +31,12 @@ public abstract class AbstractCDOID implements CDOID
{
}
+ @Override
+ public String toString()
+ {
+ return toURIFragment();
+ }
+
public final int compareTo(CDOID o)
{
try
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java
new file mode 100644
index 0000000000..d2f0086101
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2004 - 2011 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.spi.common.id;
+
+import org.eclipse.net4j.util.HexUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * @author Eike Stepper
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOIDByteArray extends AbstractCDOID
+{
+ public static final String NULL_VALUE = null;
+
+ private static final long serialVersionUID = 1L;
+
+ private byte[] value;
+
+ public AbstractCDOIDByteArray()
+ {
+ }
+
+ public AbstractCDOIDByteArray(byte[] value)
+ {
+ this.value = value;
+ }
+
+ public byte[] getByteArrayValue()
+ {
+ return value;
+ }
+
+ public String toURIFragment()
+ {
+ return HexUtil.bytesToHex(value);
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ value = HexUtil.hexToBytes(fragmentPart);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readByteArray();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeByteArray(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDByteArray that = (AbstractCDOIDByteArray)obj;
+ return Arrays.equals(value, that.value);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ Arrays.hashCode(value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
index 7454511133..a77f4da519 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
@@ -106,10 +106,4 @@ public abstract class AbstractCDOIDInteger extends AbstractCDOID
{
return getClass().hashCode() ^ value;
}
-
- @Override
- public String toString()
- {
- return String.valueOf(value);
- }
}