summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-02-25 09:34:43 (EST)
committerEike Stepper2008-02-25 09:34:43 (EST)
commit5bfffc20f2b3dda2f77d38bf8ba329307dc19edb (patch)
tree1bec3385a1961833905ec82e88a5875cf6aa74ba
parentd523d60bdf34d0349f497b3bc25960b713663002 (diff)
downloadcdo-5bfffc20f2b3dda2f77d38bf8ba329307dc19edb.zip
cdo-5bfffc20f2b3dda2f77d38bf8ba329307dc19edb.tar.gz
cdo-5bfffc20f2b3dda2f77d38bf8ba329307dc19edb.tar.bz2
[217117] Develop a HibernateStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217117
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java (renamed from plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateCDOPackageHandler.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateThreadContext.java (renamed from plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateThreadContext.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java (renamed from plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateUtil.java)18
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateFactoryImpl.java (renamed from plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateFactoryImpl.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateImpl.java (renamed from plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateImpl.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDUserType.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceGetter.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/HibernateMoveableListWrapper.java10
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java2
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/ExtendedIOTest.java103
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java2
17 files changed, 147 insertions, 40 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
index ccec2f6..7dd6393 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
Export-Package: org.eclipse.emf.cdo.server.hibernate,
org.eclipse.emf.cdo.server.internal.hibernate,
org.eclipse.emf.cdo.server.internal.hibernate.bundle,
+ org.eclipse.emf.cdo.server.internal.hibernate.id,
org.eclipse.emf.cdo.server.internal.hibernate.info,
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer,
org.hibernate,
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateCDOPackageHandler.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
index ea0ac95..6a9322a 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateCDOPackageHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
@@ -43,7 +43,7 @@ import java.util.Properties;
* @author Eike Stepper
* @author Martin Taal
*/
-public class HibernateCDOPackageHandler
+public class HibernatePackageHandler
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HibernateStoreWriter.class);
@@ -65,7 +65,7 @@ public class HibernateCDOPackageHandler
private HibernateStore hibernateStore;
- public HibernateCDOPackageHandler(Properties props, HibernateStore hibernateStore)
+ public HibernatePackageHandler(Properties props, HibernateStore hibernateStore)
{
properties = props;
this.hibernateStore = hibernateStore;
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java
index 167fca6..a2d7a96 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.hibernate.IHibernateMappingProvider;
import org.eclipse.emf.cdo.server.hibernate.IHibernateStore;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
+import org.eclipse.emf.cdo.server.internal.hibernate.id.CDOIDHibernateFactoryImpl;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.WrappedException;
@@ -54,7 +55,7 @@ public class HibernateStore extends Store implements IHibernateStore
private SessionFactory hibernateSessionFactory;
- private HibernateCDOPackageHandler packageHandler;
+ private HibernatePackageHandler packageHandler;
@SuppressWarnings("unused")
private IHibernateMappingProvider mappingProvider;
@@ -65,7 +66,7 @@ public class HibernateStore extends Store implements IHibernateStore
{
super(TYPE);
properties = props;
- packageHandler = new HibernateCDOPackageHandler(props, this);
+ packageHandler = new HibernatePackageHandler(props, this);
this.mappingProvider = mappingProvider;
TRACER.trace("Created " + this.getClass().getName() + " with properties:");
for (Object keyObject : props.keySet())
@@ -171,7 +172,7 @@ public class HibernateStore extends Store implements IHibernateStore
throw new UnsupportedOperationException(); // TODO Implement me
}
- public HibernateCDOPackageHandler getPackageHandler()
+ public HibernatePackageHandler getPackageHandler()
{
return packageHandler;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
index 2c3dbce..7853fbc 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
@@ -46,10 +46,10 @@ public class HibernateStoreAccessor extends StoreAccessor implements IHibernateS
protected Session createHibernateSession()
{
- TRACER.trace("Creating hibernate session and setting it in threadlocal CDOHibernateThreadContext");
+ TRACER.trace("Creating hibernate session and setting it in threadlocal HibernateThreadContext");
final SessionFactory sessionFactory = getStore().getHibernateSessionFactory();
final Session session = sessionFactory.openSession();
- CDOHibernateThreadContext.setSession(session);
+ HibernateThreadContext.setSession(session);
return session;
}
@@ -57,7 +57,7 @@ public class HibernateStoreAccessor extends StoreAccessor implements IHibernateS
protected void doRelease()
{
TRACER.trace("Releasing hibernate session");
- CDOHibernateThreadContext.setSession(null);
+ HibernateThreadContext.setSession(null);
clearHibernateSession();
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
index c93dea2..cc4e500 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
@@ -129,7 +129,7 @@ public class HibernateStoreReader extends HibernateStoreAccessor implements IHib
public CDORevision readRevision(CDOID id, int referenceChunk)
{
- return CDOHibernateUtil.getInstance().getCDORevision(id);
+ return HibernateUtil.getInstance().getCDORevision(id);
}
public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
index c482783..863a368 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
@@ -50,20 +50,20 @@ public class HibernateStoreWriter extends HibernateStoreReader implements IHiber
{
// start with fresh hibernate session
final Session session = getHibernateSession();
- CDOHibernateThreadContext.setCommitContext(context);
+ HibernateThreadContext.setCommitContext(context);
session.setFlushMode(FlushMode.COMMIT);
session.beginTransaction();
for (Object o : context.getNewObjects())
{
final CDORevision cdoRevision = (CDORevision)o;
- session.save(CDOHibernateUtil.getInstance().getEntityName(cdoRevision), o);
+ session.save(HibernateUtil.getInstance().getEntityName(cdoRevision), o);
TRACER
.trace("Persisted new Object " + ((CDORevision)o).getCDOClass().getName() + " id: " + cdoRevision.getID());
}
for (Object o : context.getDirtyObjects())
{
final CDORevision cdoRevision = (CDORevision)o;
- session.update(CDOHibernateUtil.getInstance().getEntityName(cdoRevision), o);
+ session.update(HibernateUtil.getInstance().getEntityName(cdoRevision), o);
TRACER.trace("Updated Object " + ((CDORevision)o).getCDOClass().getName() + " id: " + cdoRevision.getID());
}
TRACER.trace("Commit hibernate transaction");
@@ -72,7 +72,7 @@ public class HibernateStoreWriter extends HibernateStoreReader implements IHiber
finally
{
TRACER.trace("Clearing used hibernate session");
- CDOHibernateThreadContext.setCommitContext(null);
+ HibernateThreadContext.setCommitContext(null);
}
TRACER.trace("Applying id mappings");
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateThreadContext.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateThreadContext.java
index d0d6e5d..9504424 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateThreadContext.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateThreadContext.java
@@ -20,9 +20,9 @@ import org.hibernate.Session;
/**
* @author Martin Taal
*/
-public class CDOHibernateThreadContext
+public class HibernateThreadContext
{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOHibernateThreadContext.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HibernateThreadContext.class);
private static ThreadLocal<CommitContext> commitContext = new ThreadLocal<CommitContext>();
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateUtil.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
index d1cdef4..536d412 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOHibernateUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
@@ -21,14 +21,14 @@ import org.hibernate.Session;
/**
* @author Martin Taal
*/
-public class CDOHibernateUtil
+public class HibernateUtil
{
- private static CDOHibernateUtil instance = new CDOHibernateUtil();
+ private static HibernateUtil instance = new HibernateUtil();
/**
* @return the instance
*/
- public static CDOHibernateUtil getInstance()
+ public static HibernateUtil getInstance()
{
return instance;
}
@@ -37,9 +37,9 @@ public class CDOHibernateUtil
* @param instance
* the instance to set
*/
- public static void setInstance(CDOHibernateUtil instance)
+ public static void setInstance(HibernateUtil instance)
{
- CDOHibernateUtil.instance = instance;
+ HibernateUtil.instance = instance;
}
public String getEntityName(CDORevision cdoRevision)
@@ -50,7 +50,7 @@ public class CDOHibernateUtil
/**
* Translates a temporary cdoID into a hibernate ID, by finding the object it refers to in the CommitContext and then
* returning or by persisting the object. Note assumes that the hibernate session and CommitContext are set in
- * CDOHibernateThreadContext.
+ * HibernateThreadContext.
*/
public CDOIDHibernate getCDOIDHibernate(CDOID cdoID)
{
@@ -59,7 +59,7 @@ public class CDOHibernateUtil
{
return (CDOIDHibernate)cdoRevision.getID();
}
- final Session session = CDOHibernateThreadContext.getSession();
+ final Session session = HibernateThreadContext.getSession();
session.saveOrUpdate(cdoRevision);
if (!(cdoRevision.getID() instanceof CDOIDHibernate))
{
@@ -75,7 +75,7 @@ public class CDOHibernateUtil
*/
public CDORevision getCDORevision(CDOID id)
{
- final CommitContext commitContext = CDOHibernateThreadContext.getCommitContext();
+ final CommitContext commitContext = HibernateThreadContext.getCommitContext();
for (CDORevision revision : commitContext.getNewObjects())
{
if (revision.getID().equals(id))
@@ -107,7 +107,7 @@ public class CDOHibernateUtil
+ id.getClass().getName() + ": " + id);
}
final CDOIDHibernate cdoIDHibernate = (CDOIDHibernate)id;
- final Session session = CDOHibernateThreadContext.getSession();
+ final Session session = HibernateThreadContext.getSession();
return (CDORevision)session.get(cdoIDHibernate.getEntityName(), cdoIDHibernate.getId());
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateFactoryImpl.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateFactoryImpl.java
index ab81ece..4979004 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateFactoryImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.server.internal.hibernate;
+package org.eclipse.emf.cdo.server.internal.hibernate.id;
import org.eclipse.emf.cdo.protocol.id.CDOIDObject;
import org.eclipse.emf.cdo.protocol.id.CDOIDObjectFactory;
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateImpl.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateImpl.java
index 67c09fc..64f88c2 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/CDOIDHibernateImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/id/CDOIDHibernateImpl.java
@@ -9,7 +9,7 @@
* Eike Stepper - initial API and implementation
* Martin Taal - added hibernate specifics
**************************************************************************/
-package org.eclipse.emf.cdo.server.internal.hibernate;
+package org.eclipse.emf.cdo.server.internal.hibernate.id;
import org.eclipse.emf.cdo.internal.protocol.id.AbstractCDOID;
import org.eclipse.emf.cdo.protocol.id.CDOIDObject;
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java
index d1f68ba..406b0f3 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java
@@ -15,8 +15,8 @@ import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.id.CDOIDTemp;
import org.eclipse.emf.cdo.server.IStoreWriter.CommitContext;
import org.eclipse.emf.cdo.server.hibernate.CDOIDHibernate;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOHibernateThreadContext;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOIDHibernateImpl;
+import org.eclipse.emf.cdo.server.internal.hibernate.HibernateThreadContext;
+import org.eclipse.emf.cdo.server.internal.hibernate.id.CDOIDHibernateImpl;
import org.hibernate.HibernateException;
import org.hibernate.engine.SessionFactoryImplementor;
@@ -53,7 +53,7 @@ public class CDOIDPropertySetter extends CDOPropertySetter
}
else if (cdoID instanceof CDOIDTemp)
{
- final CommitContext commitContext = CDOHibernateThreadContext.getCommitContext();
+ final CommitContext commitContext = HibernateThreadContext.getCommitContext();
final CDOIDHibernate newCDOID = new CDOIDHibernateImpl();
newCDOID.setId((Serializable)value);
newCDOID.setEntityName(revision.getCDOClass().getName());
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 c59903b..e5a497d 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
@@ -14,8 +14,8 @@ import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.id.CDOIDTemp;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.server.hibernate.CDOIDHibernate;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOHibernateUtil;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOIDHibernateImpl;
+import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
+import org.eclipse.emf.cdo.server.internal.hibernate.id.CDOIDHibernateImpl;
import org.hibernate.Hibernate;
import org.hibernate.usertype.UserType;
@@ -98,7 +98,7 @@ public class CDOIDUserType implements UserType
final CDOIDHibernate cdoID;
if (value instanceof CDOIDTemp)
{
- cdoID = CDOHibernateUtil.getInstance().getCDOIDHibernate((CDOID)value);
+ cdoID = HibernateUtil.getInstance().getCDOIDHibernate((CDOID)value);
}
else if (value instanceof CDORevision)
{
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 55b50cc..d338a24 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
@@ -11,7 +11,7 @@
package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.protocol.id.CDOID;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOHibernateUtil;
+import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
import org.hibernate.HibernateException;
@@ -33,7 +33,7 @@ public class CDOReferenceGetter extends CDOPropertyGetter
final Object o = super.get(target);
if (o instanceof CDOID)
{
- return CDOHibernateUtil.getInstance().getCDORevision((CDOID)o);
+ return HibernateUtil.getInstance().getCDORevision((CDOID)o);
}
return o;
}
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 f21e67e..f94bfae 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
@@ -12,7 +12,7 @@ package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
-import org.eclipse.emf.cdo.server.internal.hibernate.CDOHibernateUtil;
+import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
import org.eclipse.net4j.internal.util.collection.MoveableArrayList;
@@ -61,7 +61,7 @@ public class HibernateMoveableListWrapper implements List<Object>
return o;
}
- return CDOHibernateUtil.getInstance().getCDORevision((CDOID)o);
+ return HibernateUtil.getInstance().getCDORevision((CDOID)o);
}
protected List<Object> getObjects(List<?> cdoIDs)
@@ -236,7 +236,7 @@ public class HibernateMoveableListWrapper implements List<Object>
final Object o = this.delegate.next();
if (o instanceof CDOID)
{
- return CDOHibernateUtil.getInstance().getCDORevision((CDOID)o);
+ return HibernateUtil.getInstance().getCDORevision((CDOID)o);
}
return o;
}
@@ -276,7 +276,7 @@ public class HibernateMoveableListWrapper implements List<Object>
final Object o = this.delegate.next();
if (o instanceof CDOID)
{
- return CDOHibernateUtil.getInstance().getCDORevision((CDOID)delegate.next());
+ return HibernateUtil.getInstance().getCDORevision((CDOID)delegate.next());
}
return o;
}
@@ -291,7 +291,7 @@ public class HibernateMoveableListWrapper implements List<Object>
final Object o = this.delegate.previous();
if (o instanceof CDOID)
{
- return CDOHibernateUtil.getInstance().getCDORevision((CDOID)delegate.next());
+ return HibernateUtil.getInstance().getCDORevision((CDOID)delegate.next());
}
return o;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
index 1f12f78..35fd5d0 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.tests;
+import org.eclipse.net4j.util.tests.ExtendedIOTest;
import org.eclipse.net4j.util.tests.MonitorTest;
import org.eclipse.net4j.util.tests.MultiMapTest;
import org.eclipse.net4j.util.tests.ReferenceValueMapTest;
@@ -35,6 +36,7 @@ public class AllTests
suite.addTestSuite(SynchronizingCorrelatorTest.class);
suite.addTestSuite(ReferenceValueMapTest.class);
suite.addTestSuite(BufferPoolTest.class);
+ suite.addTestSuite(ExtendedIOTest.class);
// suite.addTestSuite(SecurityTest.class);
// TODO suite.addTestSuite(ConnectorTest.class);
// $JUnit-END$
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/ExtendedIOTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/ExtendedIOTest.java
new file mode 100644
index 0000000..ec49ac3
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/ExtendedIOTest.java
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 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.net4j.util.tests;
+
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+
+/**
+ * @author Eike Stepper
+ */
+public class ExtendedIOTest extends AbstractOMTest
+{
+ @SuppressWarnings("unchecked")
+ public void testObject() throws Exception
+ {
+ final HashMap<String, String> map = createMap();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ExtendedDataOutputStream edos = new ExtendedDataOutputStream(baos);
+ edos.writeObject(map);
+ edos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ExtendedDataInputStream edis = new ExtendedDataInputStream(bais);
+ HashMap<String, String> result = (HashMap<String, String>)edis.readObject();
+ assertEquals(map, result);
+ }
+
+ public void testByteArray() throws Exception
+ {
+ final byte[] byteArray = createByteArray();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ExtendedDataOutputStream edos = new ExtendedDataOutputStream(baos);
+ edos.writeByteArray(byteArray);
+ edos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ExtendedDataInputStream edis = new ExtendedDataInputStream(bais);
+ byte[] result = edis.readByteArray();
+ assertTrue(Arrays.equals(byteArray, result));
+ }
+
+ private byte[] createByteArray() throws IOException
+ {
+ HashMap<String, String> map = createMap();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ExtendedDataOutputStream edos = new ExtendedDataOutputStream(baos);
+ edos.writeObject(map);
+ edos.close();
+ return baos.toByteArray();
+ }
+
+ private HashMap<String, String> createMap()
+ {
+ HashMap<String, String> map = new HashMap<String, String>();
+ putMap(map, "org.eclipse.net4j.util.io.CachedFileMap.java");
+ putMap(map, "org.eclipse.net4j.util.io.CloseableIterator.java");
+ putMap(map, "org.eclipse.net4j.util.io.DataInputExtender.java");
+ putMap(map, "org.eclipse.net4j.util.io.DataOutputExtender.java");
+ putMap(map, "org.eclipse.net4j.util.io.DelegatingInputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.DelegatingOutputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.DelegatingStreamWrapper.java");
+ putMap(map, "org.eclipse.net4j.util.io.ExtendedDataInput.java");
+ putMap(map, "org.eclipse.net4j.util.io.ExtendedDataInputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.ExtendedDataOutput.java");
+ putMap(map, "org.eclipse.net4j.util.io.ExtendedDataOutputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.ExtendedIOUtil.java");
+ putMap(map, "org.eclipse.net4j.util.io.GZIPStreamWrapper.java");
+ putMap(map, "org.eclipse.net4j.util.io.IOFilter.java");
+ putMap(map, "org.eclipse.net4j.util.io.IORunnable.java");
+ putMap(map, "org.eclipse.net4j.util.io.IORuntimeException.java");
+ putMap(map, "org.eclipse.net4j.util.io.IOUtil.java");
+ putMap(map, "org.eclipse.net4j.util.io.IOVisitor.java");
+ putMap(map, "org.eclipse.net4j.util.io.IStreamWrapper.java");
+ putMap(map, "org.eclipse.net4j.util.io.NIOUtil.java");
+ putMap(map, "org.eclipse.net4j.util.io.SortedFileMap.java");
+ putMap(map, "org.eclipse.net4j.util.io.StreamWrapperChain.java");
+ putMap(map, "org.eclipse.net4j.util.io.TMPUtil.java");
+ putMap(map, "org.eclipse.net4j.util.io.XORInputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.XOROutputStream.java");
+ putMap(map, "org.eclipse.net4j.util.io.XORStreamWrapper.java");
+ putMap(map, "org.eclipse.net4j.util.io.ZIPUtil.java");
+ return map;
+ }
+
+ private void putMap(HashMap<String, String> map, String string)
+ {
+ map.put(string, string);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java
index 7aa35c7..890887a 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java
@@ -67,7 +67,7 @@ public final class ExtendedIOUtil
@Override
public void write(int b) throws IOException
{
- out.writeByte(b & 0xff);
+ out.writeByte((b & 0xff) + Byte.MIN_VALUE);
}
});
}