[jbosscache-commits] JBoss Cache SVN: r7350 - in searchable/trunk/src: test/java/org/jboss/cache/search/blackbox and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sun Jan 4 11:28:01 EST 2009


Author: navssurtani
Date: 2009-01-04 11:28:01 -0500 (Sun, 04 Jan 2009)
New Revision: 7350

Modified:
   searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
   searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
   searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Commented out Pojo stuff again ...

Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java	2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java	2009-01-04 16:28:01 UTC (rev 7350)
@@ -142,9 +142,9 @@
       SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
 
       //Now create the pojoListener
-      SearchablePojoListener pojoListener = new SearchablePojoListener(searchFactory);
-      pojo.addListener(pojoListener);
-      pojo.getCache().addCacheListener(pojoListener);
+//      SearchablePojoListener pojoListener = new SearchablePojoListener(searchFactory);
+//      pojo.addListener(pojoListener);
+//      pojo.getCache().addCacheListener(pojoListener);
 
       //TODO: - This could be a break point. But it should not be.
       SearchableCache sc = new SearchableCacheImpl(coreCache, searchFactory);

Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java	2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java	2009-01-04 16:28:01 UTC (rev 7350)
@@ -1,156 +1,156 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.cache.search;
-
-import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.backend.TransactionContext;
-import org.hibernate.search.backend.Work;
-import org.hibernate.search.backend.WorkType;
-import org.hibernate.search.engine.SearchFactoryImplementor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.notifications.event.NodeCreatedEvent;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.pojo.notification.annotation.*;
-import org.jboss.cache.pojo.notification.event.AttachedEvent;
-import org.jboss.cache.pojo.notification.event.DetachedEvent;
-import org.jboss.cache.pojo.notification.event.Event;
-import org.jboss.cache.pojo.notification.NotificationContext;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.impl.InternalHelper;
-import org.jboss.cache.Fqn;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.Transaction;
-
-/**
- * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
- */
-
- at PojoCacheListener
- at CacheListener
-public class SearchablePojoListener
-{
-   private SearchFactoryImplementor searchFactory;
-   private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
-   private String pojoKey = "pojoKey";
-
-   private ThreadLocal<Fqn> savedFqn = new ThreadLocal<Fqn>();
-
-   public SearchablePojoListener(SearchFactoryImplementor searchFactory)
-   {
-      this.searchFactory = searchFactory;
-   }
-
-   @NodeModified
-   public void handleNodeModified(NodeModifiedEvent nme)
-   {
-      if (!nme.isPre()) return;
-      Fqn f = nme.getFqn();
-      if(log.isDebugEnabled()) log.debug("Node modified called for Fqn " + f);
-      if (InternalHelper.isInternalNode(f))
-      {
-         if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
-      }
-      else
-      {
-         savedFqn.set(f);
-         if(log.isDebugEnabled()) log.debug("Saved Fqn to ThreadLocal.");
-      }
-   }
-
-   @NodeCreated
-   public void handleNodeKreated(NodeCreatedEvent nce)
-   {
-      if (!nce.isPre()) return;
-      Fqn f = nce.getFqn();
-      if(log.isDebugEnabled()) log.debug("Node kreated called for Fqn " + f);
-      if (InternalHelper.isInternalNode(f))
-      {
-         if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
-      }
-      else
-      {
-         savedFqn.set(f);
-         if(log.isDebugEnabled()) log.debug("savedFqn.set() called");
-      }
-   }
-
-   /**
-    * 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) throws InvalidKeyException
-   {
-      System.out.println("Pojocache.attach() called");
-      Object added = event.getSource();
-
-      System.out.println("the object is " + event.toString());
-
-      NotificationContext notificationContext = event.getContext();
-      System.out.println("notificationContext is " + notificationContext);
-
-      PojoCache pojo = notificationContext.getPojoCache();
-      System.out.println("pojo is " + pojo);
-
-//      Fqn fqn = pojo.getInternalFqn(added);
-      Fqn fqn = savedFqn.get();
-      savedFqn.remove();
-      System.out.println("Fqn is " + fqn);
-
-
-      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
-      System.out.println("new CEI created" + cacheEntityId);
-
-      TransactionContext ctx = new PojoTransactionContext(event);
-      System.out.println("new ctx created" + ctx);
-
-      searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
-   }
-
-   @Detached
-   public void handleDetach(DetachedEvent event) throws InvalidKeyException
-   {
-      Object deleted = event.getSource();
-      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
-
-      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
-
-      TransactionContext ctx = new PojoTransactionContext(event);
-
-      searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
-   }
-
-   //TODO: Sort out updating Lucene for the following annotations: -
-//   @FieldModified
-//   @ListModified
-//   @ArrayModified
-//   @SetModified
-
-}
+///*
+// * JBoss, Home of Professional Open Source
+// * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
+// * by the @authors tag. See the copyright.txt in the distribution for a
+// * full listing of individual contributors.
+// *
+// * This is free software; you can redistribute it and/or modify it
+// * under the terms of the GNU Lesser General Public License as
+// * published by the Free Software Foundation; either version 2.1 of
+// * the License, or (at your option) any later version.
+// *
+// * This software is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this software; if not, write to the Free
+// * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+// * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+// */
+//
+//package org.jboss.cache.search;
+//
+//import org.hibernate.search.impl.SearchFactoryImpl;
+//import org.hibernate.search.backend.TransactionContext;
+//import org.hibernate.search.backend.Work;
+//import org.hibernate.search.backend.WorkType;
+//import org.hibernate.search.engine.SearchFactoryImplementor;
+//import org.jboss.cache.notifications.event.NodeModifiedEvent;
+//import org.jboss.cache.notifications.event.NodeCreatedEvent;
+//import org.jboss.cache.notifications.annotation.NodeModified;
+//import org.jboss.cache.notifications.annotation.CacheListener;
+//import org.jboss.cache.notifications.annotation.NodeCreated;
+//import org.jboss.cache.pojo.notification.annotation.*;
+//import org.jboss.cache.pojo.notification.event.AttachedEvent;
+//import org.jboss.cache.pojo.notification.event.DetachedEvent;
+//import org.jboss.cache.pojo.notification.event.Event;
+//import org.jboss.cache.pojo.notification.NotificationContext;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.pojo.impl.InternalHelper;
+//import org.jboss.cache.Fqn;
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//
+//import javax.transaction.Transaction;
+//
+///**
+// * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
+// */
+//
+//@PojoCacheListener
+//@CacheListener
+//public class SearchablePojoListener
+//{
+//   private SearchFactoryImplementor searchFactory;
+//   private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
+//   private String pojoKey = "pojoKey";
+//
+//   private ThreadLocal<Fqn> savedFqn = new ThreadLocal<Fqn>();
+//
+//   public SearchablePojoListener(SearchFactoryImplementor searchFactory)
+//   {
+//      this.searchFactory = searchFactory;
+//   }
+//
+//   @NodeModified
+//   public void handleNodeModified(NodeModifiedEvent nme)
+//   {
+//      if (!nme.isPre()) return;
+//      Fqn f = nme.getFqn();
+//      if(log.isDebugEnabled()) log.debug("Node modified called for Fqn " + f);
+//      if (InternalHelper.isInternalNode(f))
+//      {
+//         if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+//      }
+//      else
+//      {
+//         savedFqn.set(f);
+//         if(log.isDebugEnabled()) log.debug("Saved Fqn to ThreadLocal.");
+//      }
+//   }
+//
+//   @NodeCreated
+//   public void handleNodeKreated(NodeCreatedEvent nce)
+//   {
+//      if (!nce.isPre()) return;
+//      Fqn f = nce.getFqn();
+//      if(log.isDebugEnabled()) log.debug("Node kreated called for Fqn " + f);
+//      if (InternalHelper.isInternalNode(f))
+//      {
+//         if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+//      }
+//      else
+//      {
+//         savedFqn.set(f);
+//         if(log.isDebugEnabled()) log.debug("savedFqn.set() called");
+//      }
+//   }
+//
+//   /**
+//    * 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) throws InvalidKeyException
+//   {
+//      System.out.println("Pojocache.attach() called");
+//      Object added = event.getSource();
+//
+//      System.out.println("the object is " + event.toString());
+//
+//      NotificationContext notificationContext = event.getContext();
+//      System.out.println("notificationContext is " + notificationContext);
+//
+//      PojoCache pojo = notificationContext.getPojoCache();
+//      System.out.println("pojo is " + pojo);
+//
+////      Fqn fqn = pojo.getInternalFqn(added);
+//      Fqn fqn = savedFqn.get();
+//      savedFqn.remove();
+//      System.out.println("Fqn is " + fqn);
+//
+//
+//      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+//      System.out.println("new CEI created" + cacheEntityId);
+//
+//      TransactionContext ctx = new PojoTransactionContext(event);
+//      System.out.println("new ctx created" + ctx);
+//
+//      searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
+//   }
+//
+//   @Detached
+//   public void handleDetach(DetachedEvent event) throws InvalidKeyException
+//   {
+//      Object deleted = event.getSource();
+//      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
+//
+//      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+//
+//      TransactionContext ctx = new PojoTransactionContext(event);
+//
+//      searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
+//   }
+//
+//   //TODO: Sort out updating Lucene for the following annotations: -
+////   @FieldModified
+////   @ListModified
+////   @ArrayModified
+////   @SetModified
+//
+//}

Modified: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java	2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java	2009-01-04 16:28:01 UTC (rev 7350)
@@ -31,7 +31,7 @@
  * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
  */
 
- at Test(groups = "functional", enabled = true)
+ at Test(groups = "functional", enabled = false)
 public class LocalPOJOCacheTest
 {
    SearchableCache searchableCache;




More information about the jbosscache-commits mailing list