/*
 * Created on 23-Feb-2005
 *
 *
 *
 */
package org.jboss.cache.optimistic;

import org.jboss.cache.AbstractTreeCacheListener;
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
import org.jgroups.View;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author swoodcock
 */
public class TestListener extends AbstractTreeCacheListener
{

    Log log = LogFactory.getLog(getClass());
    private int nodesAdded = 0;

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeCreated(org.jboss.cache.Fqn)
      */
    public synchronized void nodeCreated(Fqn fqn)
    {

        nodesAdded++;
        log.info("DataNode created " + fqn);
    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeRemoved(org.jboss.cache.Fqn)
      */
    public void nodeRemoved(Fqn fqn)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeLoaded(org.jboss.cache.Fqn)
      */
    public void nodeLoaded(Fqn fqn)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeEvicted(org.jboss.cache.Fqn)
      */
    public void nodeEvicted(Fqn fqn)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeModified(org.jboss.cache.Fqn)
      */
    public void nodeModified(Fqn fqn)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#nodeVisited(org.jboss.cache.Fqn)
      */
    public void nodeVisited(Fqn fqn)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#cacheStarted(org.jboss.cache.TreeCache)
      */
    public void cacheStarted(TreeCache cache)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#cacheStopped(org.jboss.cache.TreeCache)
      */
    public void cacheStopped(TreeCache cache)
    {


    }

    /* (non-Javadoc)
      * @see org.jboss.cache.TreeCacheListener#viewChange(org.jgroups.View)
      */
    public void viewChange(View new_view)
    {


    }

    /**
     * @return Returns the nodesAdded.
     */
    public int getNodesAdded()
    {
        return nodesAdded;
    }

    /**
     * @param nodesAdded The nodesAdded to set.
     */
    public void setNodesAdded(int nodesAdded)
    {
        this.nodesAdded = nodesAdded;
    }
}
