[jboss-cvs] JBossCache/src/org/jboss/cache/demo ...
Manik Surtani
manik at jboss.org
Thu Jun 28 12:53:38 EDT 2007
User: msurtani
Date: 07/06/28 12:53:38
Modified: src/org/jboss/cache/demo JBossCacheGUI.java
Log:
Notification changes
Revision Changes Path
1.8 +29 -49 JBossCache/src/org/jboss/cache/demo/JBossCacheGUI.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JBossCacheGUI.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/demo/JBossCacheGUI.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- JBossCacheGUI.java 11 Jun 2007 15:06:02 -0000 1.7
+++ JBossCacheGUI.java 28 Jun 2007 16:53:38 -0000 1.8
@@ -13,13 +13,20 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheImpl;
-import org.jboss.cache.CacheListener;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.lock.TimeoutException;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeEvicted;
+import org.jboss.cache.notifications.annotation.NodeLoaded;
+import org.jboss.cache.notifications.annotation.NodeModified;
+import org.jboss.cache.notifications.annotation.NodeRemoved;
+import org.jboss.cache.notifications.annotation.ViewChanged;
+import org.jboss.cache.notifications.event.NodeEvent;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jgroups.Address;
-import org.jgroups.View;
import javax.swing.*;
import javax.swing.event.TableModelEvent;
@@ -60,7 +67,8 @@
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
*/
-public class JBossCacheGUI extends JFrame implements WindowListener, CacheListener, TreeSelectionListener, TableModelListener
+ at CacheListener
+public class JBossCacheGUI extends JFrame implements WindowListener, TreeSelectionListener, TableModelListener
{
private static final long serialVersionUID = -1242167331988194987L;
@@ -431,16 +439,18 @@
/* ------------------ CacheListener interface ------------ */
- public void nodeCreated(final Fqn fqn, final boolean pre, boolean isLocal)
+ @NodeCreated
+ @NodeLoaded
+ public void nodeCreated(NodeEvent e)
{
/* Updating the GUI upon node creation should be done sequentially to avoid concurrency issues when
adding multiple nodes at the same time, for example for PojoCache, where attaching a pojo creates several nodes.
Creating several visual nodes in paralell and trying to scroll to them is not a thread safe operation */
- if (pre)
+ if (e.isPre())
{
JBossCacheGUI.DisplayNode n;
- n = myNodeRoot.add(fqn);
+ n = myNodeRoot.add(e.getFqn());
if (n != null)
{
tree_model.setRoot(myNodeRoot);
@@ -450,16 +460,17 @@
}
}
- public void nodeModified(final Fqn fqn, final boolean pre, final boolean isLocal, ModificationType modType, final Map data)
+ @NodeModified
+ public void nodeModified(final NodeModifiedEvent e)
{
Runnable r = new Runnable()
{
public void run()
{
- if (pre && selected_node != null && selected_node.getFqn().equals(fqn))//&& !isLocal)
+ if (e.isPre() && selected_node != null && selected_node.getFqn().equals(e.getFqn()))//&& !isLocal)
{
clearTable();
- Node n = root.getChild(fqn);
+ Node n = root.getChild(e.getFqn());
if (n != null)
{
populateTable(n.getData());
@@ -470,7 +481,9 @@
executor.execute(r);
}
- public void nodeRemoved(final Fqn fqn, final boolean pre, boolean isLocal, Map data)
+ @NodeRemoved
+ @NodeEvicted
+ public void nodeRemoved(final NodeEvent e)
{
if (log.isTraceEnabled())
{
@@ -481,11 +494,11 @@
{
public void run()
{
- if (pre)
+ if (e.isPre())
{
JBossCacheGUI.DisplayNode n;
- n = myNodeRoot.findNode(fqn);
+ n = myNodeRoot.findNode(e.getFqn());
if (n != null)
{
n.removeAllChildren();
@@ -499,48 +512,15 @@
executor.execute(r);
}
- public void nodeVisited(Fqn fqn, boolean pre)
- {
- }
-
- public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
- {
- nodeRemoved(fqn, pre, isLocal, null);
- }
-
- public void nodeLoaded(Fqn fqn, boolean pre, Map data)
- {
- nodeCreated(fqn, pre, true);
- }
-
- public void nodeMoved(Fqn from, Fqn to, boolean pre, boolean isLocal)
- {
- }
-
- public void nodeActivated(Fqn fqn, boolean pre, Map data)
- {
- }
-
- public void nodePassivated(Fqn fqn, boolean pre, Map data)
- {
- }
-
- public void cacheStarted(CacheSPI cache)
- {
- }
-
- public void cacheStopped(CacheSPI cache)
- {
- }
-
- public void viewChange(final View new_view)
+ @ViewChanged
+ public void viewChange(final ViewChangedEvent e)
{
Runnable r = new Runnable()
{
public void run()
{
List<Address> mbrship;
- if (new_view != null && (mbrship = new_view.getMembers()) != null)
+ if (e.getNewView() != null && (mbrship = e.getNewView().getMembers()) != null)
{
membership.clear();
membership.addAll(mbrship);
More information about the jboss-cvs-commits
mailing list