Author: manik.surtani(a)jboss.com
Date: 2008-11-27 20:13:16 -0500 (Thu, 27 Nov 2008)
New Revision: 7225
Modified:
searchable/trunk/TODO.txt
searchable/trunk/pom.xml
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:
Modified: searchable/trunk/TODO.txt
===================================================================
--- searchable/trunk/TODO.txt 2008-11-27 23:29:25 UTC (rev 7224)
+++ searchable/trunk/TODO.txt 2008-11-28 01:13:16 UTC (rev 7225)
@@ -1,15 +1,26 @@
-1 - Fix POJO cache listener.
+Timelines:
-The class needs to be able to get the Fqn and Key from the object so that Lucene can be
updated.
+1. Write a release script. :-) Refer to release.sh in the JBoss Cache Core repo as an
example.
-2 - Lazy iterator.
+2. Release 1.0.0.CR2.
-So that when a large amount of hits are there, they can be loaded when required.
+Make a note of the release steps - maybe create a RELEASE.txt file with the steps you
need to go through to make a release.
+This will ensure nothing is missed.
-4 - Non-string keys.
+By tomorrow (Fri 28th Nov)
-Think.
+3. Fix POJO cache listener. URGENT.
-5 - Mock objects.
+4. Make sure you have proper tests.
-6 - Think about removing the Hibernate Exceptions.
\ No newline at end of file
+5. Release CR3
+
+By Friday (5 Dec)
+
+6. Think about removing the Hibernate Exceptions.
+
+7. Profile using JProfiler
+
+8. Publish CR4/GA.
+
+By Friday (12 Dec)
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2008-11-27 23:29:25 UTC (rev 7224)
+++ searchable/trunk/pom.xml 2008-11-28 01:13:16 UTC (rev 7225)
@@ -26,24 +26,28 @@
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
<version>3.0.0.GA</version>
+ <!-- TODO: change to 3.0.1.GA ASAP -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>3.1.0.Beta1</version>
+ <!-- TODO: change to 3.1.0.GA , or at least a recent CR -->
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
+ <!-- TODO: change to 1.1.1 ASAP -->
</dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-pojo</artifactId>
<version>2.2.0.CR7</version>
+ <!-- TODO: change to 3.0.0.GA ASAP -->
</dependency>
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-11-27
23:29:25 UTC (rev 7224)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-11-28
01:13:16 UTC (rev 7225)
@@ -144,6 +144,7 @@
//Now create the 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 2008-11-27
23:29:25 UTC (rev 7224)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java 2008-11-28
01:13:16 UTC (rev 7225)
@@ -28,13 +28,17 @@
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;
@@ -46,17 +50,52 @@
*/
@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();
+ System.out.println("Node modified called for Fqn " + f);
+ if (InternalHelper.isInternalNode(f))
+ {
+ System.out.println("Is internal and I dont care");
+ }
+ else
+ {
+ savedFqn.set(f);
+ }
+ }
+
+ @NodeCreated
+ public void handleNodeKreated(NodeCreatedEvent nce)
+ {
+ if (!nce.isPre()) return;
+ Fqn f = nce.getFqn();
+ System.out.println("Node kreated called for Fqn " + f);
+ if (InternalHelper.isInternalNode(f))
+ {
+ System.out.println("Is internal and I dont care");
+ }
+ else
+ {
+ savedFqn.set(f);
+ }
+ }
+
/**
* Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the
NodeModifiedEvent class.
*
@@ -78,7 +117,9 @@
PojoCache pojo = notificationContext.getPojoCache();
System.out.println("pojo is " + pojo);
- Fqn fqn = pojo.getInternalFqn(added);
+// Fqn fqn = pojo.getInternalFqn(added);
+ Fqn fqn = savedFqn.get();
+ savedFqn.remove();
System.out.println("Fqn is " + fqn);
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 2008-11-27
23:29:25 UTC (rev 7224)
+++
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2008-11-28
01:13:16 UTC (rev 7225)
@@ -29,7 +29,7 @@
* @author Navin Surtani (<a
href="mailto:nsurtani@redhat.com">nsurtani@redhat.com</a>)
*/
-@Test(groups = "functional", enabled = false)
+@Test(groups = "functional", enabled = true)
public class LocalPOJOCacheTest
{
SearchableCache searchableCache;
Show replies by date