diff options
author | Eike Stepper | 2013-04-10 15:53:43 +0000 |
---|---|---|
committer | Eike Stepper | 2013-04-10 15:53:43 +0000 |
commit | 7658b38c22842ba2e006a4b65cee6bc019858652 (patch) | |
tree | 9a61bd7a8065b9b04ffa3d7012c4826754745f26 | |
parent | 3b76805b60dc8b72903a0c597bbbbb1c266bff0a (diff) | |
download | cdo-7658b38c22842ba2e006a4b65cee6bc019858652.tar.gz cdo-7658b38c22842ba2e006a4b65cee6bc019858652.tar.xz cdo-7658b38c22842ba2e006a4b65cee6bc019858652.zip |
[405343] [DB] Automatically determine whether Ecore must be mapped
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405343
29 files changed, 218 insertions, 76 deletions
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java index 25d0265b6e..8611fcd9d4 100644 --- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java @@ -61,8 +61,6 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl private boolean supportingBranches; - private boolean supportingEcore; - private boolean serializingCommits; private boolean ensuringReferentialIntegrity; @@ -90,7 +88,6 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl rootResourceID = new CDODataInputImpl.Default(in).readCDOID(); supportingAudits = in.readBoolean(); supportingBranches = in.readBoolean(); - supportingEcore = in.readBoolean(); serializingCommits = in.readBoolean(); ensuringReferentialIntegrity = in.readBoolean(); idGenerationLocation = in.readEnum(IDGenerationLocation.class); @@ -151,9 +148,10 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl return supportingBranches; } + @Deprecated public boolean isSupportingEcore() { - return supportingEcore; + return true; } public boolean isSerializingCommits() diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java index e921c7028a..e13a5b7249 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java @@ -101,7 +101,9 @@ public interface CDOCommonRepository extends CDOTimeProvider, IAdaptable * Returns <code>true</code> if this repository supports instances of Ecore, <code>false</code> otherwise. * * @since 4.0 + * @deprecated As of 4.2 instances of Ecore are always supported (on demand). */ + @Deprecated public boolean isSupportingEcore(); /** diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml index 56f22a983e..5b7b7fd307 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml @@ -17,7 +17,6 @@ <property name="overrideUUID" value=""/> <property name="supportingAudits" value="true"/> <property name="supportingBranches" value="true"/> - <property name="supportingEcore" value="false"/> <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> diff --git a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml index 56f22a983e..5b7b7fd307 100644 --- a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml @@ -17,7 +17,6 @@ <property name="overrideUUID" value=""/> <property name="supportingAudits" value="true"/> <property name="supportingBranches" value="true"/> - <property name="supportingEcore" value="false"/> <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java index b83e85f135..9b6872574e 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java @@ -160,8 +160,6 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp private boolean supportingBranches; - private boolean supportingEcore; - private boolean serializingCommits; private boolean ensuringReferentialIntegrity; @@ -184,7 +182,6 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp rootResourceID = result.getRootResourceID(); supportingAudits = result.isRepositorySupportingAudits(); supportingBranches = result.isRepositorySupportingBranches(); - supportingEcore = result.isRepositorySupportingEcore(); serializingCommits = result.isRepositoryEnsuringReferentialIntegrity(); ensuringReferentialIntegrity = result.isRepositoryEnsuringReferentialIntegrity(); idGenerationLocation = result.getRepositoryIDGenerationLocation(); @@ -290,9 +287,10 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp return supportingBranches; } + @Deprecated public boolean isSupportingEcore() { - return supportingEcore; + return true; } public boolean isSerializingCommits() diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java index 4e486a5974..2ea2657ff5 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenSessionRequest.java @@ -191,12 +191,6 @@ public class OpenSessionRequest extends CDOClientRequestWithMonitoring<OpenSessi TRACER.format("Read repositorySupportingBranches: {0}", repositorySupportingBranches); //$NON-NLS-1$ } - boolean repositorySupportingEcore = in.readBoolean(); - if (TRACER.isEnabled()) - { - TRACER.format("Read repositorySupportingEcore: {0}", repositorySupportingEcore); //$NON-NLS-1$ - } - boolean repositorySerializingCommits = in.readBoolean(); if (TRACER.isEnabled()) { @@ -217,8 +211,8 @@ public class OpenSessionRequest extends CDOClientRequestWithMonitoring<OpenSessi result = new OpenSessionResult(sessionID, userID, repositoryUUID, repositoryType, repositoryState, storeType, objectIDTypes, repositoryCreationTime, lastUpdateTime, rootResourceID, repositorySupportingAudits, - repositorySupportingBranches, repositorySupportingEcore, repositorySerializingCommits, - repositoryEnsuringReferentialIntegrity, repositoryIDGenerationLocation); + repositorySupportingBranches, repositorySerializingCommits, repositoryEnsuringReferentialIntegrity, + repositoryIDGenerationLocation); CDOPackageUnit[] packageUnits = in.readCDOPackageUnits(null); for (int i = 0; i < packageUnits.length; i++) diff --git a/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java b/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java index 0fa301e91c..6f9e797426 100644 --- a/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java +++ b/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java @@ -162,6 +162,7 @@ public class CDOAdminServerRepository extends Notifier implements CDOAdminReposi return delegate.isSupportingBranches(); } + @Deprecated public boolean isSupportingEcore() { return delegate.isSupportingEcore(); @@ -223,7 +224,6 @@ public class CDOAdminServerRepository extends Notifier implements CDOAdminReposi new CDODataOutputImpl(out).writeCDOID(getRootResourceID()); out.writeBoolean(isSupportingAudits()); out.writeBoolean(isSupportingBranches()); - out.writeBoolean(isSupportingEcore()); out.writeBoolean(isSerializingCommits()); out.writeBoolean(isEnsuringReferentialIntegrity()); out.writeEnum(getIDGenerationLocation()); 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 3f6f07172b..7991788a92 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 @@ -20,9 +20,12 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch; import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDUtil; -import org.eclipse.emf.cdo.common.model.CDOModelUtil; +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; +import org.eclipse.emf.cdo.common.model.CDOPackageUnit; import org.eclipse.emf.cdo.common.model.EMFUtil; import org.eclipse.emf.cdo.common.revision.CDORevisionHandler; +import org.eclipse.emf.cdo.eresource.EresourcePackage; +import org.eclipse.emf.cdo.etypes.EtypesPackage; import org.eclipse.emf.cdo.server.IStoreAccessor.CommitContext; import org.eclipse.emf.cdo.server.StoreThreadLocal; import org.eclipse.emf.cdo.server.db.IDBStore; @@ -57,15 +60,19 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.ENamedElement; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.util.FeatureMapUtil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -108,6 +115,14 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp private boolean allClassMappingsCreated; + // -- factories for mapping of classes, values, lists ------------------ + + private boolean mappedInfoInitialized; + + private boolean mappedEcore; + + private boolean mappedEtypes; + public AbstractMappingStrategy() { classMappings = new ConcurrentHashMap<EClass, IClassMapping>(); @@ -417,6 +432,69 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp public void createMapping(Connection connection, InternalCDOPackageUnit[] packageUnits, OMMonitor monitor) { + boolean isInitialCommit = contains(packageUnits, EresourcePackage.eINSTANCE.getNsURI()); + if (isInitialCommit) + { + // Don't create tables for Ecore and Etypes upon repository initialization + List<InternalCDOPackageUnit> reducedPackageUnits = new ArrayList<InternalCDOPackageUnit>(); + for (InternalCDOPackageUnit packageUnit : packageUnits) + { + String id = packageUnit.getID(); + if (id.equals(EcorePackage.eINSTANCE.getNsURI()) || id.equals(EtypesPackage.eINSTANCE.getNsURI())) + { + continue; + } + + reducedPackageUnits.add(packageUnit); + } + + packageUnits = reducedPackageUnits.toArray(new InternalCDOPackageUnit[reducedPackageUnits.size()]); + mappedInfoInitialized = true; + } + else + { + if (!mappedInfoInitialized) + { + mappedInfoInitialized = true; + mappedEcore = hasTableFor(EcorePackage.eINSTANCE.getEPackage()); + mappedEtypes = hasTableFor(EtypesPackage.eINSTANCE.getAnnotation()); + } + + if (!mappedEcore || !mappedEtypes) + { + CommitContext commitContext = StoreThreadLocal.getCommitContext(); + if (commitContext != null) + { + CDOPackageRegistry packageRegistry = store.getRepository().getPackageRegistry(); + List<InternalCDOPackageUnit> extendedPackageUnits = new ArrayList<InternalCDOPackageUnit>(); + if (packageUnits != null) + { + extendedPackageUnits.addAll(Arrays.asList(packageUnits)); + } + + boolean changed = false; + if (!mappedEcore && commitContext.isUsingEcore()) + { + CDOPackageUnit packageUnit = packageRegistry.getPackageUnit(EcorePackage.eINSTANCE); + extendedPackageUnits.add((InternalCDOPackageUnit)packageUnit); + changed = true; + } + + if (!mappedEtypes && commitContext.isUsingEtypes()) + { + CDOPackageUnit packageUnit = packageRegistry.getPackageUnit(EtypesPackage.eINSTANCE); + extendedPackageUnits.add((InternalCDOPackageUnit)packageUnit); + changed = true; + } + + if (changed) + { + packageUnits = extendedPackageUnits.toArray(new InternalCDOPackageUnit[extendedPackageUnits.size()]); + } + } + } + } + Async async = null; monitor.begin(); @@ -460,27 +538,47 @@ public abstract class AbstractMappingStrategy extends Lifecycle implements IMapp } } + private boolean hasTableFor(EClass eClass) + { + String tableName = getTableName(eClass); + return store.getDBSchema().getTable(tableName) != null; + } + + private boolean contains(InternalCDOPackageUnit[] packageUnits, String packageUnitID) + { + if (packageUnits != null && packageUnits.length != 0) + { + for (InternalCDOPackageUnit packageUnit : packageUnits) + { + if (packageUnit.getID().equals(packageUnitID)) + { + return true; + } + } + } + + return false; + } + private void mapPackageUnits(InternalCDOPackageUnit[] packageUnits, Connection connection, boolean unmap) { if (packageUnits != null && packageUnits.length != 0) { for (InternalCDOPackageUnit packageUnit : packageUnits) { - mapPackageInfos(packageUnit.getPackageInfos(), connection, unmap); + InternalCDOPackageInfo[] packageInfos = packageUnit.getPackageInfos(); + mapPackageInfos(packageInfos, connection, unmap); } } } private void mapPackageInfos(InternalCDOPackageInfo[] packageInfos, Connection connection, boolean unmap) { - boolean supportingEcore = getStore().getRepository().isSupportingEcore(); for (InternalCDOPackageInfo packageInfo : packageInfos) { EPackage ePackage = packageInfo.getEPackage(); - if (!CDOModelUtil.isCorePackage(ePackage) || supportingEcore) - { - mapClasses(connection, unmap, EMFUtil.getPersistentClasses(ePackage)); - } + EClass[] persistentClasses = EMFUtil.getPersistentClasses(ePackage); + mapClasses(connection, unmap, persistentClasses); } } diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java index fb7be679f1..d556cfe570 100644 --- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java +++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java @@ -55,6 +55,10 @@ public class HibernateRawCommitContext implements InternalCommitContext private CDOBranchPoint branchPoint; + private boolean usingEcore; + + private boolean usingEtypes; + public CDORevision getRevision(CDOID id) { for (CDORevision cdoRevision : newObjects) @@ -113,6 +117,16 @@ public class HibernateRawCommitContext implements InternalCommitContext return false; } + public boolean isUsingEcore() + { + return usingEcore; + } + + public boolean isUsingEtypes() + { + return usingEtypes; + } + public InternalCDOPackageUnit[] getNewPackageUnits() { return new InternalCDOPackageUnit[0]; @@ -238,6 +252,16 @@ public class HibernateRawCommitContext implements InternalCommitContext { } + public void setUsingEcore(boolean usingEcore) + { + this.usingEcore = usingEcore; + } + + public void setUsingEtypes(boolean usingEtypes) + { + this.usingEtypes = usingEtypes; + } + public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits) { } diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java index 6b8c34b9bc..e02c361587 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java @@ -24,6 +24,7 @@ import org.eclipse.emf.cdo.common.model.EMFUtil; import org.eclipse.emf.cdo.common.protocol.CDODataInput; import org.eclipse.emf.cdo.common.protocol.CDODataOutput; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.etypes.EtypesPackage; import org.eclipse.emf.cdo.server.IView; import org.eclipse.emf.cdo.server.internal.net4j.bundle.OM; import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry; @@ -40,6 +41,8 @@ import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; @@ -170,9 +173,22 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori TRACER.format("Reading {0} new objects", newObjects.length); //$NON-NLS-1$ } + boolean usingEcore = false; + boolean usingEtypes = false; for (int i = 0; i < newObjects.length; i++) { newObjects[i] = (InternalCDORevision)in.readCDORevision(); + + EPackage ePackage = newObjects[i].getEClass().getEPackage(); + if (ePackage == EcorePackage.eINSTANCE) + { + usingEcore = true; + } + else if (ePackage == EtypesPackage.eINSTANCE) + { + usingEtypes = true; + } + monitor.worked(); } @@ -251,6 +267,8 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori } commitContext.setClearResourcePathCache(clearResourcePathCache); + commitContext.setUsingEcore(usingEcore); + commitContext.setUsingEtypes(usingEtypes); commitContext.setNewPackageUnits(newPackageUnits); commitContext.setLocksOnNewObjects(locksOnNewObjects); commitContext.setNewObjects(newObjects); diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java index 9a62a2c571..99a7227401 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java @@ -176,7 +176,6 @@ public class OpenSessionIndication extends CDOServerIndicationWithMonitoring out.writeCDOID(repository.getRootResourceID()); out.writeBoolean(repository.isSupportingAudits()); out.writeBoolean(repository.isSupportingBranches()); - out.writeBoolean(repository.isSupportingEcore()); out.writeBoolean(repository.isSerializingCommits()); out.writeBoolean(repository.isEnsuringReferentialIntegrity()); out.writeEnum(repository.getIDGenerationLocation()); diff --git a/plugins/org.eclipse.emf.cdo.server.product/config-ssl/cdo-server.xml b/plugins/org.eclipse.emf.cdo.server.product/config-ssl/cdo-server.xml index 529388b345..ce8adf6a97 100644 --- a/plugins/org.eclipse.emf.cdo.server.product/config-ssl/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.server.product/config-ssl/cdo-server.xml @@ -12,7 +12,6 @@ <property name="overrideUUID" value=""/> <property name="supportingAudits" value="true"/> <property name="supportingBranches" value="true"/> - <property name="supportingEcore" value="false"/> <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="STORE"/> <!-- Possible values: STORE | CLIENT --> diff --git a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml index af96b28ec4..fb03664ee6 100644 --- a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml @@ -17,7 +17,6 @@ <property name="overrideUUID" value=""/> <property name="supportingAudits" value="true"/> <property name="supportingBranches" value="true"/> - <property name="supportingEcore" value="true"/> <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="STORE"/> <!-- Possible values: STORE | CLIENT --> diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingRepository.java index 6fa2412769..0eece545a8 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingRepository.java @@ -356,6 +356,7 @@ public abstract class DelegatingRepository implements InternalRepository return getDelegate().processPackage(value); } + @Deprecated public boolean isSupportingEcore() { return getDelegate().isSupportingEcore(); 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 aae31efc84..190661ceb5 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 @@ -153,8 +153,6 @@ public class Repository extends Container<Object> implements InternalRepository private boolean supportingBranches; - private boolean supportingEcore; - private boolean serializingCommits; private boolean ensuringReferentialIntegrity; @@ -325,9 +323,10 @@ public class Repository extends Container<Object> implements InternalRepository return supportingBranches; } + @Deprecated public boolean isSupportingEcore() { - return supportingEcore; + return true; } public boolean isSerializingCommits() @@ -1634,12 +1633,6 @@ public class Repository extends Container<Object> implements InternalRepository supportingBranches = store.getRevisionParallelism() == IStore.RevisionParallelism.BRANCHING; } - String valueEcore = properties.get(Props.SUPPORTING_ECORE); - if (valueEcore != null) - { - supportingEcore = Boolean.valueOf(valueEcore); - } - String valueCommits = properties.get(Props.SERIALIZE_COMMITS); if (valueCommits != null) { diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java index 035cd907fc..b00b81f122 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java @@ -646,6 +646,7 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd return repository.isSupportingBranches(); } + @Deprecated public boolean isSupportingEcore() { return repository.isSupportingEcore(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java index b2c16c42c3..84aa6f2cdd 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java @@ -131,6 +131,10 @@ public class TransactionCommitContext implements InternalCommitContext private boolean clearResourcePathCache; + private boolean usingEcore; + + private boolean usingEtypes; + private InternalCDOPackageUnit[] newPackageUnits = new InternalCDOPackageUnit[0]; private CDOLockState[] locksOnNewObjects = new CDOLockState[0]; @@ -239,6 +243,16 @@ public class TransactionCommitContext implements InternalCommitContext return clearResourcePathCache; } + public boolean isUsingEcore() + { + return usingEcore; + } + + public boolean isUsingEtypes() + { + return usingEtypes; + } + public InternalCDOPackageUnit[] getNewPackageUnits() { return newPackageUnits; @@ -414,6 +428,16 @@ public class TransactionCommitContext implements InternalCommitContext this.clearResourcePathCache = clearResourcePathCache; } + public void setUsingEcore(boolean usingEcore) + { + this.usingEcore = usingEcore; + } + + public void setUsingEtypes(boolean usingEtypes) + { + this.usingEtypes = usingEtypes; + } + public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits) { this.newPackageUnits = newPackageUnits; diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java index 097567ffbe..1868824b9a 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java @@ -135,6 +135,7 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI return session.getRepository().isSupportingBranches(); } + @Deprecated public boolean isSupportingEcore() { return session.getRepository().isSupportingEcore(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java index 0fa4afdd27..87b7abd69f 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java @@ -281,7 +281,9 @@ public interface IRepository extends CDOCommonRepository, IQueryHandlerProvider, /** * @since 4.0 + * @deprecated As of 4.2 instances of Ecore are always supported (on demand). */ + @Deprecated public static final String SUPPORTING_ECORE = "supportingEcore"; //$NON-NLS-1$ /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java index 991ca19e31..6038ab0441 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java @@ -324,6 +324,16 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com public boolean isClearResourcePathCache(); /** + * @since 4.2 + */ + public boolean isUsingEcore(); + + /** + * @since 4.2 + */ + public boolean isUsingEtypes(); + + /** * Returns an array of the new package units that are part of the commit operation represented by this * <code>CommitContext</code>. */ diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java index ca87b5ad28..6f63c67757 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java @@ -84,6 +84,16 @@ public interface InternalCommitContext extends IStoreAccessor.CommitContext */ public void setClearResourcePathCache(boolean clearResourcePathCache); + /** + * @since 4.2 + */ + public void setUsingEcore(boolean usingEcore); + + /** + * @since 4.2 + */ + public void setUsingEtypes(boolean usingEtypes); + public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits); /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java index 5a2462d469..dc46f5e3d3 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java @@ -76,12 +76,9 @@ public abstract class StoreAccessor extends StoreAccessorBase try { monitor.begin(1 + newPackageUnits.length + 2 + newObjects.length + detachedObjects.length + dirtyCount + 1); - writeCommitInfo(branch, timeStamp, previousTimeStamp, userID, commitComment, monitor.fork()); - if (newPackageUnits.length != 0) - { - writePackageUnits(newPackageUnits, monitor.fork(newPackageUnits.length)); - } + writeCommitInfo(branch, timeStamp, previousTimeStamp, userID, commitComment, monitor.fork()); + writePackageUnits(newPackageUnits, monitor.fork(newPackageUnits.length)); IDGenerationLocation idGenerationLocation = store.getRepository().getIDGenerationLocation(); if (idGenerationLocation == IDGenerationLocation.STORE) diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java index eee5b974c4..1da17ec33c 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java @@ -35,6 +35,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** + * Bug 316444. + * * @author Martin Fluegge * @since 4.0 */ diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_404318_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_404318_Test.java index 9225f7bb6a..19e7e979df 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_404318_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_404318_Test.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.tests.bugzilla; -import org.eclipse.emf.cdo.server.IRepository; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.tests.AbstractCDOTest; import org.eclipse.emf.cdo.transaction.CDOTransaction; @@ -24,7 +23,6 @@ import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl; import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; import java.net.URL; -import java.util.Map; /** * Bug 404318: Tests that we don't get certain NPEs when processing dynamic objects whose @@ -73,14 +71,6 @@ public class Bugzilla_404318_Test extends AbstractCDOTest // // test framework - @Override - public Map<String, String> getRepositoryProperties() - { - Map<String, String> result = super.getRepositoryProperties(); - result.put(IRepository.Props.SUPPORTING_ECORE, Boolean.toString(true)); - return result; - } - protected EPackage getTestPackage(ResourceSet rset) throws Exception { rset.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java index 2454786255..d6b7670d72 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java @@ -299,7 +299,6 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf props.put(Props.OVERRIDE_UUID, ""); // UUID := name !!! props.put(Props.SUPPORTING_AUDITS, Boolean.toString(supportingAudits)); props.put(Props.SUPPORTING_BRANCHES, Boolean.toString(supportingBranches)); - props.put(Props.SUPPORTING_ECORE, "false"); props.put(Props.ID_GENERATION_LOCATION, idGenerationLocation.toString()); } diff --git a/plugins/org.eclipse.emf.cdo/plugin.xml b/plugins/org.eclipse.emf.cdo/plugin.xml index 11e02b4ded..5ef6570933 100644 --- a/plugins/org.eclipse.emf.cdo/plugin.xml +++ b/plugins/org.eclipse.emf.cdo/plugin.xml @@ -42,7 +42,7 @@ id="org.eclipse.emf.cdo.session.properties" type="org.eclipse.emf.cdo.session.CDOSession" namespace="org.eclipse.emf.cdo.session" - properties="open,sessionID,userID,passiveUpdateEnabled,lastUpdateTime,passiveUpdateMode,repositoryName,repositoryUUID,repositoryType,repositoryState,repositoryCreationTime,supportingAudits,supportingBranches,supportingEcore,serializeCommits,ensureReferentialIntegrity,idGenerationLocation,storeType,objectIDTypes" + properties="open,sessionID,userID,passiveUpdateEnabled,lastUpdateTime,passiveUpdateMode,repositoryName,repositoryUUID,repositoryType,repositoryState,repositoryCreationTime,supportingAudits,supportingBranches,serializeCommits,ensureReferentialIntegrity,idGenerationLocation,storeType,objectIDTypes" class="org.eclipse.emf.internal.cdo.session.SessionProperties$Tester"/> <propertyTester id="org.eclipse.emf.cdo.view.properties" diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties index 7664ea2615..adfdafe53c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties @@ -111,8 +111,6 @@ SessionPropertyTester_24=Store Type SessionPropertyTester_25=The type of the store that backs the repository of this session. SessionPropertyTester_26=Object ID Types SessionPropertyTester_27=The types of object IDs created by the store that backs the repository of this session. -SessionPropertyTester_28=Supporting Ecore -SessionPropertyTester_29=Whether the repository of this session is supporting Ecore instances. SessionPropertyTester_30=Ensure Referential Integrity SessionPropertyTester_31=Whether the repository of this session is ensuring referential integrity. SessionPropertyTester_32=ID Generation Location diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java index a77b5a4805..a44794fd66 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java @@ -186,17 +186,6 @@ public class SessionProperties extends Properties<CDOSession> implements CDOComm } }); - add(new Property<CDOSession>("supportingEcore", Messages.getString("SessionPropertyTester_28"), // - Messages.getString("SessionPropertyTester_29"), //$NON-NLS-1$ - CATEGORY_REPOSITORY) - { - @Override - protected Object eval(CDOSession session) - { - return session.getRepositoryInfo().isSupportingEcore(); - } - }); - add(new Property<CDOSession>("serializeCommits", Messages.getString("SessionPropertyTester_38"), // Messages.getString("SessionPropertyTester_39"), //$NON-NLS-1$ CATEGORY_REPOSITORY) @@ -329,6 +318,7 @@ public class SessionProperties extends Properties<CDOSession> implements CDOComm throw new UnsupportedOperationException(); } + @Deprecated public boolean isSupportingEcore() { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java index ee0d6a7147..2669431a9b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java @@ -331,8 +331,6 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo private boolean repositorySupportingBranches; - private boolean repositorySupportingEcore; - private boolean repositorySerializingCommits; private boolean repositoryEnsuringReferentialIntegrity; @@ -347,9 +345,8 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo public OpenSessionResult(int sessionID, String userID, String repositoryUUID, CDOCommonRepository.Type repositoryType, CDOCommonRepository.State repositoryState, String storeType, Set<CDOID.ObjectType> objectIDTypes, long repositoryCreationTime, long lastUpdateTime, CDOID rootResourceID, - boolean repositorySupportingAudits, boolean repositorySupportingBranches, boolean repositorySupportingEcore, - boolean repositorySerializingCommits, boolean repositoryEnsuringReferentialIntegrity, - IDGenerationLocation repositoryIDGenerationLocation) + boolean repositorySupportingAudits, boolean repositorySupportingBranches, boolean repositorySerializingCommits, + boolean repositoryEnsuringReferentialIntegrity, IDGenerationLocation repositoryIDGenerationLocation) { this.sessionID = sessionID; this.userID = userID; @@ -363,7 +360,6 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo this.rootResourceID = rootResourceID; this.repositorySupportingAudits = repositorySupportingAudits; this.repositorySupportingBranches = repositorySupportingBranches; - this.repositorySupportingEcore = repositorySupportingEcore; this.repositorySerializingCommits = repositoryEnsuringReferentialIntegrity; this.repositoryEnsuringReferentialIntegrity = repositoryEnsuringReferentialIntegrity; this.repositoryIDGenerationLocation = repositoryIDGenerationLocation; @@ -446,11 +442,12 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo } /** - * @since 4.0 + * @deprecated As of 4.2 instances of Ecore are always supported (on demand). */ + @Deprecated public boolean isRepositorySupportingEcore() { - return repositorySupportingEcore; + return true; } /** |