Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-02-14 19:15:41 +0000
committerEike Stepper2011-02-14 19:15:41 +0000
commita07d6753fd126df5f6ae35a9efa7479505ae6cc3 (patch)
treee8b3dfe3e44ff8f6630ba7641487c04522e9529c
parent3f601b67d6c7f845258ffccfb26f1e4d41665bc8 (diff)
downloadcdo-a07d6753fd126df5f6ae35a9efa7479505ae6cc3.tar.gz
cdo-a07d6753fd126df5f6ae35a9efa7479505ae6cc3.tar.xz
cdo-a07d6753fd126df5f6ae35a9efa7479505ae6cc3.zip
[301512] [DB] Auto-configure mapping strategy based on repository properties and contributable factories
https://bugs.eclipse.org/bugs/show_bug.cgi?id=301512
-rw-r--r--features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/plugin.xml20
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalMappingStrategy.java219
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreFactory.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreFactory.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreFactory.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreFactory.java7
12 files changed, 300 insertions, 74 deletions
diff --git a/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml b/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
index 10b59af64e..57f851851e 100644
--- a/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
+++ b/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
@@ -24,7 +24,7 @@
<store type="db">
- <mappingStrategy type="horizontalBranching">
+ <mappingStrategy type="horizontal">
<property name="qualifiedNames" value="false"/>
<property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
<property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
index 633753899e..6abb1a84a7 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
@@ -35,25 +35,23 @@
<extension
point="org.eclipse.emf.cdo.server.db.mappingStrategies">
<mappingStrategy
- class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalAuditMappingStrategy"
- type="horizontal">
- </mappingStrategy>
+ class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalMappingStrategy"
+ type="horizontal"/>
<mappingStrategy
class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalNonAuditMappingStrategy"
- type="horizontalNonAudit">
- </mappingStrategy>
+ type="horizontalNonAuditing"/>
+ <mappingStrategy
+ class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalAuditMappingStrategy"
+ type="horizontalAuditing"/>
<mappingStrategy
class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingMappingStrategy"
- type="horizontalBranching">
- </mappingStrategy>
+ type="horizontalBranching"/>
<mappingStrategy
class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalAuditMappingStrategyWithRanges"
- type="horizontalAuditWithRanges">
- </mappingStrategy>
+ type="horizontalAuditingWithRanges"/>
<mappingStrategy
class="org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.HorizontalBranchingMappingStrategyWithRanges"
- type="horizontalBranchingWithRanges">
- </mappingStrategy>
+ type="horizontalBranchingWithRanges"/>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
index cfc20b5b92..c8d603a1f7 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
@@ -71,10 +71,10 @@ public final class CDODBUtil
IDBConnectionProvider dbConnectionProvider)
{
DBStore store = new DBStore();
+ mappingStrategy.setStore(store);
store.setMappingStrategy(mappingStrategy);
store.setDBAdapter(dbAdapter);
store.setDbConnectionProvider(dbConnectionProvider);
- mappingStrategy.setStore(store);
return store;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
index 989e74e0f4..aae1d59265 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
@@ -45,16 +46,23 @@ public class DBStoreFactory implements IStoreFactory
return DBStore.TYPE;
}
- public IStore createStore(Element storeConfig)
+ public IStore createStore(InternalRepository repository, Element storeConfig)
{
- IMappingStrategy mappingStrategy = getMappingStrategy(storeConfig);
+ IMappingStrategy mappingStrategy = getMappingStrategy(repository, storeConfig);
IDBAdapter dbAdapter = getDBAdapter(storeConfig);
DataSource dataSource = getDataSource(storeConfig);
IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
- return CDODBUtil.createStore(mappingStrategy, dbAdapter, connectionProvider);
+
+ DBStore store = new DBStore();
+ store.setRepository(repository);
+ mappingStrategy.setStore(store);
+ store.setMappingStrategy(mappingStrategy);
+ store.setDBAdapter(dbAdapter);
+ store.setDbConnectionProvider(connectionProvider);
+ return store;
}
- private IMappingStrategy getMappingStrategy(Element storeConfig)
+ private IMappingStrategy getMappingStrategy(InternalRepository repository, Element storeConfig)
{
NodeList mappingStrategyConfigs = storeConfig.getElementsByTagName("mappingStrategy"); //$NON-NLS-1$
if (mappingStrategyConfigs.getLength() != 1)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalMappingStrategy.java
new file mode 100644
index 0000000000..af0ec900d8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalMappingStrategy.java
@@ -0,0 +1,219 @@
+/**
+ * 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.server.internal.db.mapping.horizontal;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IStoreAccessor.QueryResourcesContext;
+import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
+import org.eclipse.emf.cdo.server.db.CDODBUtil;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
+import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IListMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping;
+import org.eclipse.emf.cdo.spi.common.commit.CDOChangeSetSegment;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.util.collection.CloseableIterator;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class HorizontalMappingStrategy extends Lifecycle implements IMappingStrategy
+{
+ private Map<String, String> properties;
+
+ private IMappingStrategy delegate;
+
+ public HorizontalMappingStrategy()
+ {
+ }
+
+ public void setProperties(Map<String, String> properties)
+ {
+ if (delegate == null)
+ {
+ this.properties = properties;
+ }
+ else
+ {
+ delegate.setProperties(properties);
+ }
+ }
+
+ public IDBStore getStore()
+ {
+ return delegate.getStore();
+ }
+
+ public void setStore(IDBStore store)
+ {
+ IRepository repository = store.getRepository();
+ boolean auditing = repository.isSupportingAudits();
+ boolean branching = repository.isSupportingBranches();
+
+ delegate = CDODBUtil.createHorizontalMappingStrategy(auditing, branching);
+ delegate.setStore(store);
+
+ if (properties != null)
+ {
+ delegate.setProperties(properties);
+ properties = null;
+ }
+ }
+
+ public ITypeMapping createValueMapping(EStructuralFeature feature)
+ {
+ return delegate.createValueMapping(feature);
+ }
+
+ public IListMapping createListMapping(EClass containingClass, EStructuralFeature feature)
+ {
+ return delegate.createListMapping(containingClass, feature);
+ }
+
+ public String getTableName(ENamedElement element)
+ {
+ return delegate.getTableName(element);
+ }
+
+ public String getTableName(EClass containingClass, EStructuralFeature feature)
+ {
+ return delegate.getTableName(containingClass, feature);
+ }
+
+ public String getFieldName(EStructuralFeature feature)
+ {
+ return delegate.getFieldName(feature);
+ }
+
+ public void createMapping(Connection connection, InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
+ {
+ delegate.createMapping(connection, packageUnits, monitor);
+ }
+
+ public void removeMapping(Connection connection, InternalCDOPackageUnit[] packageUnits)
+ {
+ delegate.removeMapping(connection, packageUnits);
+ }
+
+ public IClassMapping getClassMapping(EClass eClass)
+ {
+ return delegate.getClassMapping(eClass);
+ }
+
+ public Map<EClass, IClassMapping> getClassMappings()
+ {
+ return delegate.getClassMappings();
+ }
+
+ public boolean hasDeltaSupport()
+ {
+ return delegate.hasDeltaSupport();
+ }
+
+ public boolean hasAuditSupport()
+ {
+ return delegate.hasAuditSupport();
+ }
+
+ public boolean hasBranchingSupport()
+ {
+ return delegate.hasBranchingSupport();
+ }
+
+ public void queryResources(IDBStoreAccessor accessor, QueryResourcesContext context)
+ {
+ delegate.queryResources(accessor, context);
+ }
+
+ public void queryXRefs(IDBStoreAccessor accessor, QueryXRefsContext context)
+ {
+ delegate.queryXRefs(accessor, context);
+ }
+
+ public CDOClassifierRef readObjectType(IDBStoreAccessor accessor, CDOID id)
+ {
+ return delegate.readObjectType(accessor, id);
+ }
+
+ public CloseableIterator<CDOID> readObjectIDs(IDBStoreAccessor accessor)
+ {
+ return delegate.readObjectIDs(accessor);
+ }
+
+ public void repairAfterCrash(IDBAdapter dbAdapter, Connection connection)
+ {
+ delegate.repairAfterCrash(dbAdapter, connection);
+ }
+
+ public void handleRevisions(IDBStoreAccessor accessor, EClass eClass, CDOBranch branch, long timeStamp,
+ boolean exactTime, CDORevisionHandler handler)
+ {
+ delegate.handleRevisions(accessor, eClass, branch, timeStamp, exactTime, handler);
+ }
+
+ public Set<CDOID> readChangeSet(IDBStoreAccessor accessor, OMMonitor monitor, CDOChangeSetSegment[] segments)
+ {
+ return delegate.readChangeSet(accessor, monitor, segments);
+ }
+
+ public void rawExport(IDBStoreAccessor accessor, CDODataOutput out, int lastReplicatedBranchID, int lastBranchID,
+ long lastReplicatedCommitTime, long lastCommitTime) throws IOException
+ {
+ delegate.rawExport(accessor, out, lastReplicatedBranchID, lastBranchID, lastReplicatedCommitTime, lastCommitTime);
+ }
+
+ public void rawImport(IDBStoreAccessor accessor, CDODataInput in, long fromCommitTime, long toCommitTime,
+ OMMonitor monitor) throws IOException
+ {
+ delegate.rawImport(accessor, in, fromCommitTime, toCommitTime, monitor);
+ }
+
+ public String getListJoin(String attrTable, String listTable)
+ {
+ return delegate.getListJoin(attrTable, listTable);
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ LifecycleUtil.activate(delegate);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ LifecycleUtil.deactivate(delegate);
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreFactory.java
index bbf1f3baa9..592da4a1ca 100644
--- a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreFactory.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
import org.eclipse.emf.cdo.server.db4o.IDB4OStore;
import org.eclipse.emf.cdo.server.internal.db4o.bundle.OM;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -32,7 +33,7 @@ public class DB4OStoreFactory implements IStoreFactory
return IDB4OStore.TYPE;
}
- public IStore createStore(Element storeConfig)
+ public IStore createStore(InternalRepository repository, Element storeConfig)
{
try
{
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreFactory.java
index 9e15c1bb91..1461b9c58d 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreFactory.java
@@ -10,9 +10,10 @@
*/
package org.eclipse.emf.cdo.server.internal.hibernate;
+import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
import org.eclipse.emf.cdo.server.hibernate.IHibernateMappingProvider;
-import org.eclipse.emf.cdo.server.hibernate.IHibernateStore;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -43,7 +44,7 @@ public class HibernateStoreFactory implements IStoreFactory
return HibernateStore.TYPE;
}
- public IHibernateStore createStore(Element storeConfig)
+ public IStore createStore(InternalRepository repository, Element storeConfig)
{
final IHibernateMappingProvider mappingProvider = getMappingProvider(storeConfig);
diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreFactory.java
index 3b7ea72db3..ec23b30d16 100644
--- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/ObjectivityStoreFactory.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.server.internal.objectivity;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.w3c.dom.Element;
@@ -23,7 +24,7 @@ public class ObjectivityStoreFactory implements IStoreFactory
{
}
- public IStore createStore(Element storeConfig)
+ public IStore createStore(InternalRepository repository, Element storeConfig)
{
// System.out.println(">>> OSF.createStore()");
// TODO - we might want to initialize Objy with the
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 3d93cb4cc6..7ba5b72c81 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -279,6 +279,38 @@ public class Repository extends Container<Object> implements InternalRepository
public synchronized void setProperties(Map<String, String> properties)
{
this.properties = properties;
+
+ String valueAudits = properties.get(Props.SUPPORTING_AUDITS);
+ if (valueAudits != null)
+ {
+ supportingAudits = Boolean.valueOf(valueAudits);
+ }
+ else
+ {
+ supportingAudits = store.getRevisionTemporality() == IStore.RevisionTemporality.AUDITING;
+ }
+
+ String valueBranches = properties.get(Props.SUPPORTING_BRANCHES);
+ if (valueBranches != null)
+ {
+ supportingBranches = Boolean.valueOf(valueBranches);
+ }
+ else
+ {
+ supportingBranches = store.getRevisionParallelism() == IStore.RevisionParallelism.BRANCHING;
+ }
+
+ String valueEcore = properties.get(Props.SUPPORTING_ECORE);
+ if (valueEcore != null)
+ {
+ supportingEcore = Boolean.valueOf(valueEcore);
+ }
+
+ String valueIntegrity = properties.get(Props.ENSURE_REFERENTIAL_INTEGRITY);
+ if (valueIntegrity != null)
+ {
+ ensuringReferentialIntegrity = Boolean.valueOf(valueIntegrity);
+ }
}
public boolean isSupportingAudits()
@@ -1496,50 +1528,10 @@ public class Repository extends Container<Object> implements InternalRepository
lockManager.setRepository(this);
- {
- String value = getProperties().get(Props.SUPPORTING_AUDITS);
- if (value != null)
- {
- supportingAudits = Boolean.valueOf(value);
- store.setRevisionTemporality(supportingAudits ? IStore.RevisionTemporality.AUDITING
- : IStore.RevisionTemporality.NONE);
- }
- else
- {
- supportingAudits = store.getRevisionTemporality() == IStore.RevisionTemporality.AUDITING;
- }
- }
-
- {
- String value = getProperties().get(Props.SUPPORTING_BRANCHES);
- if (value != null)
- {
- supportingBranches = Boolean.valueOf(value);
- store.setRevisionParallelism(supportingBranches ? IStore.RevisionParallelism.BRANCHING
- : IStore.RevisionParallelism.NONE);
- }
- else
- {
- supportingBranches = store.getRevisionParallelism() == IStore.RevisionParallelism.BRANCHING;
- }
- }
-
- {
- String value = getProperties().get(Props.SUPPORTING_ECORE);
- if (value != null)
- {
- supportingEcore = Boolean.valueOf(value);
- }
- }
-
- {
- String value = getProperties().get(Props.ENSURE_REFERENTIAL_INTEGRITY);
- if (value != null)
- {
- ensuringReferentialIntegrity = Boolean.valueOf(value);
- }
- }
-
+ store.setRevisionTemporality(supportingAudits ? IStore.RevisionTemporality.AUDITING
+ : IStore.RevisionTemporality.NONE);
+ store.setRevisionParallelism(supportingBranches ? IStore.RevisionParallelism.BRANCHING
+ : IStore.RevisionParallelism.NONE);
revisionManager.setSupportingBranches(supportingBranches);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
index 5ed8507c11..dcdb9f19ae 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
@@ -138,8 +138,11 @@ public class RepositoryConfigurator
TRACER.format("Configuring repository {0} (type={1})", repositoryName, repositoryType); //$NON-NLS-1$
}
+ Map<String, String> properties = getProperties(repositoryConfig, 1);
+
InternalRepository repository = (InternalRepository)getRepository(repositoryType);
repository.setName(repositoryName);
+ repository.setProperties(properties);
Element userManagerConfig = getUserManagerConfig(repositoryConfig);
if (userManagerConfig != null)
@@ -159,11 +162,7 @@ public class RepositoryConfigurator
}
Element storeConfig = getStoreConfig(repositoryConfig);
- InternalStore store = (InternalStore)getStore(storeConfig);
- repository.setStore(store);
-
- Map<String, String> properties = getProperties(repositoryConfig, 1);
- repository.setProperties(properties);
+ createStore(repository, storeConfig);
return repository;
}
@@ -228,11 +227,12 @@ public class RepositoryConfigurator
return factory;
}
- protected IStore getStore(Element storeConfig) throws CoreException
+ protected void createStore(InternalRepository repository, Element storeConfig) throws CoreException
{
String type = storeConfig.getAttribute("type"); //$NON-NLS-1$
IStoreFactory storeFactory = getStoreFactory(type);
- return storeFactory.createStore(storeConfig);
+ IStore store = storeFactory.createStore(repository, storeConfig);
+ repository.setStore((InternalStore)store);
}
public static Map<String, String> getProperties(Element element, int levels)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java
index 22570ccd79..513abc82eb 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.internal.server.mem;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.w3c.dom.Element;
@@ -30,7 +31,7 @@ public class MEMStoreFactory implements IStoreFactory
return MEMStore.TYPE;
}
- public IStore createStore(Element storeConfig)
+ public IStore createStore(InternalRepository repository, Element storeConfig)
{
return new MEMStore();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreFactory.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreFactory.java
index c098f13ef9..e802c4122e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreFactory.java
@@ -10,6 +10,8 @@
*/
package org.eclipse.emf.cdo.server;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+
import org.w3c.dom.Element;
/**
@@ -19,5 +21,8 @@ public interface IStoreFactory
{
public String getStoreType();
- public IStore createStore(Element storeConfig);
+ /**
+ * @since 4.0
+ */
+ public IStore createStore(InternalRepository repository, Element storeConfig);
}

Back to the top