summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-03-08 15:43:24 (EST)
committerEike Stepper2008-03-08 15:43:24 (EST)
commit43d1d758e288a6bcf97bf50f093729df2a1c8a67 (patch)
tree15090a85b45ac68cf8a903b763b843d68c3fac13
parent9d7c6e554304e4a0375b95b7c462547eeb0d3f05 (diff)
downloadcdo-43d1d758e288a6bcf97bf50f093729df2a1c8a67.zip
cdo-43d1d758e288a6bcf97bf50f093729df2a1c8a67.tar.gz
cdo-43d1d758e288a6bcf97bf50f093729df2a1c8a67.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/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java1
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java24
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/trace/ContextTracer.java5
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java3
6 files changed, 29 insertions, 10 deletions
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 54c2224..3746a2b 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
@@ -22,7 +22,6 @@ 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.hibernate.internal.id.CDOIDHibernateFactoryImpl;
-import org.eclipse.emf.cdo.server.hibernate.internal.id.CDOIDHibernateImpl;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -52,7 +51,7 @@ public class HibernateStore extends Store implements IHibernateStore
private static final IDLibraryProvider CDOID_LIBRARY_PROVIDER = new IDLibraryProvider();
private static final CDOIDLibraryDescriptor CDOID_LIBRARY_DESCRIPTOR = CDOID_LIBRARY_PROVIDER
- .createDescriptor(CDOIDHibernateImpl.class.getName());
+ .createDescriptor(CDOIDHibernateFactoryImpl.class.getName());
/**
* Used to give different extensions of Hibernate a context when initializing
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
index 5a62ddb..ac3dc2b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
@@ -39,6 +39,9 @@ public class CDOServerProtocol extends CDOProtocolImpl
case CDOProtocolConstants.SIGNAL_OPEN_SESSION:
return new OpenSessionIndication();
+ case CDOProtocolConstants.SIGNAL_LOAD_LIBRARIES:
+ return new LoadLibrariesIndication();
+
case CDOProtocolConstants.SIGNAL_VIEWS_CHANGED:
return new ViewsChangedIndication();
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
index 22cdf5b..111e7d6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
@@ -101,6 +101,7 @@ public class HibernateServer
private static IRepository createRepository() throws Exception
{
Map<String, String> props = new HashMap<String, String>();
+ props.put(Props.PROP_OVERRIDE_UUID, "f8188187-65de-4c8a-8e75-e0ce5949837a");
props.put(Props.PROP_SUPPORTING_AUDITS, "false");
props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
props.put(Props.PROP_VERIFYING_REVISIONS, "false");
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 8d7ce0e..aaf9d45 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -655,12 +655,18 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
private void handleLibraryDescriptor(CDOIDLibraryDescriptor libraryDescriptor) throws Exception
{
String factoryName = libraryDescriptor.getFactoryName();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Using CDOID factory: {0}", factoryName);
+ }
+
+ File cacheFolder = getCacheFolder();
ClassLoader classLoader = OM.class.getClassLoader();
Set<String> neededLibraries = createSet(libraryDescriptor.getLibraryNames());
if (!neededLibraries.isEmpty())
{
- File cacheFolder = getCacheFolder();
+
IOUtil.mkdirs(cacheFolder);
Set<String> existingLibraries = createSet(cacheFolder.list());
Set<String> missingLibraries = new HashSet<String>(neededLibraries);
@@ -669,18 +675,22 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
{
new LoadLibrariesRequest(channel, missingLibraries, cacheFolder).send();
}
+ }
- int i = 0;
- URL[] urls = new URL[neededLibraries.size()];
- for (String neededLibrary : neededLibraries)
+ int i = 0;
+ URL[] urls = new URL[neededLibraries.size()];
+ for (String neededLibrary : neededLibraries)
+ {
+ File lib = new File(cacheFolder, neededLibrary);
+ if (TRACER.isEnabled())
{
- File lib = new File(cacheFolder, neededLibrary);
- urls[i++] = new URL("file://" + lib.getAbsolutePath());
+ TRACER.format("Using CDOID library: {0}", lib.getAbsolutePath());
}
- classLoader = new URLClassLoader(urls, classLoader);
+ urls[i++] = new URL("file:///" + lib.getAbsolutePath());
}
+ classLoader = new URLClassLoader(urls, classLoader);
Class<?> factoryClass = classLoader.loadClass(factoryName);
cdoidObjectFactory = (CDOIDObjectFactory)factoryClass.newInstance();
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/trace/ContextTracer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/trace/ContextTracer.java
index 28788c9..838ccb6 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/trace/ContextTracer.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/trace/ContextTracer.java
@@ -43,6 +43,11 @@ public class ContextTracer
return delegate.getName();
}
+ public OMTracer getDelegate()
+ {
+ return delegate;
+ }
+
public OMTracer getParent()
{
return delegate.getParent();
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java
index 29f6bc5..3050e6e 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java
@@ -275,11 +275,12 @@ public final class IOUtil
int written = 0;
int bufferSize = buffer.length;
int n = Math.min(size, bufferSize);
- while ((n = input.read(buffer, 0, n)) != -1)
+ while (n > 0 && (n = input.read(buffer, 0, n)) != -1)
{
output.write(buffer, 0, n);
written += n;
size -= n;
+ n = Math.min(size, bufferSize);
}
return written;