//package org.jboss.cache.search;
//
//import org.hibernate.search.impl.SearchFactoryImpl;
//import org.jboss.cache.notifications.event.NodeModifiedEvent;
//import org.jboss.cache.pojo.notification.annotation.*;
//import org.jboss.cache.pojo.notification.event.AttachedEvent;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//
//import javax.transaction.Transaction;
//
///**
// * @author Navin Surtani  - navin@surtani.org
// */
//
//@PojoCacheListener
//public class SearchablePojoListener extends
//{
//   private SearchFactoryImpl searchFactory;
//   private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
//
//   public SearchablePojoListener(SearchFactoryImpl searchFactory)
//   {
//      this.searchFactory = searchFactory;
//   }
//
//   /**
//    * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
//    *
//    * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
//    * @throws InvalidKeyException if an invalid key is given.
//    */
//
//   @Attached
//   public void handleAttach(AttachedEvent event)
//   {
//      Object added = event.getSource();
//
//
//
//   }
//
//
//   @Detached
//   @FieldModified
//   @ListModified
//   @ArrayModified
//   @SetModified
//   @MapModified
//   public void updateLuceneIndexes(NodeModifiedEvent event) throws InvalidKeyException
//   {
//
//      if (log.isTraceEnabled()) log.trace("You have entered the PojoListener for Searchable Cache");
//      if (!event.isPre())
//      {
//         if (log.isTraceEnabled()) log.trace("event.isPre is false. Going to start updating indexes");
//         switch (event.getModificationType())
//         {
//            case PUT_MAP:
//            case PUT_DATA:
//               if (log.isTraceEnabled()) log.trace("put() has been called on cache. Going to handle the data.");
//               handlePutData(event, searchFactory);
//               break;
//            case REMOVE_DATA:
//               handleDeleteData(event, searchFactory);
//               break;
//         }
//      }
//   }
//
//
//}
