diff options
author | Eike Stepper | 2012-09-15 17:19:49 +0000 |
---|---|---|
committer | Eike Stepper | 2012-09-15 17:19:49 +0000 |
commit | 8b9148653cd64e2a072292e4b5521f41be815dd7 (patch) | |
tree | 1a3f8f18977c55cdcc6084d763b5265145c6873f | |
parent | c5f8afb091979d794f7b023f98bbc6a748d90f48 (diff) | |
download | cdo-8b9148653cd64e2a072292e4b5521f41be815dd7.tar.gz cdo-8b9148653cd64e2a072292e4b5521f41be815dd7.tar.xz cdo-8b9148653cd64e2a072292e4b5521f41be815dd7.zip |
[389665] Cache path->resourceNodeID mappings in AbstractCDOView
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389665
43 files changed, 865 insertions, 159 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters new file mode 100644 index 0000000000..79f6aba7df --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<component id="org.eclipse.emf.cdo.common" version="2"> + <resource path="META-INF/MANIFEST.MF"> + <filter id="923795461"> + <message_arguments> + <message_argument value="4.2.0"/> + <message_argument value="4.1.0"/> + </message_arguments> + </filter> + </resource> + <resource path="src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java" type="org.eclipse.emf.cdo.common.model.CDOModelConstants"> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="BLOB_CLASS_NAME"/> + <message_argument value="Blob"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="CLOB_CLASS_NAME"/> + <message_argument value="Clob"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="CORE_PACKAGE_URI"/> + <message_argument value="http://www.eclipse.org/emf/2002/Ecore"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="RESOURCE_CLASS_NAME"/> + <message_argument value="CDOResource"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="RESOURCE_FOLDER_CLASS_NAME"/> + <message_argument value="CDOResourceFolder"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="RESOURCE_NODE_CLASS_NAME"/> + <message_argument value="CDOResourceNode"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="RESOURCE_NODE_NAME_ATTRIBUTE"/> + <message_argument value="name"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="RESOURCE_PACKAGE_URI"/> + <message_argument value="http://www.eclipse.org/emf/CDO/Eresource/4.0.0"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="ROOT_CLASS_NAME"/> + <message_argument value="EObject"/> + </message_arguments> + </filter> + <filter id="389242988"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.model.CDOModelConstants"/> + <message_argument value="TYPES_PACKAGE_URI"/> + <message_argument value="http://www.eclipse.org/emf/CDO/Etypes/4.0.0"/> + </message_arguments> + </filter> + </resource> +</component> diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java index 373c7eecc1..6b5137b55e 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java @@ -12,7 +12,7 @@ package org.eclipse.emf.cdo.common.model; /** * Symbolic model constants commonly used in CDO. - * + * * @author Eike Stepper * @since 4.0 * @noextend This interface is not intended to be extended by clients. @@ -20,50 +20,80 @@ package org.eclipse.emf.cdo.common.model; */ public interface CDOModelConstants { - public static final String RESOURCE_NODE_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$ + /** + * @since 4.2 + */ + public static final String RESOURCE_FOLDER_NODES_REFERENCE = "nodes".intern(); //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String RESOURCE_NODE_FOLDER_REFERENCE = "folder".intern(); //$NON-NLS-1$ + + public static final String RESOURCE_NODE_NAME_ATTRIBUTE = "name".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String CORE_PACKAGE_URI = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$ + public static final String CORE_PACKAGE_URI = "http://www.eclipse.org/emf/2002/Ecore".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String ROOT_CLASS_NAME = "EObject"; //$NON-NLS-1$ + public static final String ROOT_CLASS_NAME = "EObject".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String RESOURCE_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Eresource/4.0.0"; //$NON-NLS-1$ + public static final String RESOURCE_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Eresource/4.0.0".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String RESOURCE_NODE_CLASS_NAME = "CDOResourceNode"; //$NON-NLS-1$ + public static final String RESOURCE_NODE_CLASS_NAME = "CDOResourceNode".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String RESOURCE_FOLDER_CLASS_NAME = "CDOResourceFolder"; //$NON-NLS-1$ + public static final String RESOURCE_FOLDER_CLASS_NAME = "CDOResourceFolder".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String RESOURCE_CLASS_NAME = "CDOResource"; //$NON-NLS-1$ + public static final String RESOURCE_CLASS_NAME = "CDOResource".intern(); //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String RESOURCE_LEAF_CLASS_NAME = "CDOResourceLeaf".intern(); //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String RESOURCE_FILE_CLASS_NAME = "CDOFileResource".intern(); //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String RESOURCE_BINARY_FILE_CLASS_NAME = "CDOBinaryResource".intern(); //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String RESOURCE_TEXT_FILE_CLASS_NAME = "CDOTextResource".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String TYPES_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Etypes/4.0.0"; //$NON-NLS-1$ + public static final String TYPES_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Etypes/4.0.0".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String BLOB_CLASS_NAME = "Blob"; //$NON-NLS-1$ + public static final String BLOB_CLASS_NAME = "Blob".intern(); //$NON-NLS-1$ /** * @since 4.0 */ - public static final String CLOB_CLASS_NAME = "Clob"; //$NON-NLS-1$ + public static final String CLOB_CLASS_NAME = "Clob".intern(); //$NON-NLS-1$ } diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java index 925ba059a9..f9da7208b4 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java @@ -115,7 +115,8 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isCorePackage(EPackage ePackage) { - return CDOModelConstants.CORE_PACKAGE_URI.equals(ePackage.getNsURI()); + String nsURI = ePackage.getNsURI().intern(); + return nsURI == CORE_PACKAGE_URI; } /** @@ -123,7 +124,13 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isRoot(EClass eClass) { - return isCorePackage(eClass.getEPackage()) && CDOModelConstants.ROOT_CLASS_NAME.equals(eClass.getName()); + if (isCorePackage(eClass.getEPackage())) + { + String name = eClass.getName().intern(); + return ROOT_CLASS_NAME == name; + } + + return false; } /** @@ -131,7 +138,8 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isResourcePackage(EPackage ePackage) { - return CDOModelConstants.RESOURCE_PACKAGE_URI.equals(ePackage.getNsURI()); + String nsURI = ePackage.getNsURI().intern(); + return nsURI == RESOURCE_PACKAGE_URI; } /** @@ -139,7 +147,13 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isResource(EClass eClass) { - return isResourcePackage(eClass.getEPackage()) && CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName()); + if (isResourcePackage(eClass.getEPackage())) + { + String name = eClass.getName().intern(); + return name == RESOURCE_CLASS_NAME; + } + + return false; } /** @@ -147,8 +161,13 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isResourceFolder(EClass eClass) { - return isResourcePackage(eClass.getEPackage()) - && CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME.equals(eClass.getName()); + if (isResourcePackage(eClass.getEPackage())) + { + String name = eClass.getName().intern(); + return name == RESOURCE_FOLDER_CLASS_NAME; + } + + return false; } /** @@ -156,10 +175,15 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isResourceNode(EClass eClass) { - return isResourcePackage(eClass.getEPackage()) - && (CDOModelConstants.RESOURCE_NODE_CLASS_NAME.equals(eClass.getName()) - || CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName()) || CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME - .equals(eClass.getName())); + if (isResourcePackage(eClass.getEPackage())) + { + String name = eClass.getName().intern(); + return name == RESOURCE_NODE_CLASS_NAME || name == RESOURCE_LEAF_CLASS_NAME || name == RESOURCE_CLASS_NAME + || name == RESOURCE_CLASS_NAME || name == RESOURCE_CLASS_NAME || name == RESOURCE_CLASS_NAME + || name == RESOURCE_FOLDER_CLASS_NAME; + } + + return false; } /** @@ -167,7 +191,8 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isTypesPackage(EPackage ePackage) { - return CDOModelConstants.TYPES_PACKAGE_URI.equals(ePackage.getNsURI()); + String nsURI = ePackage.getNsURI().intern(); + return nsURI == TYPES_PACKAGE_URI; } /** @@ -175,7 +200,8 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isSystemPackage(EPackage ePackage) { - return isCorePackage(ePackage) || isResourcePackage(ePackage) || isTypesPackage(ePackage); + String nsURI = ePackage.getNsURI().intern(); + return nsURI == CORE_PACKAGE_URI || nsURI == RESOURCE_PACKAGE_URI || nsURI == TYPES_PACKAGE_URI; } /** @@ -183,9 +209,13 @@ public final class CDOModelUtil implements CDOModelConstants */ public static boolean isLob(EClassifier eClassifier) { - return isTypesPackage(eClassifier.getEPackage()) - && (CDOModelConstants.BLOB_CLASS_NAME.equals(eClassifier.getName()) || CDOModelConstants.CLOB_CLASS_NAME - .equals(eClassifier.getName())); + if (isTypesPackage(eClassifier.getEPackage())) + { + String name = eClassifier.getName().intern(); + return name == BLOB_CLASS_NAME || name == CLOB_CLASS_NAME; + } + + return false; } /** @@ -238,12 +268,12 @@ public final class CDOModelUtil implements CDOModelConstants else if (isTypesPackage(ePackage)) { String name = eDataType.getName(); - if (CDOModelConstants.BLOB_CLASS_NAME.equals(name)) + if (BLOB_CLASS_NAME.equals(name)) { return CDOType.BLOB; } - if (CDOModelConstants.CLOB_CLASS_NAME.equals(name)) + if (CLOB_CLASS_NAME.equals(name)) { return CDOType.CLOB; } @@ -353,42 +383,47 @@ public final class CDOModelUtil implements CDOModelConstants */ public static CDOType getTypeOfObject(Object object) { - if (object instanceof BigDecimal) + if (object == null) + { + return CDOType.OBJECT; + } + + if (object.getClass() == BigDecimal.class || object instanceof BigDecimal) { return CDOType.BIG_DECIMAL; } - if (object instanceof BigInteger) + if (object.getClass() == BigInteger.class || object instanceof BigInteger) { return CDOType.BIG_INTEGER; } - if (object instanceof Boolean) + if (object.getClass() == Boolean.class || object instanceof Boolean) { return CDOType.BOOLEAN_OBJECT; } - if (object instanceof Byte) + if (object.getClass() == Byte.class || object instanceof Byte) { return CDOType.BYTE_OBJECT; } - if (object instanceof byte[]) + if (object.getClass() == byte[].class || object instanceof byte[]) { return CDOType.BYTE_ARRAY; } - if (object instanceof Character) + if (object.getClass() == Character.class || object instanceof Character) { return CDOType.CHARACTER_OBJECT; } - if (object instanceof Date) + if (object.getClass() == Date.class || object instanceof Date) { return CDOType.DATE; } - if (object instanceof Double) + if (object.getClass() == Double.class || object instanceof Double) { return CDOType.DOUBLE_OBJECT; } @@ -403,27 +438,27 @@ public final class CDOModelUtil implements CDOModelConstants return CDOType.FEATURE_MAP_ENTRY; } - if (object instanceof Float) + if (object.getClass() == Float.class || object instanceof Float) { return CDOType.FLOAT_OBJECT; } - if (object instanceof Integer) + if (object.getClass() == Integer.class || object instanceof Integer) { return CDOType.INTEGER_OBJECT; } - if (object instanceof Long) + if (object.getClass() == Long.class || object instanceof Long) { return CDOType.LONG_OBJECT; } - if (object instanceof Short) + if (object.getClass() == Short.class || object instanceof Short) { return CDOType.SHORT_OBJECT; } - if (object instanceof String) + if (object.getClass() == String.class || object instanceof String) { return CDOType.STRING; } @@ -433,11 +468,6 @@ public final class CDOModelUtil implements CDOModelConstants return CDOType.OBJECT; } - if (object == null) - { - return CDOType.OBJECT; - } - throw new IllegalArgumentException("Object type " + object.getClass().getName() + " is not supported."); } diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java index 9435f8c57a..4b48950872 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java @@ -28,7 +28,7 @@ public interface CDOProtocolConstants /** * @since 4.2 */ - public static final int PROTOCOL_VERSION = 9; + public static final int PROTOCOL_VERSION = 10; // ////////////////////////////////////////////////////////////////////// // Signal IDs diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java index 0213ec5553..9776b5e400 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java @@ -27,7 +27,7 @@ import java.util.List; /** * Represents the change delta between two {@link CDORevision revisions} of a CDO object. The detailed * {@link CDOFeatureDelta feature deltas} are returned by the {@link #getFeatureDeltas()} method. - * + * * @author Eike Stepper * @since 2.0 * @noextend This interface is not intended to be extended by clients. @@ -43,7 +43,7 @@ public interface CDORevisionDelta extends CDORevisionKey * This constant is only passed into conflict resolvers to indicate that a conflict was caused by remote detachment of * an object. Calling any method on this marker instance will result in an {@link UnsupportedOperationException} being * thrown. - * + * * @since 4.0 */ public static final CDORevisionDelta DETACHED = new CDODetachedRevisionDeltaImpl(); diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java index d51261b058..f909f5b60f 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java @@ -62,6 +62,11 @@ public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta throw new UnsupportedOperationException(); } + public boolean isResourcePathChange() + { + throw new UnsupportedOperationException(); + } + public CDORevisionDelta copy() { return this; diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java index 77588ac82f..dfb8fbc169 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java @@ -34,6 +34,8 @@ public class CommitNotificationIndication extends CDOClientIndication { InternalCDOSession session = getSession(); CDOCommitInfo commitInfo = in.readCDOCommitInfo(); - session.handleCommitNotification(commitInfo); + boolean clearResourcePathCache = in.readBoolean(); + + session.handleCommitNotification(commitInfo, clearResourcePathCache); } } diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java index 190bc92581..08c8bd482d 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java @@ -41,6 +41,7 @@ import org.eclipse.emf.cdo.session.CDORepositoryInfo; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.internal.cdo.object.CDOObjectReferenceImpl; +import org.eclipse.emf.internal.cdo.view.AbstractCDOView; import org.eclipse.net4j.util.concurrent.ConcurrencyUtil; import org.eclipse.net4j.util.io.ExtendedDataOutputStream; @@ -83,6 +84,8 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com private CDOTransaction transaction; + private boolean clearResourcePathCache; + public CommitTransactionRequest(CDOClientProtocol protocol, InternalCDOCommitContext context) { this(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION, context); @@ -182,11 +185,20 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com TRACER.format("Writing {0} dirty objects", changedObjects.size()); //$NON-NLS-1$ } + CDOID rootResourceID = transaction.getSession().getRepositoryInfo().getRootResourceID(); for (CDORevisionKey changedObject : changedObjects) { - out.writeCDORevisionDelta((CDORevisionDelta)changedObject); + CDORevisionDelta delta = (CDORevisionDelta)changedObject; + if (!clearResourcePathCache && AbstractCDOView.canHaveResourcePathImpact(delta, rootResourceID)) + { + clearResourcePathCache = true; + } + + out.writeCDORevisionDelta(delta); } + out.writeBoolean(clearResourcePathCache); + if (TRACER.isEnabled()) { TRACER.format("Writing {0} detached objects", detachedObjects.size()); //$NON-NLS-1$ @@ -301,7 +313,8 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com } } - return new CommitTransactionResult(idProvider, rollbackMessage, branchPoint, previousTimeStamp, xRefs); + return new CommitTransactionResult(idProvider, rollbackMessage, branchPoint, previousTimeStamp, xRefs, + clearResourcePathCache); } return null; diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java index 91fb1cdd66..dcc2ffd447 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java @@ -133,11 +133,17 @@ public class CDOServerProtocol extends SignalProtocol<InternalSession> implement } } + @Deprecated public void sendCommitNotification(CDOCommitInfo commitInfo) throws Exception { + sendCommitNotification(commitInfo, true); + } + + public void sendCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) throws Exception + { if (LifecycleUtil.isActive(getChannel())) { - new CommitNotificationRequest(this, commitInfo).sendAsync(); + new CommitNotificationRequest(this, commitInfo, clearResourcePathCache).sendAsync(); } else { diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java index c25c590013..ecb73ba798 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java @@ -25,15 +25,20 @@ public class CommitNotificationRequest extends CDOServerRequest { private CDOCommitInfo commitInfo; - public CommitNotificationRequest(CDOServerProtocol serverProtocol, CDOCommitInfo commitInfo) + private boolean clearResourcePathCache; + + public CommitNotificationRequest(CDOServerProtocol serverProtocol, CDOCommitInfo commitInfo, + boolean clearResourcePathCache) { super(serverProtocol, CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION); this.commitInfo = commitInfo; + this.clearResourcePathCache = clearResourcePathCache; } @Override protected void requesting(CDODataOutput out) throws IOException { out.writeCDOCommitInfo(commitInfo); // Exposes revision to client side + out.writeBoolean(clearResourcePathCache); } } 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 b4b2f24869..4577f244dc 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 @@ -197,6 +197,7 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori monitor.worked(); } + boolean clearResourcePathCache = in.readBoolean(); boolean auditing = getRepository().isSupportingAudits(); boolean ensuringReferentialIntegrity = getRepository().isEnsuringReferentialIntegrity(); @@ -249,6 +250,7 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori detachedObjectTypes = null; } + commitContext.setClearResourcePathCache(clearResourcePathCache); commitContext.setNewPackageUnits(newPackageUnits); commitContext.setLocksOnNewObjects(locksOnNewObjects); commitContext.setNewObjects(newObjects); 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 9b899553c1..5eca7e55f3 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 @@ -446,11 +446,17 @@ public abstract class DelegatingRepository implements InternalRepository getDelegate().failCommit(timeStamp); } + @Deprecated public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo) { getDelegate().sendCommitNotification(sender, commitInfo); } + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache) + { + getDelegate().sendCommitNotification(sender, commitInfo, clearResourcePathCache); + } + public void setRootResourceID(CDOID rootResourceID) { getDelegate().setRootResourceID(rootResourceID); 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 b44f6b5b0b..12ffd59028 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 @@ -944,9 +944,15 @@ public class Repository extends Container<Object> implements InternalRepository } } + @Deprecated public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo) { - sessionManager.sendCommitNotification(sender, commitInfo); + sendCommitNotification(sender, commitInfo, true); + } + + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache) + { + sessionManager.sendCommitNotification(sender, commitInfo, clearResourcePathCache); for (CDOCommitInfoHandler handler : getCommitInfoHandlers()) { 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 8c81423788..5edc2348f6 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 @@ -239,12 +239,20 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd throw new UnsupportedOperationException(); } + @Deprecated public void invalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, boolean async) { throw new UnsupportedOperationException(); } + public void invalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, + List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, boolean async, + boolean clearResourcePathCache) + { + throw new UnsupportedOperationException(); + } + public void handleLockNotification(InternalCDOView sender, CDOLockChangeInfo lockChangeInfo) { // Do nothing @@ -867,16 +875,28 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd throw new UnsupportedOperationException(); } + @Deprecated public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender) { throw new UnsupportedOperationException(); } + public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender, boolean clearResourcePathCache) + { + throw new UnsupportedOperationException(); + } + + @Deprecated public void handleCommitNotification(CDOCommitInfo commitInfo) { throw new UnsupportedOperationException(); } + public void handleCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) + { + throw new UnsupportedOperationException(); + } + public void handleLockNotification(CDOLockChangeInfo lockChangeInfo, InternalCDOView sender) { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java index 5ea3f8f7e8..4216d6b0f3 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java @@ -398,7 +398,13 @@ public class Session extends Container<IView> implements InternalSession } } - public void sendCommitNotification(final CDOCommitInfo commitInfo) throws Exception + @Deprecated + public void sendCommitNotification(CDOCommitInfo commitInfo) throws Exception + { + sendCommitNotification(commitInfo, true); + } + + public void sendCommitNotification(final CDOCommitInfo commitInfo, boolean clearResourcePathCache) throws Exception { if (protocol == null) { @@ -481,7 +487,7 @@ public class Session extends Container<IView> implements InternalSession } }; } - }); + }, clearResourcePathCache); synchronized (lastUpdateTimeLock) { diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java index 20ccd3a454..1efd41045e 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java @@ -342,15 +342,21 @@ public class SessionManager extends Container<ISession> implements InternalSessi } } + @Deprecated public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo) { + sendCommitNotification(sender, commitInfo, true); + } + + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache) + { for (InternalSession session : getSessions()) { if (session != sender) { try { - session.sendCommitNotification(commitInfo); + session.sendCommitNotification(commitInfo, clearResourcePathCache); } catch (Exception ex) { 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 2f8bc7f060..06cb7361fb 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 @@ -129,6 +129,8 @@ public class TransactionCommitContext implements InternalCommitContext private String commitComment; + private boolean clearResourcePathCache; + private InternalCDOPackageUnit[] newPackageUnits = new InternalCDOPackageUnit[0]; private CDOLockState[] locksOnNewObjects = new CDOLockState[0]; @@ -230,6 +232,11 @@ public class TransactionCommitContext implements InternalCommitContext return packageRegistry; } + public boolean isClearResourcePathCache() + { + return clearResourcePathCache; + } + public InternalCDOPackageUnit[] getNewPackageUnits() { return newPackageUnits; @@ -400,6 +407,11 @@ public class TransactionCommitContext implements InternalCommitContext StoreThreadLocal.setCommitContext(this); } + public void setClearResourcePathCache(boolean clearResourcePathCache) + { + this.clearResourcePathCache = clearResourcePathCache; + } + public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits) { this.newPackageUnits = newPackageUnits; @@ -626,7 +638,7 @@ public class TransactionCommitContext implements InternalCommitContext InternalSession sender = transaction.getSession(); CDOCommitInfo commitInfo = success ? createCommitInfo() : createFailureCommitInfo(); - repository.sendCommitNotification(sender, commitInfo); + repository.sendCommitNotification(sender, commitInfo, clearResourcePathCache); } catch (Exception ex) { diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java index cbc49a8f2a..53ccdaeadb 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java @@ -93,6 +93,11 @@ public class EmbeddedServerSessionProtocol extends Lifecycle implements ISession clientSession.handleCommitNotification(commitInfo); } + public void sendCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) throws Exception + { + throw new UnsupportedOperationException(); + } + public void sendLockNotification(CDOLockChangeInfo lockChangeInfo) { EmbeddedClientSession clientSession = clientSessionProtocol.getSession(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java index 067e2954af..37d34b26ff 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java @@ -425,7 +425,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem String comment = "<replicate raw commits>"; //$NON-NLS-1$ CDOCommitInfo commitInfo = manager.createCommitInfo(branch, toCommitTime, fromCommitTime, SYSTEM_USER_ID, comment, data); - sessionManager.sendCommitNotification(replicatorSession, commitInfo); + sessionManager.sendCommitNotification(replicatorSession, commitInfo, true); } CDOLockChangeInfo lockChangeInfo = CDOLockUtil.createLockChangeInfo(); 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 73530c3c51..991ca19e31 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 @@ -319,6 +319,11 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com public InternalCDOPackageRegistry getPackageRegistry(); /** + * @since 4.2 + */ + public boolean isClearResourcePathCache(); + + /** * 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/ISessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ISessionProtocol.java index 02d6a35cf9..56ce4b85d4 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ISessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/ISessionProtocol.java @@ -52,8 +52,17 @@ public interface ISessionProtocol extends CDOProtocol public void sendBranchNotification(InternalCDOBranch branch) throws Exception; + /** + * @deprecated As of 4.2 use {@link #sendCommitNotification(CDOCommitInfo, boolean)} + */ + @Deprecated public void sendCommitNotification(CDOCommitInfo commitInfo) throws Exception; + /** + * @since 4.2 + */ + public void sendCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) throws Exception; + public void sendRemoteSessionNotification(InternalSession sender, byte opcode) throws Exception; public void sendRemoteMessageNotification(InternalSession sender, CDORemoteSessionMessage message) throws Exception; 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 5bce8fb02a..ca87b5ad28 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 @@ -79,6 +79,11 @@ public interface InternalCommitContext extends IStoreAccessor.CommitContext */ public InternalCDORevision[] getDetachedRevisions(); + /** + * @since 4.2 + */ + public void setClearResourcePathCache(boolean clearResourcePathCache); + public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits); /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java index 4d81f9add7..de92bcd27d 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java @@ -161,9 +161,16 @@ public interface InternalRepository extends IRepository, PackageProcessor, Packa /** * @since 4.0 + * @deprecated As of 4.2 use {@link #sendCommitNotification(InternalSession, CDOCommitInfo, boolean)} */ + @Deprecated public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo); + /** + * @since 4.2 + */ + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache); + public void setRootResourceID(CDOID rootResourceID); /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSession.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSession.java index fdacb424d7..f9626ec5f3 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSession.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSession.java @@ -76,8 +76,17 @@ public interface InternalSession extends ISession, CDOIDProvider, CDOPermissionP public void sendBranchNotification(InternalCDOBranch branch) throws Exception; + /** + * @deprecated As of 4.2 use {@link #sendCommitNotification(CDOCommitInfo, boolean)} + */ + @Deprecated public void sendCommitNotification(CDOCommitInfo commitInfo) throws Exception; + /** + * @since 4.2 + */ + public void sendCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) throws Exception; + public void sendRemoteSessionNotification(InternalSession sender, byte opcode) throws Exception; public void sendRemoteMessageNotification(InternalSession sender, CDORemoteSessionMessage message) throws Exception; diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSessionManager.java index 54d85d1bb9..29af5aa91d 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSessionManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalSessionManager.java @@ -83,9 +83,18 @@ public interface InternalSessionManager extends ISessionManager public void sendBranchNotification(InternalSession sender, InternalCDOBranch branch); + /** + * @deprecated As of 4.2 use {@link #sendCommitNotification(InternalSession, CDOCommitInfo, boolean)} + */ + @Deprecated public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo); /** + * @since 4.2 + */ + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache); + + /** * @since 4.1 */ public void sendLockNotification(InternalSession sender, CDOLockChangeInfo lockChangeInfo); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_294859_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_294859_Test.java index 032b4c56bb..86532e447b 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_294859_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_294859_Test.java @@ -33,7 +33,7 @@ import java.util.Date; /** * Bug 294859 - Deltas for local changes to objects in CONFLICT state, are not added to tx - * + * * @author Caspar De Groot */ public class Bugzilla_294859_Test extends AbstractCDOTest @@ -78,7 +78,7 @@ public class Bugzilla_294859_Test extends AbstractCDOTest // Verify that the delta representing the LAST LOCAL change is in the TX // CDOSavepointImpl savepoint = (CDOSavepointImpl)((InternalCDOTransaction)tx).getLastSavepoint(); - CDORevisionDelta revDelta = savepoint.getRevisionDeltas().get(cdoPurchaseOrder.cdoID()); + CDORevisionDelta revDelta = savepoint.getRevisionDeltas2().get(cdoPurchaseOrder.cdoID()); assertNotNull(revDelta); assertEquals(true, revDelta.getFeatureDeltas().size() == 1); CDOFeatureDelta featDelta = revDelta.getFeatureDeltas().get(0); 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 845185f8ec..9f41e84552 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 @@ -791,7 +791,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf volatile int counter = 1; @Override - public void handleCommitNotification(CDOCommitInfo commitInfo) + public void handleCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) { long delay = getTestDelayed2CommitHandling(); if (delay != 0L && counter++ % 2 == 0) @@ -799,7 +799,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf AbstractOMTest.sleep(delay); } - super.handleCommitNotification(commitInfo); + super.handleCommitNotification(commitInfo, clearResourcePathCache); } }; } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionManager.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionManager.java index 77aefd9b09..5226536ea5 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionManager.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestSessionManager.java @@ -4,7 +4,7 @@ * 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: * Caspar De Groot - initial API and implementation */ @@ -54,7 +54,7 @@ public class TestSessionManager extends SessionManager } @Override - public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo) + public void sendCommitNotification(InternalSession sender, CDOCommitInfo commitInfo, boolean clearResourcePathCache) { synchronized (lock) { @@ -66,6 +66,6 @@ public class TestSessionManager extends SessionManager } } - super.sendCommitNotification(sender, commitInfo); + super.sendCommitNotification(sender, commitInfo, clearResourcePathCache); } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java index 5accac5005..33ee7d9e9e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java @@ -24,13 +24,14 @@ import org.eclipse.net4j.util.ObjectUtil; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.InternalCDOView; import java.text.MessageFormat; import java.util.List; /** * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource Node</b></em>'. - * + * * @noextend This interface is not intended to be extended by clients. <!-- end-user-doc --> * <p> * The following features are implemented: @@ -94,7 +95,7 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ public void setFolder(CDOResourceFolder newFolder) @@ -144,7 +145,7 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ public void setName(String newName) @@ -176,7 +177,7 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ public String getPath() @@ -197,7 +198,7 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe /** * <!-- begin-user-doc --> <!-- end-user-doc --> - * + * * @generated NOT */ public void setPath(String newPath) @@ -245,7 +246,9 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe { try { - cdoView().getResourceNodeID(newPath); + InternalCDOView view = cdoView(); + view.clearResourcePathCacheIfNecessary(null); + view.getResourceNodeID(newPath); } catch (Exception ex) { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java index 3c2b3387a0..b3994f8daf 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java @@ -524,6 +524,22 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction return delegate.getBinaryResource(path); } + /** + * @since 4.2 + */ + public CDOResourceFolder getResourceFolder(String path) + { + return delegate.getResourceFolder(path); + } + + /** + * @since 4.2 + */ + public void setResourcePathCache(Map<String, CDOID> resourcePathCache) + { + delegate.setResourcePathCache(resourcePathCache); + } + public ResourceSet getResourceSet() { return delegate.getResourceSet(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java index e7fcfc7b2c..2a14f4ae2b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOSavepoint.java @@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentMap; /** * One in a sequence of possibly several points in time of a {@link CDOTransaction transaction} that encapsulates the * changes to transactional objects and that later changes can be {@link #rollback() rolled back} to. - * + * * @author Eike Stepper * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -61,7 +61,7 @@ public interface CDOSavepoint extends CDOUserSavepoint, CDOChangeSetDataProvider /** * Bug 283985 (Re-attachment) - * + * * @since 3.0 */ public Map<CDOID, CDOObject> getReattachedObjects(); @@ -72,18 +72,34 @@ public interface CDOSavepoint extends CDOUserSavepoint, CDOChangeSetDataProvider public Map<CDOID, CDOObject> getDirtyObjects(); /** + * The returned map delegates to {@link #getRevisionDeltas2()} and does <b>not</b> support the following methods: + * + * <ul> + * <li> {@link ConcurrentMap#putIfAbsent(Object, Object)} + * <li> {@link ConcurrentMap#remove(Object, Object)} + * <li> {@link ConcurrentMap#replace(Object, Object)} + * <li> {@link ConcurrentMap#replace(Object, Object, Object)} + * </ul> + * * @since 3.0 + * @deprecated As of 4.2 use {@link #getRevisionDeltas2()} instead. */ + @Deprecated public ConcurrentMap<CDOID, CDORevisionDelta> getRevisionDeltas(); /** + * @since 4.2 + */ + public Map<CDOID, CDORevisionDelta> getRevisionDeltas2(); + + /** * @since 3.0 */ public Map<CDOID, CDORevision> getAllBaseNewObjects(); /** * Return the list of new objects from this point without objects that are removed. - * + * * @since 3.0 */ public Map<CDOID, CDOObject> getAllNewObjects(); @@ -95,14 +111,14 @@ public interface CDOSavepoint extends CDOUserSavepoint, CDOChangeSetDataProvider /** * Return the list of new objects from this point. - * + * * @since 3.0 */ public Map<CDOID, CDOObject> getAllDirtyObjects(); /** * Return the list of all deltas without objects that are removed. - * + * * @since 3.0 */ public Map<CDOID, CDORevisionDelta> getAllRevisionDeltas(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java index 4b044d5f36..9ddac0ef4c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java @@ -50,6 +50,7 @@ import org.eclipse.emf.ecore.resource.URIHandler; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -220,6 +221,11 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, INotifier public CDOResourceNode getResourceNode(String path) throws CDOException; /** + * @since 4.2 + */ + public CDOResourceFolder getResourceFolder(String path); + + /** * Returns the root resource of the repository. * <p> * The root resource is a special resource with only {@link CDOResourceNode CDOResourceNodes} in its contents list. @@ -228,6 +234,26 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, INotifier public CDOResource getRootResource(); /** + * Sets the new {@link Map map} to be used as a cache for various <code>get*Resource*(String path)</code> methods. + * <p> + * Can be used to reset/clear the resource path cache by passing a <code>new HashMap<String, CDOID>()</code>. + * Smarter maps could implement a LRU eviction policy to limit the map capacity. + * Passing <code>null</code> disables resource path caching. + * <p> + * The default value is <code>new HashMap<String, CDOID>()</code>. + * + * @see #getResourceNode(String) + * @see #getResource(String) + * @see #getResource(String, boolean) + * @see #getBinaryResource(String) + * @see #getTextResource(String) + * @see #getResourceFolder(String) + * @see #hasResource(String) + * @since 4.2 + */ + public void setResourcePathCache(Map<String, CDOID> resourcePathCache); + + /** * Returns a list of the resources in the given folder with a name equal to or starting with the value of the name * parameter. * 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 e2735e5aa2..29408c576e 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 @@ -52,7 +52,6 @@ CDOViewImpl.30=Different object was registered for {0} CDOViewImpl.3=name == null CDOViewImpl.4=Expected folder for id = {0} CDOViewImpl.5=Node {0} not found -CDOViewImpl.6=No root ResourceNode CDOViewImpl.7=No top level ResourceNode with the name {0} CDOViewImpl.8=Duplicate top-level ResourceNodes CDOViewImpl.9=Cannot find revision with ID {0} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java index 2ff84f65b5..5b94c0f3a1 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java @@ -645,7 +645,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme for (InternalCDOView view : branchViews) { view.invalidate(view.getBranch(), result.getLastUpdateTime(), changedObjects, detachedObjects, oldRevisions, - false); + false, true); } } @@ -842,12 +842,18 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme getBranchManager().handleBranchCreated(branch); } + @Deprecated public void handleCommitNotification(CDOCommitInfo commitInfo) { + handleCommitNotification(commitInfo, true); + } + + public void handleCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache) + { try { registerPackageUnits(commitInfo.getNewPackageUnits()); - invalidate(commitInfo, null); + invalidate(commitInfo, null, clearResourcePathCache); } catch (RuntimeException ex) { @@ -1046,11 +1052,14 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme return null; } - /** - * @since 2.0 - */ + @Deprecated public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender) { + invalidate(commitInfo, sender, true); + } + + public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender, boolean clearResourcePathCache) + { long previousTimeStamp = commitInfo.getPreviousTimeStamp(); long lastUpdateTime = getLastUpdateTime(); @@ -1061,8 +1070,8 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme synchronized (outOfSequenceInvalidations) { - outOfSequenceInvalidations.put(previousTimeStamp, new Pair<CDOCommitInfo, InternalCDOTransaction>(commitInfo, - sender)); + outOfSequenceInvalidations.put(previousTimeStamp, new OutOfSequenceInvalidation(commitInfo, sender, + clearResourcePathCache)); } long nextPreviousTimeStamp = lastUpdateTime; @@ -1070,18 +1079,18 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme { synchronized (outOfSequenceInvalidations) { - Pair<CDOCommitInfo, InternalCDOTransaction> currentPair = outOfSequenceInvalidations - .remove(nextPreviousTimeStamp); + OutOfSequenceInvalidation currentInvalidation = outOfSequenceInvalidations.remove(nextPreviousTimeStamp); // If we don't have the invalidation that follows the last one we processed, // then there is nothing we can do right now - if (currentPair == null) + if (currentInvalidation == null) { break; } - final CDOCommitInfo currentCommitInfo = currentPair.getElement1(); - final InternalCDOTransaction currentSender = currentPair.getElement2(); + final CDOCommitInfo currentCommitInfo = currentInvalidation.getCommitInfo(); + final InternalCDOTransaction currentSender = currentInvalidation.getSender(); + final boolean currentClearResourcePathCache = currentInvalidation.isClearResourcePathCache(); nextPreviousTimeStamp = currentCommitInfo.getTimeStamp(); if (sender == null) @@ -1091,13 +1100,13 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme { public void run() { - invalidateOrdered(currentCommitInfo, currentSender); + invalidateOrdered(currentCommitInfo, currentSender, currentClearResourcePathCache); } }); } else { - invalidateOrdered(currentCommitInfo, currentSender); + invalidateOrdered(currentCommitInfo, currentSender, currentClearResourcePathCache); } } } @@ -1117,7 +1126,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme return invalidationRunner; } - private void invalidateOrdered(CDOCommitInfo commitInfo, InternalCDOTransaction sender) + private void invalidateOrdered(CDOCommitInfo commitInfo, InternalCDOTransaction sender, boolean clearResourcePathCache) { Map<CDOID, InternalCDORevision> oldRevisions = null; boolean success = commitInfo.getBranch() != null; @@ -1140,7 +1149,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme { if (view != sender) { - invalidateView(commitInfo, view, oldRevisions); + invalidateView(commitInfo, view, oldRevisions, clearResourcePathCache); } else { @@ -1150,7 +1159,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme } private void invalidateView(CDOCommitInfo commitInfo, InternalCDOView view, - Map<CDOID, InternalCDORevision> oldRevisions) + Map<CDOID, InternalCDORevision> oldRevisions, boolean clearResourcePathCache) { try { @@ -1158,7 +1167,8 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme long lastUpdateTime = commitInfo.getTimeStamp(); List<CDORevisionKey> allChangedObjects = commitInfo.getChangedObjects(); List<CDOIDAndVersion> allDetachedObjects = commitInfo.getDetachedObjects(); - view.invalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions, true); + view.invalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions, true, + clearResourcePathCache); } catch (RuntimeException ex) { @@ -1370,8 +1380,42 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme /** * @author Eike Stepper */ - private static final class OutOfSequenceInvalidations extends - HashMap<Long, Pair<CDOCommitInfo, InternalCDOTransaction>> + private static final class OutOfSequenceInvalidation + { + private CDOCommitInfo commitInfo; + + private InternalCDOTransaction sender; + + private boolean clearResourcePathCache; + + public OutOfSequenceInvalidation(CDOCommitInfo commitInfo, InternalCDOTransaction sender, + boolean clearResourcePathCache) + { + this.commitInfo = commitInfo; + this.sender = sender; + this.clearResourcePathCache = clearResourcePathCache; + } + + public CDOCommitInfo getCommitInfo() + { + return commitInfo; + } + + public InternalCDOTransaction getSender() + { + return sender; + } + + public boolean isClearResourcePathCache() + { + return clearResourcePathCache; + } + } + + /** + * @author Eike Stepper + */ + private static final class OutOfSequenceInvalidations extends HashMap<Long, OutOfSequenceInvalidation> { private static final long serialVersionUID = 1L; } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java index 09bbba6f3e..885a1a31e1 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java @@ -34,13 +34,13 @@ import org.eclipse.emf.spi.cdo.InternalCDOSavepoint; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** @@ -79,7 +79,23 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD private Map<CDOID, CDOObject> dirtyObjects = new HashMap<CDOID, CDOObject>(); - private ConcurrentMap<CDOID, CDORevisionDelta> revisionDeltas = new ConcurrentHashMap<CDOID, CDORevisionDelta>(); + private Map<CDOID, CDORevisionDelta> revisionDeltas = new HashMap<CDOID, CDORevisionDelta>() + { + private static final long serialVersionUID = 1L; + + @Override + public CDORevisionDelta put(CDOID id, CDORevisionDelta delta) + { + transaction.clearResourcePathCacheIfNecessary(delta); + return super.put(id, delta); + } + + @Override + public void putAll(Map<? extends CDOID, ? extends CDORevisionDelta> m) + { + throw new UnsupportedOperationException(); + } + }; private boolean wasDirty; @@ -174,8 +190,107 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD throw new UnsupportedOperationException(); } + @Deprecated public ConcurrentMap<CDOID, CDORevisionDelta> getRevisionDeltas() { + return new ConcurrentMap<CDOID, CDORevisionDelta>() + { + public int size() + { + return revisionDeltas.size(); + } + + public boolean isEmpty() + { + return revisionDeltas.isEmpty(); + } + + public boolean containsKey(Object key) + { + return revisionDeltas.containsKey(key); + } + + public boolean containsValue(Object value) + { + return revisionDeltas.containsValue(value); + } + + public CDORevisionDelta get(Object key) + { + return revisionDeltas.get(key); + } + + public CDORevisionDelta put(CDOID key, CDORevisionDelta value) + { + return revisionDeltas.put(key, value); + } + + public CDORevisionDelta remove(Object key) + { + return revisionDeltas.remove(key); + } + + public void putAll(Map<? extends CDOID, ? extends CDORevisionDelta> m) + { + revisionDeltas.putAll(m); + } + + public void clear() + { + revisionDeltas.clear(); + } + + public Set<CDOID> keySet() + { + return revisionDeltas.keySet(); + } + + public Collection<CDORevisionDelta> values() + { + return revisionDeltas.values(); + } + + public Set<java.util.Map.Entry<CDOID, CDORevisionDelta>> entrySet() + { + return revisionDeltas.entrySet(); + } + + @Override + public boolean equals(Object o) + { + return revisionDeltas.equals(o); + } + + @Override + public int hashCode() + { + return revisionDeltas.hashCode(); + } + + public CDORevisionDelta putIfAbsent(CDOID key, CDORevisionDelta value) + { + return null; + } + + public boolean remove(Object key, Object value) + { + return false; + } + + public boolean replace(CDOID key, CDORevisionDelta oldValue, CDORevisionDelta newValue) + { + return false; + } + + public CDORevisionDelta replace(CDOID key, CDORevisionDelta value) + { + return null; + } + }; + } + + public Map<CDOID, CDORevisionDelta> getRevisionDeltas2() + { return revisionDeltas; } @@ -304,7 +419,7 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD { if (getPreviousSavepoint() == null) { - return Collections.unmodifiableMap(getRevisionDeltas()); + return Collections.unmodifiableMap(getRevisionDeltas2()); } // We need to combined the result for all delta in different Savepoint @@ -312,7 +427,7 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD for (InternalCDOSavepoint savepoint = getFirstSavePoint(); savepoint != null; savepoint = savepoint .getNextSavepoint()) { - for (CDORevisionDelta revisionDelta : savepoint.getRevisionDeltas().values()) + for (CDORevisionDelta revisionDelta : savepoint.getRevisionDeltas2().values()) { CDOID id = revisionDelta.getID(); if (!isNewObject(id)) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java index ee6952f562..291729902e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java @@ -176,7 +176,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; /** @@ -545,7 +544,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa ancestorProvider, targetProvider, keepVersions, result.getChangeSetData().getChangedObjects()); // Delta notifications - Collection<CDORevisionDelta> notificationDeltas = lastSavepoint.getRevisionDeltas().values(); + Collection<CDORevisionDelta> notificationDeltas = lastSavepoint.getRevisionDeltas2().values(); if (!notificationDeltas.isEmpty() || !detachedSet.isEmpty()) { sendDeltaNotifications(notificationDeltas, detachedSet, oldRevisions); @@ -645,7 +644,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa Map<CDOID, InternalCDORevision> oldRevisions = new HashMap<CDOID, InternalCDORevision>(); Map<CDOID, CDOObject> dirtyObjects = lastSavepoint.getDirtyObjects(); - ConcurrentMap<CDOID, CDORevisionDelta> revisionDeltas = lastSavepoint.getRevisionDeltas(); + Map<CDOID, CDORevisionDelta> revisionDeltas = lastSavepoint.getRevisionDeltas2(); for (CDORevisionKey key : changedObjects) { @@ -1320,7 +1319,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa } } - Map<CDOID, CDORevisionDelta> revisionDeltas = itrSavepoint.getRevisionDeltas(); + Map<CDOID, CDORevisionDelta> revisionDeltas = itrSavepoint.getRevisionDeltas2(); if (!revisionDeltas.isEmpty()) { for (CDORevisionDelta dirtyObject : revisionDeltas.values()) @@ -1437,7 +1436,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa for (InternalCDOSavepoint itrSavepoint = firstSavepoint; itrSavepoint != savepoint; itrSavepoint = itrSavepoint .getNextSavepoint()) { - for (CDORevisionDelta delta : itrSavepoint.getRevisionDeltas().values()) + for (CDORevisionDelta delta : itrSavepoint.getRevisionDeltas2().values()) { CDOID id = delta.getID(); boolean isNew = isObjectNew(id); @@ -1741,11 +1740,11 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa if (needToSaveFeatureDelta) { - CDORevisionDelta revisionDelta = lastSavepoint.getRevisionDeltas().get(id); + CDORevisionDelta revisionDelta = lastSavepoint.getRevisionDeltas2().get(id); if (revisionDelta == null) { revisionDelta = CDORevisionUtil.createDelta(object.cdoRevision()); - lastSavepoint.getRevisionDeltas().put(id, revisionDelta); + lastSavepoint.getRevisionDeltas2().put(id, revisionDelta); } ((InternalCDORevisionDelta)revisionDelta).addFeatureDelta(featureDelta); @@ -1761,7 +1760,12 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa public synchronized void registerRevisionDelta(CDORevisionDelta revisionDelta) { - lastSavepoint.getRevisionDeltas().putIfAbsent(revisionDelta.getID(), revisionDelta); + Map<CDOID, CDORevisionDelta> revisionDeltas = lastSavepoint.getRevisionDeltas2(); + CDOID id = revisionDelta.getID(); + if (!revisionDeltas.containsKey(id)) + { + revisionDeltas.put(id, revisionDelta); + } } public synchronized void registerDirty(InternalCDOObject object, CDOFeatureDelta featureDelta) @@ -1909,7 +1913,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa copyUncommitted(lastSavepoint.getAllNewObjects(), commitContext.getNewObjects(), newSavepoint.getNewObjects()); copyUncommitted(lastSavepoint.getAllDirtyObjects(), commitContext.getDirtyObjects(), newSavepoint.getDirtyObjects()); copyUncommitted(lastSavepoint.getAllRevisionDeltas(), commitContext.getRevisionDeltas(), - newSavepoint.getRevisionDeltas()); + newSavepoint.getRevisionDeltas2()); copyUncommitted(lastSavepoint.getAllDetachedObjects(), commitContext.getDetachedObjects(), newSavepoint.getDetachedObjects()); lastSavepoint = newSavepoint; @@ -1963,7 +1967,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa while (savepoint != null) { Collection<CDOObject> newObjects = savepoint.getNewObjects().values(); - Collection<CDORevisionDelta> revisionDeltas = savepoint.getRevisionDeltas().values(); + Collection<CDORevisionDelta> revisionDeltas = savepoint.getRevisionDeltas2().values(); if (newObjects.isEmpty() && revisionDeltas.isEmpty()) { savepoint = savepoint.getNextSavepoint(); @@ -2897,7 +2901,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa if (result.getRollbackMessage() != null) { CDOCommitInfo commitInfo = new FailureCommitInfo(timeStamp, result.getPreviousTimeStamp()); - session.invalidate(commitInfo, transaction); + session.invalidate(commitInfo, transaction, result.isClearResourcePathCache()); return; } @@ -2927,7 +2931,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa } CDOCommitInfo commitInfo = makeCommitInfo(timeStamp, result.getPreviousTimeStamp()); - session.invalidate(commitInfo, transaction); + session.invalidate(commitInfo, transaction, result.isClearResourcePathCache()); // Bug 290032 - Sticky views if (session.isSticky()) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java index 72a548df02..d2e9db50c6 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java @@ -27,6 +27,8 @@ import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; import org.eclipse.emf.cdo.common.revision.CDORevision; import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta; import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; import org.eclipse.emf.cdo.common.util.CDOCommonUtil; import org.eclipse.emf.cdo.common.util.CDOException; @@ -129,6 +131,9 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi }; @ExcludeFromDump + private transient Map<String, CDOID> resourcePathCache = new HashMap<String, CDOID>(); + + @ExcludeFromDump private transient CDOID lastLookupID; @ExcludeFromDump @@ -321,7 +326,6 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi CDOID id = getResourceNodeID(path); if (id != null) // Should always be true { - InternalCDOObject object = getObject(id); if (object instanceof CDOResourceNode) { @@ -332,6 +336,59 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi throw new CDOException("Resource node not found: " + path); } + private CDOID getCachedResourceNodeID(String path) + { + if (resourcePathCache != null) + { + return resourcePathCache.get(path); + } + + return null; + } + + private void setCachedResourceNodeID(String path, CDOID id) + { + if (resourcePathCache != null) + { + if (id == null) + { + resourcePathCache.remove(path); + } + else + { + resourcePathCache.put(path, id); + } + } + } + + public synchronized void setResourcePathCache(Map<String, CDOID> resourcePathCache) + { + this.resourcePathCache = resourcePathCache; + } + + /** + * If <code>delta == null</code> the cache is cleared unconditionally. + * If <code>delta != null</code> the cache is cleared only if the delta can have an impact on the resource tree structure. + */ + public synchronized void clearResourcePathCacheIfNecessary(CDORevisionDelta delta) + { + if (resourcePathCache != null && !resourcePathCache.isEmpty()) + { + if (delta == null) + { + resourcePathCache.clear(); + } + else + { + CDOID rootResourceID = getSession().getRepositoryInfo().getRootResourceID(); + if (canHaveResourcePathImpact(delta, rootResourceID)) + { + resourcePathCache.clear(); + } + } + } + } + /** * @return never <code>null</code> */ @@ -342,21 +399,38 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi throw new IllegalArgumentException(Messages.getString("CDOViewImpl.1")); //$NON-NLS-1$ } - CDOID folderID = null; - if (CDOURIUtil.SEGMENT_SEPARATOR.equals(path)) - { - folderID = getResourceNodeIDChecked(null, null); - } - else + CDOID id = getCachedResourceNodeID(path); + if (id == null) { - List<String> names = CDOURIUtil.analyzePath(path); - for (String name : names) + if (CDOURIUtil.SEGMENT_SEPARATOR.equals(path)) { - folderID = getResourceNodeIDChecked(folderID, name); + id = getResourceNodeIDChecked(null, null); + setCachedResourceNodeID(path, id); + } + else + { + List<String> names = CDOURIUtil.analyzePath(path); + path = ""; + + for (String name : names) + { + path = path.length() == 0 ? name : path + "/" + name; + + CDOID cached = getCachedResourceNodeID(path); + if (cached != null) + { + id = cached; + } + else + { + id = getResourceNodeIDChecked(id, name); + setCachedResourceNodeID(path, id); + } + } } } - return folderID; + return id; } /** @@ -364,13 +438,13 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi */ private CDOID getResourceNodeIDChecked(CDOID folderID, String name) { - folderID = getResourceNodeID(folderID, name); - if (folderID == null) + CDOID id = getResourceNodeID(folderID, name); + if (id == null) { throw new CDOException(MessageFormat.format(Messages.getString("CDOViewImpl.2"), name)); //$NON-NLS-1$ } - return folderID; + return id; } /** @@ -432,16 +506,21 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi protected synchronized CDOID getRootOrTopLevelResourceNodeID(String name) { + if (name == null) + { + if (rootResource != null) + { + return rootResource.cdoID(); + } + + return getSession().getRepositoryInfo().getRootResourceID(); + } + CDOQuery resourceQuery = createResourcesQuery(null, name, true); resourceQuery.setMaxResults(1); List<CDOID> ids = resourceQuery.getResult(CDOID.class); if (ids.isEmpty()) { - if (name == null) - { - throw new CDOException(Messages.getString("CDOViewImpl.6")); //$NON-NLS-1$ - } - throw new CDOException(MessageFormat.format(Messages.getString("CDOViewImpl.7"), name)); //$NON-NLS-1$ } @@ -495,7 +574,7 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi return getResource(path, true); } - public synchronized CDOResource getResource(String path, boolean loadInDemand) + public synchronized CDOResource getResource(String path, boolean loadOnDemand) { checkActive(); URI uri = CDOURIUtil.createResourceURI(this, path); @@ -504,7 +583,7 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi try { - return (CDOResource)resourceSet.getResource(uri, loadInDemand); + return (CDOResource)resourceSet.getResource(uri, loadOnDemand); } catch (RuntimeException ex) { @@ -533,6 +612,11 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi return (CDOBinaryResource)getResourceNode(path); } + public CDOResourceFolder getResourceFolder(String path) + { + return (CDOResourceFolder)getResourceNode(path); + } + /** * Ensures that the URIs of all resources in this resourceSet, can be fetched without triggering the loading of * additional resources. Without calling this first, it is dangerous to iterate over the resources to collect their @@ -1203,10 +1287,8 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi } } - private Map<String, CDOID> resourcePathCache = new HashMap<String, CDOID>(); - /* - * Synchronized through InvlidationRunner.run() + * Synchronized through InvalidationRunner.run() */ protected Map<CDOObject, Pair<CDORevision, CDORevisionDelta>> invalidate(long lastUpdateTime, List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, List<CDORevisionDelta> deltas, @@ -1229,15 +1311,6 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi } deltas.add(delta); - - if (resourcePathCache != null && EresourcePackage.Literals.CDO_RESOURCE_NODE.isSuperTypeOf(delta.getEClass())) - { - if (delta.getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE_NODE__FOLDER) != null - || delta.getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME) != null) - { - resourcePathCache.clear(); - } - } } CDOObject changedObject = objects.get(key.getID()); @@ -1472,11 +1545,70 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi viewSet = null; objects = null; store = null; + resourcePathCache = null; lastLookupID = null; lastLookupObject = null; super.doDeactivate(); } + public static boolean canHaveResourcePathImpact(CDORevisionDelta delta, CDOID rootResourceID) + { + EClass eClass = delta.getEClass(); + if (EresourcePackage.Literals.CDO_RESOURCE_NODE.isSuperTypeOf(eClass)) + { + if (delta.getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME) != null) + { + return true; + } + } + + if (eClass == EresourcePackage.Literals.CDO_RESOURCE_FOLDER) + { + CDOListFeatureDelta featureDelta = (CDOListFeatureDelta)delta + .getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE_FOLDER__NODES); + if (canHaveResourcePathImpact(featureDelta)) + { + return true; + } + } + + if (eClass == EresourcePackage.Literals.CDO_RESOURCE) + { + if (rootResourceID.equals(delta.getID())) + { + CDOListFeatureDelta featureDelta = (CDOListFeatureDelta)delta + .getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE__CONTENTS); + if (canHaveResourcePathImpact(featureDelta)) + { + return true; + } + } + } + + return false; + } + + private static boolean canHaveResourcePathImpact(CDOListFeatureDelta featureDelta) + { + if (featureDelta != null) + { + for (CDOFeatureDelta listChange : featureDelta.getListChanges()) + { + CDOFeatureDelta.Type type = listChange.getType(); + switch (type) + { + case REMOVE: + case CLEAR: + case SET: + case UNSET: + return true; + } + } + } + + return false; + } + /** * @author Eike Stepper */ diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java index b9f6f5c690..5356840243 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java @@ -67,7 +67,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.ConcurrentMap; /** * @author Eike Stepper @@ -677,7 +676,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent InternalCDOSavepoint savepoint = transaction.getFirstSavepoint(); while (savepoint.getNextSavepoint() != null) { - CDORevisionDelta delta = savepoint.getRevisionDeltas().get(id); + CDORevisionDelta delta = savepoint.getRevisionDeltas2().get(id); if (delta != null) { delta.apply(cleanRevision); @@ -725,7 +724,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent private void processRevisionDeltas(InternalEObject reattachedObject, InternalCDOTransaction transaction) { InternalCDOSavepoint lastSavepoint = transaction.getLastSavepoint(); - ConcurrentMap<CDOID, CDORevisionDelta> revisionDeltas = lastSavepoint.getRevisionDeltas(); + Map<CDOID, CDORevisionDelta> revisionDeltas = lastSavepoint.getRevisionDeltas2(); for (Iterator<Entry<CDOID, CDORevisionDelta>> it = revisionDeltas.entrySet().iterator(); it.hasNext();) { Entry<CDOID, CDORevisionDelta> entry = it.next(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java index 93804818d4..24cf754c16 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java @@ -238,7 +238,7 @@ public class CDOViewImpl extends AbstractCDOView basicSetBranchPoint(branchPoint); doInvalidate(branchPoint.getBranch(), CDOBranchPoint.UNSPECIFIED_DATE, allChangedObjects, allDetachedObjects, - oldRevisions); + oldRevisions, true); IListener[] listeners = getListeners(); if (listeners != null) @@ -785,30 +785,46 @@ public class CDOViewImpl extends AbstractCDOView /* * Must not by synchronized on the view! */ + @Deprecated public/* synchronized */void invalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, boolean async) { + invalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions, async, true); + } + + /* + * Must not by synchronized on the view! + */ + public/* synchronized */void invalidate(CDOBranch branch, long lastUpdateTime, + List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, + Map<CDOID, InternalCDORevision> oldRevisions, boolean async, boolean clearResourcePathCache) + { if (async) { QueueRunner runner = getInvalidationRunner(); runner.addWork(new InvalidationRunnable(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, - oldRevisions)); + oldRevisions, clearResourcePathCache)); } else { - doInvalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions); + doInvalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions, clearResourcePathCache); } } protected synchronized void doInvalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, - Map<CDOID, InternalCDORevision> oldRevisions) + Map<CDOID, InternalCDORevision> oldRevisions, boolean clearResourcePathCache) { try { if (ObjectUtil.equals(branch, getBranch())) { + if (clearResourcePathCache) + { + clearResourcePathCacheIfNecessary(null); + } + Map<CDOObject, Pair<CDORevision, CDORevisionDelta>> conflicts = null; List<CDORevisionDelta> deltas = new ArrayList<CDORevisionDelta>(); Map<CDOObject, CDORevisionDelta> revisionDeltas = new HashMap<CDOObject, CDORevisionDelta>(); @@ -1536,14 +1552,18 @@ public class CDOViewImpl extends AbstractCDOView private final Map<CDOID, InternalCDORevision> oldRevisions; + private boolean clearResourcePathCache; + private InvalidationRunnable(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, - List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions) + List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, + boolean clearResourcePathCache) { this.branch = branch; this.lastUpdateTime = lastUpdateTime; this.allChangedObjects = allChangedObjects; this.allDetachedObjects = allDetachedObjects; this.oldRevisions = oldRevisions; + this.clearResourcePathCache = clearResourcePathCache; } public void run() @@ -1551,7 +1571,8 @@ public class CDOViewImpl extends AbstractCDOView try { invalidationRunnerActive = true; - doInvalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions); + doInvalidate(branch, lastUpdateTime, allChangedObjects, allDetachedObjects, oldRevisions, + clearResourcePathCache); } finally { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java index ea99125147..27964731b0 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java @@ -74,7 +74,7 @@ public class CDOMergingConflictResolver extends AbstractChangeSetsConflictResolv InternalCDOTransaction transaction = (InternalCDOTransaction)getTransaction(); InternalCDORevisionManager revisionManager = transaction.getSession().getRevisionManager(); - Map<CDOID, CDORevisionDelta> localDeltas = transaction.getLastSavepoint().getRevisionDeltas(); + Map<CDOID, CDORevisionDelta> localDeltas = transaction.getLastSavepoint().getRevisionDeltas2(); for (CDORevisionKey key : result.getChangedObjects()) { 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 3d03664b2f..28cd187827 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 @@ -691,17 +691,31 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo private CDOLockState[] newLockStates; + private boolean clearResourcePathCache; + /** * @since 4.0 + * @deprecated As of 4.2 */ + @Deprecated public CommitTransactionResult(CDOIDProvider idProvider, String rollbackMessage, CDOBranchPoint branchPoint, long previousTimeStamp, List<CDOObjectReference> xRefs) { + this(idProvider, rollbackMessage, branchPoint, previousTimeStamp, xRefs, true); + } + + /** + * @since 4.2 + */ + public CommitTransactionResult(CDOIDProvider idProvider, String rollbackMessage, CDOBranchPoint branchPoint, + long previousTimeStamp, List<CDOObjectReference> xRefs, boolean clearResourcePathCache) + { this.idProvider = idProvider; this.rollbackMessage = rollbackMessage; this.branchPoint = branchPoint; this.previousTimeStamp = previousTimeStamp; this.xRefs = xRefs; + this.clearResourcePathCache = clearResourcePathCache; } /** @@ -769,6 +783,14 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo return xRefs; } + /** + * @since 4.2 + */ + public boolean isClearResourcePathCache() + { + return clearResourcePathCache; + } + public Map<CDOID, CDOID> getIDMappings() { return idMappings; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java index f747b6e8f7..8894ccb72f 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java @@ -179,20 +179,34 @@ public interface InternalCDOSession extends CDOSession, PackageProcessor, Packag /** * @since 3.0 + * @deprecated As of 4.2 use {@link #handleCommitNotification(CDOCommitInfo, boolean)} */ + @Deprecated public void handleCommitNotification(CDOCommitInfo commitInfo); /** + * @since 4.2 + */ + public void handleCommitNotification(CDOCommitInfo commitInfo, boolean clearResourcePathCache); + + /** * @since 4.1 */ public void handleLockNotification(CDOLockChangeInfo lockChangeInfo, InternalCDOView sender); /** * @since 3.0 + * @deprecated As of 4.2 use {@link #invalidate(CDOCommitInfo, InternalCDOTransaction, boolean)} */ + @Deprecated public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender); /** + * @since 4.2 + */ + public void invalidate(CDOCommitInfo commitInfo, InternalCDOTransaction sender, boolean clearResourcePathCache); + + /** * @since 3.0 */ public void processRefreshSessionResult(RefreshSessionResult result, CDOBranch branch, diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java index 86a16fd0dd..479f1d4597 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java @@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo; import org.eclipse.emf.cdo.common.lock.CDOLockState; import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.emf.cdo.view.CDOFeatureAnalyzer; @@ -82,12 +83,20 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle public void handleObjectStateChanged(InternalCDOObject object, CDOState oldState, CDOState newState); /** - * @since 4.0 + * @deprecated As of 4.2. use {@link #invalidate(CDOBranch, long, List, List, Map, boolean, boolean)} */ + @Deprecated public void invalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, boolean async); /** + * @since 4.2 + */ + public void invalidate(CDOBranch branch, long lastUpdateTime, List<CDORevisionKey> allChangedObjects, + List<CDOIDAndVersion> allDetachedObjects, Map<CDOID, InternalCDORevision> oldRevisions, boolean async, + boolean clearResourcePathCache); + + /** * @since 3.0 */ public void setLastUpdateTime(long lastUpdateTime); @@ -99,6 +108,11 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle public void remapObject(CDOID oldID); + /** + * @since 4.2 + */ + public void clearResourcePathCacheIfNecessary(CDORevisionDelta delta); + public CDOID getResourceNodeID(String path); public void registerProxyResource(CDOResourceImpl resource); |