summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-09-09 04:12:40 (EDT)
committerEike Stepper2006-09-09 04:12:40 (EDT)
commit5882dd47caf8a6cbd4d3486cff1f280caed67cb4 (patch)
tree51a1a04cc0d5e9af63dd26891a3356cdda7c7582
parentdfba63609c3b851a0e27e9607e5d686a21834466 (diff)
downloadcdo-5882dd47caf8a6cbd4d3486cff1f280caed67cb4.zip
cdo-5882dd47caf8a6cbd4d3486cff1f280caed67cb4.tar.gz
cdo-5882dd47caf8a6cbd4d3486cff1f280caed67cb4.tar.bz2
[156421] Deleted resources are not removed from CDOEditor https://bugs.eclipse.org/bugs/show_bug.cgi?id=156421
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java19
7 files changed, 134 insertions, 32 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
index b478c3f..fcf6a84 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
@@ -28,5 +28,7 @@ public interface ServerCDOProtocol extends CDOProtocol
public ServerCDOResProtocol getServerCDOResProtocol();
+ public void fireRemovalNotification(Collection<Integer> rids);
+
public void fireInvalidationNotification(Channel initiator, Collection<Long> changedObjectIds);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
index c4e27f9..91847ea 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
@@ -13,13 +13,13 @@ package org.eclipse.emf.cdo.server;
import org.eclipse.emf.cdo.core.CDOResProtocol;
import org.eclipse.emf.cdo.core.OID;
+import org.eclipse.emf.cdo.core.RID;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.Collection;
import java.util.List;
-import java.util.Set;
public interface ServerCDOResProtocol extends CDOResProtocol
@@ -32,38 +32,53 @@ public interface ServerCDOResProtocol extends CDOResProtocol
public void fireInvalidationNotification(Collection<Long> modifiedOIDs);
+ public void fireRemovalNotification(Collection<Integer> rids);
+
/**
- * Adds a {@link InvalidationListener} to the list of listeners to be notified about
- * invalidated obejcts in the scope of this {@link ServerCDOResProtocol}.<p>
+ * Adds a {@link Listener} to the list of listeners to be notified about
+ * removed resources and invalidated obejcts in the scope of this
+ * {@link ServerCDOResProtocol}.<p>
*
- * @param listener The {@link InvalidationListener} to be added.<p>
+ * @param listener The {@link Listener} to be added.<p>
*/
- public void addInvalidationListener(InvalidationListener listener);
+ public void addListener(Listener listener);
/**
- * Removes a {@link InvalidationListener} from the list of listeners to be notified about
- * invalidated obejcts in the scope of this {@link ServerCDOResProtocol}.<p>
+ * Removes a {@link Listener} from the list of listeners to be notified about
+ * removed resources and invalidated obejcts in the scope of this
+ * {@link ServerCDOResProtocol}.<p>
*
- * @param listener The {@link InvalidationListener} to be removed.<p>
+ * @param listener The {@link Listener} to be removed.<p>
*/
- public void removeInvalidationListener(InvalidationListener listener);
+ public void removeListener(Listener listener);
/**
- * Can be registered with a {@link ServerCDOResProtocol} to be subsequently notified about
- * invalidated objects.<p>
+ * Can be registered with a {@link ServerCDOResProtocol} to be subsequently
+ * notified about removed resources and invalidated objects.<p>
*
* @author Eike Stepper
*/
- public interface InvalidationListener
+ public interface Listener
{
/**
- * Called by the {@link ServerCDOResProtocol} this {@link InvalidationListener} is
+ * Called by the {@link ServerCDOResProtocol} this {@link Listener} is
+ * registered with to notify about removed resources.<p>
+ *
+ * @param protocol The {@link ServerCDOResProtocol} this {@link Listener} is
+ * registered with.<p>
+ * @param rids A {@link Collection} of {@link RID}s which have been removed.<p>
+ */
+ public void notifyRemoval(ServerCDOResProtocol protocol, Collection<Integer> rids);
+
+ /**
+ * Called by the {@link ServerCDOResProtocol} this {@link Listener} is
* registered with to notify about invalidated objects.<p>
*
- * @param protocol The {@link ServerCDOResProtocol} this {@link InvalidationListener} is
- * registered with.<p>
- * @param modifiedOIDs A {@link Set} of {@link OID}s which have been invalidated.<p>
+ * @param protocol The {@link ServerCDOResProtocol} this {@link Listener} is
+ * registered with.<p>
+ * @param modifiedOIDs A {@link Collection} of {@link OID}s which have been
+ * invalidated.<p>
*/
public void notifyInvalidation(ServerCDOResProtocol protocol, Collection<Long> modifiedOIDs);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
index c6985ce..feb2ff0 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
@@ -67,7 +67,8 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
{
ok = true;
transmitInvalidations(modifiedOIDs);
- transmitRescourceChanges(rids);
+ transmitResourceChanges(rids);
+ transmitRemovals(rids);
}
else
{
@@ -124,7 +125,17 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
}
}
- private void transmitRescourceChanges(Collection<Integer> rids)
+ private void transmitRemovals(Collection<Integer> rids)
+ {
+ if (!rids.isEmpty())
+ {
+ Channel me = getChannel();
+ ServerCDOResProtocol cdores = (ServerCDOResProtocol) me.getProtocol();
+ cdores.fireRemovalNotification(rids);
+ }
+ }
+
+ private void transmitResourceChanges(Collection<Integer> rids)
{
if (!rids.isEmpty())
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java
index d2a1e9d..d12b040 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidateObjectRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java
@@ -20,18 +20,18 @@ import java.util.Iterator;
import java.util.List;
-public class InvalidateObjectRequest extends AbstractRequest
+public class InvalidationNotificationRequest extends AbstractRequest
{
private Collection<Long> changedObjectIds;
- public InvalidateObjectRequest(Collection<Long> changedObjectIds)
+ public InvalidationNotificationRequest(Collection<Long> changedObjectIds)
{
this.changedObjectIds = changedObjectIds;
}
public short getSignalId()
{
- return CDOProtocol.INVALIDATE_OBJECT;
+ return CDOProtocol.INVALIDATION_NOTIFICATION;
}
public void request()
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java
new file mode 100644
index 0000000..d328650
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractRequest;
+
+import org.eclipse.emf.cdo.core.CDOProtocol;
+
+import java.util.Collection;
+
+
+public class RemovalNotificationRequest extends AbstractRequest
+{
+ private Collection<Integer> rids;
+
+ public RemovalNotificationRequest(Collection<Integer> rids)
+ {
+ this.rids = rids;
+ }
+
+ public short getSignalId()
+ {
+ return CDOProtocol.REMOVAL_NOTIFICATION;
+ }
+
+ public void request()
+ {
+ transmitInt(rids.size());
+ for (Integer rid : rids)
+ {
+ transmitInt(rid);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
index 40fef72..4fc631f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
@@ -21,7 +21,7 @@ import org.eclipse.emf.cdo.core.protocol.AbstractCDOProtocol;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ServerCDOProtocol;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
-import org.eclipse.emf.cdo.server.ServerCDOResProtocol.InvalidationListener;
+import org.eclipse.emf.cdo.server.ServerCDOResProtocol.Listener;
import org.springframework.transaction.support.TransactionTemplate;
@@ -29,7 +29,7 @@ import java.util.Collection;
public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements ServerCDOProtocol,
- InvalidationListener
+ Listener
{
protected Mapper mapper;
@@ -113,11 +113,32 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
doSet("serverCDOResProtocol", serverCDOResProtocol);
}
+ public void notifyRemoval(ServerCDOResProtocol protocol, Collection<Integer> rids)
+ {
+ fireRemovalNotification(rids);
+ }
+
public void notifyInvalidation(ServerCDOResProtocol protocol, Collection<Long> modifiedOIDs)
{
fireInvalidationNotification(null, modifiedOIDs);
}
+ public void fireRemovalNotification(Collection<Integer> rids)
+ {
+ for (Channel channel : getChannels())
+ {
+ try
+ {
+ RemovalNotificationRequest signal = new RemovalNotificationRequest(rids);
+ channel.transmit(signal);
+ }
+ catch (Exception ex)
+ {
+ error("Error while transmitting removal notifications for rids " + rids, ex);
+ }
+ }
+ }
+
public void fireInvalidationNotification(Channel initiator, Collection<Long> changedObjectIds)
{
for (Channel channel : getChannels())
@@ -127,12 +148,13 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
{
try
{
- InvalidateObjectRequest signal = new InvalidateObjectRequest(changedObjectIds);
+ InvalidationNotificationRequest signal = new InvalidationNotificationRequest(
+ changedObjectIds);
channel.transmit(signal);
}
catch (Exception ex)
{
- error("Error while transmitting invalidation notifications " + changedObjectIds, ex);
+ error("Error while transmitting invalidation notifications for oids " + changedObjectIds, ex);
}
}
}
@@ -152,7 +174,7 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
super.activate();
if (serverCDOResProtocol != null)
{
- serverCDOResProtocol.addInvalidationListener(this);
+ serverCDOResProtocol.addListener(this);
}
}
@@ -161,7 +183,7 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
{
if (serverCDOResProtocol != null)
{
- serverCDOResProtocol.removeInvalidationListener(this);
+ serverCDOResProtocol.removeListener(this);
}
super.deactivate();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
index 11a7a6c..8634f46 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
@@ -35,7 +35,7 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
protected TransactionTemplate transactionTemplate;
- protected transient List<InvalidationListener> listeners = new ArrayList<InvalidationListener>();
+ protected transient List<Listener> listeners = new ArrayList<Listener>();
public ServerCDOResProtocolImpl()
{
@@ -99,19 +99,28 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
public void fireInvalidationNotification(Collection<Long> modifiedOIDs)
{
- InvalidationListener[] array = listeners.toArray(new InvalidationListener[listeners.size()]);
- for (InvalidationListener listener : array)
+ Listener[] array = listeners.toArray(new Listener[listeners.size()]);
+ for (Listener listener : array)
{
listener.notifyInvalidation(this, modifiedOIDs);
}
}
- public void addInvalidationListener(InvalidationListener listener)
+ public void fireRemovalNotification(Collection<Integer> rids)
+ {
+ Listener[] array = listeners.toArray(new Listener[listeners.size()]);
+ for (Listener listener : array)
+ {
+ listener.notifyRemoval(this, rids);
+ }
+ }
+
+ public void addListener(Listener listener)
{
listeners.add(listener);
}
- public void removeInvalidationListener(InvalidationListener listener)
+ public void removeListener(Listener listener)
{
listeners.remove(listener);
}