summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2009-04-23 09:54:36 (EDT)
committerStefan Winkler2009-04-23 09:54:36 (EDT)
commit3910ccefb8cb6c4f1da83201f7c2cef447f67366 (patch)
tree09822b696888ad843deefbf4df3cf83fa57fc636
parent60f4d6c631d094853cd05010fca5dfcc643b9410 (diff)
downloadcdo-3910ccefb8cb6c4f1da83201f7c2cef447f67366.zip
cdo-3910ccefb8cb6c4f1da83201f7c2cef447f67366.tar.gz
cdo-3910ccefb8cb6c4f1da83201f7c2cef447f67366.tar.bz2
- on-demand creation of ClassMapping
- Async monitor on DB calls.
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java28
3 files changed, 24 insertions, 17 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 8f9002d..31f09eb 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -40,7 +40,6 @@ import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.monitor.Monitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.ProgressDistributable;
import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
@@ -477,10 +476,7 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
public Collection<InternalCDOPackageUnit> readPackageUnits()
{
- Collection<InternalCDOPackageUnit> result = getStore().getMetaDataManager().readPackageUnits(getConnection());
- getStore().getMappingStrategy().createMapping(getConnection(),
- result.toArray(new InternalCDOPackageUnit[result.size()]), new Monitor());
- return result;
+ return getStore().getMetaDataManager().readPackageUnits(getConnection());
}
public void writePackageUnits(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
index 75b30ec..b82b65f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AbstractMappingStrategy.java
@@ -378,8 +378,11 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp
{
return result;
}
-
- throw new ImplementationError("Class mapping not found for " + eClass.toString());
+ else
+ {
+ // create class mapping on demand ...
+ return createClassMapping(eClass);
+ }
}
public ITypeMapping createValueMapping(EStructuralFeature feature)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
index 706c5d3..900dee2 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalClassMapping.java
@@ -4,10 +4,10 @@
* 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
- * Stefan Winkler - 271444: [DB] Multiple refactorings https://bugs.eclipse.org/bugs/show_bug.cgi?id=271444
+ * Stefan Winkler - 271444: [DB] Multiple refactorings https://bugs.eclipse.org/bugs/show_bug.cgi?id=271444
*/
package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
@@ -33,6 +33,7 @@ import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.db.ddl.IDBIndex;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
+import org.eclipse.net4j.util.om.monitor.OMMonitor.Async;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EClass;
@@ -203,19 +204,22 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
public final void detachObject(IDBStoreAccessor accessor, CDOID id, long revised, OMMonitor monitor)
{
+ Async async = null;
try
{
- monitor.begin(2);
+ monitor.begin(getListMappings().size() + 1);
+ async = monitor.forkAsync();
reviseObject(accessor, id, revised);
- monitor.worked(1);
+ async.stop();
+ async = monitor.forkAsync(getListMappings().size());
for (IListMapping mapping : getListMappings())
{
mapping.objectRevised(accessor, id, revised);
}
- monitor.worked(1);
}
finally
{
+ async.stop();
monitor.done();
}
}
@@ -310,9 +314,11 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
public void writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, OMMonitor monitor)
{
+ Async async = null;
try
{
monitor.begin(10);
+ async = monitor.forkAsync();
CDOID id = revision.getID();
if (revision.getVersion() == 1)
@@ -329,30 +335,32 @@ public abstract class AbstractHorizontalClassMapping implements IClassMapping
}
}
- monitor.worked();
+ async.stop();
+ async = monitor.forkAsync();
if (revision.isResourceFolder() || revision.isResource())
{
checkDuplicateResources(accessor, revision);
}
- monitor.worked();
+ async.stop();
+ async = monitor.forkAsync();
// Write attribute table always (even without modeled attributes!)
writeValues(accessor, revision);
- monitor.worked();
+ async.stop();
+ async = monitor.forkAsync(7);
// Write list tables only if they exist
if (listMappings != null)
{
writeLists(accessor, revision);
}
-
- monitor.worked(7);
}
finally
{
+ async.stop();
monitor.done();
}
}