JBoss Cache SVN: r5946 - searchable/trunk/src/main/java/org/jboss/cache/search.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-03 12:22:30 -0400 (Tue, 03 Jun 2008)
New Revision: 5946
Added:
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResult.java
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
Log:
Created QueryResults, QueryResultsImpl and Transformer.
Added: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResult.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResult.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/QueryResult.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -0,0 +1,72 @@
+package org.jboss.cache.search;
+
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.Sort;
+import org.hibernate.search.FullTextFilter;
+import org.hibernate.search.FullTextQuery;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 3:13:27 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface QueryResult {
+
+ /**
+ * Allows to let lucene sort the results. This is useful when you have
+ * additional sort requirements on top of the default lucene ranking.
+ * Without lucene sorting you would have to retrieve the full result set and
+ * order the hibernate objects.
+ *
+ * @param sort The lucene sort object.
+ * @return this for method chaining
+ */
+ FullTextQuery setSort(Sort sort);
+
+ /**
+ * Allows to use lucene filters.
+ * Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach
+ *
+ * @param filter The lucene filter.
+ * @return this for method chaining
+ */
+ FullTextQuery setFilter(Filter filter);
+
+ /**
+ * Returns the number of hits for this search
+ * <p/>
+ * Caution:
+ * The number of results might be slightly different from
+ * <code>list().size()</code> because list() if the index is
+ * not in sync with the database at the time of query.
+ */
+ int getResultSize();
+
+ /**
+ * Enable a given filter by its name. Returns a FullTextFilter object that allows filter parameter injection
+ */
+ FullTextFilter enableFullTextFilter(String name);
+
+ /**
+ * Disable a given filter by its name
+ */
+ void disableFullTextFilter(String name);
+
+ /**
+ * {link:Query#setFirstResult}
+ */
+ FullTextQuery setFirstResult(int firstResult);
+
+ /**
+ * {link:Query#setMaxResults}
+ */
+ FullTextQuery setMaxResults(int maxResults);
+
+ /**
+ * Defines scrollable result fetch size as well as the JDBC fetch size
+ */
+ FullTextQuery setFetchSize(int i);
+
+}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultImpl.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultImpl.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -0,0 +1,67 @@
+package org.jboss.cache.search;
+
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.FullTextFilter;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.Query;
+import org.jboss.cache.Cache;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 3:23:25 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class QueryResultImpl implements QueryResult
+{
+ private Query query;
+ private Cache cache;
+
+ public QueryResultImpl(Query luceneQuery, Cache cache)
+ {
+ this.query = luceneQuery;
+ this.cache = cache;
+ }
+
+ public FullTextQuery setSort(Sort sort)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public FullTextQuery setFilter(Filter filter)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getResultSize()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public FullTextFilter enableFullTextFilter(String name)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void disableFullTextFilter(String name)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public FullTextQuery setFirstResult(int firstResult)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public FullTextQuery setMaxResults(int maxResults)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public FullTextQuery setFetchSize(int i)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-03 15:33:49 UTC (rev 5945)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -3,8 +3,6 @@
import org.apache.lucene.search.Query;
import org.jboss.cache.Cache;
-import java.util.List;
-
/**
* Created by IntelliJ IDEA.
* User: navin
@@ -14,7 +12,7 @@
*/
public interface SearchableCache extends Cache
{
- public List find(Query luceneQuery);
+ public QueryResult find(Query luceneQuery);
}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-03 15:33:49 UTC (rev 5945)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -12,6 +12,7 @@
import org.jboss.cache.config.Configuration;
import org.jgroups.Address;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -33,11 +34,9 @@
this.cache = cache;
}
- public List find(Query luceneQuery)
+ public QueryResult find(Query luceneQuery)
{
- // TODO: Write up find() method. What does HS do when given the Lucene/Hibernate query ??
-
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return new QueryResultImpl(luceneQuery, cache);
}
public Configuration getConfiguration()
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-03 15:33:49 UTC (rev 5945)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -1,12 +1,13 @@
package org.jboss.cache.search;
+import org.hibernate.search.backend.Work;
+import org.hibernate.search.backend.WorkType;
import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeCreated;
import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.event.NodeEvent;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import java.util.Map;
+
/**
* Created by IntelliJ IDEA.
* User: navin
@@ -18,15 +19,14 @@
@CacheListener
public class SearchableListener
{
-
- @NodeCreated
- @NodeRemoved
+
@NodeModified
- @NodeMoved
- public void updateLuceneIndexes(NodeEvent event)
+ public void updateLuceneIndexes(NodeModifiedEvent event)
{
if (!event.isPre())
{
+
+
// TODO: Update Lucene Indexes. See Hibernate Search's FullTextEventListener class for details on what to do.
}
else
@@ -34,4 +34,23 @@
// ignore the event.
}
}
+
+ void handlePutData(NodeModifiedEvent event)
+ {
+ Map dataMap = event.getData();
+
+ for (Object key: dataMap.keySet())
+ {
+ String keyString = (String) key;
+ String docId = Transformer.generateId(event.getFqn(), keyString) ;
+
+ new Work (dataMap.get(key), docId, WorkType.DELETE);
+ new Work (dataMap.get(key), docId, WorkType.ADD);
+
+ //TODO: Add to queue.
+
+ }
+
+
+ }
}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java 2008-06-03 16:22:30 UTC (rev 5946)
@@ -0,0 +1,34 @@
+package org.jboss.cache.search;
+
+import org.jboss.cache.Fqn;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 2:02:57 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Transformer
+{
+ public static Fqn getFqn(String docId)
+ {
+ //TODO: Do the dirty work to convert a given document Id into an Fqn.
+ return null;
+ }
+
+ public static String getKey(String docId)
+ {
+ //TODO: Get the document Id to give back a string.
+ return null;
+ }
+
+ public static String generateId(Fqn fqn, String key)
+ {
+ //TODO: Generate the Id from the given Fqn and key pairing to get a unique String.
+ //TODO: Look at HS documentation to see what can be done about non-String keys.
+ return null;
+ }
+
+
+}
16 years, 6 months
JBoss Cache SVN: r5945 - benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-06-03 11:33:49 -0400 (Tue, 03 Jun 2008)
New Revision: 5945
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib/jbosscache-core.jar
Log:
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
16 years, 6 months
JBoss Cache SVN: r5944 - in core/tags/2.2.0.CR2: src/main/java/org/jboss/cache and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 11:20:15 -0400 (Tue, 03 Jun 2008)
New Revision: 5944
Modified:
core/tags/2.2.0.CR2/pom.xml
core/tags/2.2.0.CR2/src/main/java/org/jboss/cache/Version.java
Log:
Updated versions
Modified: core/tags/2.2.0.CR2/pom.xml
===================================================================
--- core/tags/2.2.0.CR2/pom.xml 2008-06-03 15:02:07 UTC (rev 5943)
+++ core/tags/2.2.0.CR2/pom.xml 2008-06-03 15:20:15 UTC (rev 5944)
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>2.2.0-SNAPSHOT</jbosscache-core-version>
+ <jbosscache-core-version>2.2.0.CR2</jbosscache-core-version>
<!-- By default only run tests in the "unit" group -->
<defaultTestGroup>unit</defaultTestGroup>
<!-- By default only generate Javadocs when we install the module. -->
@@ -410,7 +410,7 @@
<activeByDefault>false</activeByDefault>
</activation>
<properties>
- <jbosscache-core-version>2.2.0-SNAPSHOT-JBossAS</jbosscache-core-version>
+ <jbosscache-core-version>2.2.0.CR2-JBossAS</jbosscache-core-version>
</properties>
<dependencies>
<dependency>
Modified: core/tags/2.2.0.CR2/src/main/java/org/jboss/cache/Version.java
===================================================================
--- core/tags/2.2.0.CR2/src/main/java/org/jboss/cache/Version.java 2008-06-03 15:02:07 UTC (rev 5943)
+++ core/tags/2.2.0.CR2/src/main/java/org/jboss/cache/Version.java 2008-06-03 15:20:15 UTC (rev 5944)
@@ -11,10 +11,10 @@
@Immutable
public class Version
{
- public static final String version = "2.2.0-SNAPSHOT";
+ public static final String version = "2.2.0.CR2";
public static final String codename = "Poblano";
//public static final String cvs = "$Id: Version.java 4592 2007-10-10 16:44:36Z manik.surtani(a)jboss.com $";
- static final byte[] version_id = {'0', '2', '2', '0', 'S'};
+ static final byte[] version_id = {'0', '2', '2', '0', 'C', '2'};
private static final int MAJOR_SHIFT = 11;
private static final int MINOR_SHIFT = 6;
16 years, 6 months
JBoss Cache SVN: r5943 - core/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 11:02:07 -0400 (Tue, 03 Jun 2008)
New Revision: 5943
Added:
core/tags/2.2.0.CR2/
Log:
Copied: core/tags/2.2.0.CR2 (from rev 5942, core/trunk)
16 years, 6 months
JBoss Cache SVN: r5942 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 10:57:27 -0400 (Tue, 03 Jun 2008)
New Revision: 5942
Modified:
core/trunk/README-Maven.txt
Log:
Blah
Modified: core/trunk/README-Maven.txt
===================================================================
--- core/trunk/README-Maven.txt 2008-06-03 14:50:13 UTC (rev 5941)
+++ core/trunk/README-Maven.txt 2008-06-03 14:57:27 UTC (rev 5942)
@@ -5,11 +5,11 @@
Requirements:
* Java 5.0 and above
-* Maven 2.x
+* Maven 2.0.8 and above
-1.1. Typical lifecycle phases
------------------------------
+1.1. Quickstart: Typical lifecycle phases
+-----------------------------------------
Maven will create a target/ directory under the root for the creation of
output at every stage.
16 years, 6 months
JBoss Cache SVN: r5941 - core/trunk/src/test/resources.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 10:50:13 -0400 (Tue, 03 Jun 2008)
New Revision: 5941
Modified:
core/trunk/src/test/resources/log4j.xml
Log:
Cleaned up log4j.xml
Modified: core/trunk/src/test/resources/log4j.xml
===================================================================
--- core/trunk/src/test/resources/log4j.xml 2008-06-03 12:55:32 UTC (rev 5940)
+++ core/trunk/src/test/resources/log4j.xml 2008-06-03 14:50:13 UTC (rev 5941)
@@ -1,35 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id$ -->
-
<!--
- | For more configuration infromation and examples see the Jakarta Log4j
- | owebsite: http://jakarta.apache.org/log4j
+ For more configuration infromation and examples see the Apache Log4j website: http://logging.apache.org/log4j/
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="../jbosscache.log"/>
- <param name="Append" value="false"/>
+ <param name="Append" value="true"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<!-- Rollover at the top of each hour
- <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
-->
<param name="Threshold" value="DEBUG"/>
@@ -43,10 +30,6 @@
</layout>
</appender>
- <!-- ============================== -->
- <!-- Append messages to the console -->
- <!-- ============================== -->
-
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="TRACE"/>
<param name="Target" value="System.out"/>
@@ -66,6 +49,10 @@
<priority value="WARN"/>
</category>
+ <category name="org.jboss.cache.factories">
+ <priority value="WARN"/>
+ </category>
+
<category name="org.jboss.tm">
<priority value="WARN"/>
</category>
@@ -79,7 +66,7 @@
<!-- ======================= -->
<root>
- <!-- <appender-ref ref="CONSOLE"/> -->
+ <!--<appender-ref ref="CONSOLE"/>-->
<appender-ref ref="FILE"/>
</root>
16 years, 6 months
JBoss Cache SVN: r5940 - in searchable/trunk: assembly and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 08:55:32 -0400 (Tue, 03 Jun 2008)
New Revision: 5940
Removed:
searchable/trunk/assembly/doc.xml
Modified:
searchable/trunk/assembly/all.xml
searchable/trunk/pom.xml
Log:
Removed docbook stuff
Modified: searchable/trunk/assembly/all.xml
===================================================================
--- searchable/trunk/assembly/all.xml 2008-06-03 12:50:34 UTC (rev 5939)
+++ searchable/trunk/assembly/all.xml 2008-06-03 12:55:32 UTC (rev 5940)
@@ -60,11 +60,6 @@
<directory>target/site/apidocs</directory>
<outputDirectory>doc/apidocs</outputDirectory>
</fileSet>
-
- <fileSet>
- <directory>target/docbook</directory>
- <outputDirectory>doc/</outputDirectory>
- </fileSet>
</fileSets>
<!-- Make sure we filter out the junk that jboss-common-core pulls in -->
Deleted: searchable/trunk/assembly/doc.xml
===================================================================
--- searchable/trunk/assembly/doc.xml 2008-06-03 12:50:34 UTC (rev 5939)
+++ searchable/trunk/assembly/doc.xml 2008-06-03 12:55:32 UTC (rev 5940)
@@ -1,36 +0,0 @@
-<assembly>
- <id>doc</id>
-
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>true</includeBaseDirectory>
-
- <fileSets>
- <!-- EULAs and license files -->
- <fileSet>
- <directory>src/main/release</directory>
- <outputDirectory/>
- <includes>
- <include>*.txt</include>
- </includes>
- <excludes>
- <exclude>**lib**</exclude>
- <exclude>license/*</exclude>
- </excludes>
- </fileSet>
-
- <!-- docs -->
- <fileSet>
- <directory>target/site/apidocs</directory>
- <outputDirectory>doc/apidocs</outputDirectory>
- </fileSet>
-
- <fileSet>
- <directory>target/docbook</directory>
- <outputDirectory>doc/</outputDirectory>
- </fileSet>
- </fileSets>
-
-</assembly>
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2008-06-03 12:50:34 UTC (rev 5939)
+++ searchable/trunk/pom.xml 2008-06-03 12:55:32 UTC (rev 5940)
@@ -57,7 +57,6 @@
<configuration>
<descriptors>
<descriptor>assembly/bin.xml</descriptor>
- <descriptor>assembly/doc.xml</descriptor>
<descriptor>assembly/all.xml</descriptor>
</descriptors>
<finalName>${artifactId}-${jbosscache-searchable-version}</finalName>
16 years, 6 months
JBoss Cache SVN: r5939 - in searchable/trunk/src/main/java: org and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-03 08:50:34 -0400 (Tue, 03 Jun 2008)
New Revision: 5939
Added:
searchable/trunk/src/main/java/org/
searchable/trunk/src/main/java/org/jboss/
searchable/trunk/src/main/java/org/jboss/cache/
searchable/trunk/src/main/java/org/jboss/cache/search/
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
Log:
Created SearchableListener, SearchableCacheFactory, SearchableCacheImpl classes and SearchableCache interface.
Added: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-03 12:50:34 UTC (rev 5939)
@@ -0,0 +1,20 @@
+package org.jboss.cache.search;
+
+import org.apache.lucene.search.Query;
+import org.jboss.cache.Cache;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 10:48:46 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface SearchableCache extends Cache
+{
+ public List find(Query luceneQuery);
+
+
+}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-03 12:50:34 UTC (rev 5939)
@@ -0,0 +1,26 @@
+package org.jboss.cache.search;
+
+import org.jboss.cache.Cache;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 10:52:25 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SearchableCacheFactory
+{
+ public SearchableCache createSearchableCache (Cache c, Class... classes)
+ {
+
+ // TODO: Initialise HS internals
+
+ SearchableListener listener = new SearchableListener();
+ c.addCacheListener(listener);
+
+ SearchableCache sc = new SearchableCacheImpl(c);
+ return sc;
+ }
+
+}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-03 12:50:34 UTC (rev 5939)
@@ -0,0 +1,252 @@
+package org.jboss.cache.search;
+
+import org.apache.lucene.search.Query;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.Region;
+import org.jboss.cache.config.Configuration;
+import org.jgroups.Address;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 10:51:53 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SearchableCacheImpl implements SearchableCache
+{
+ // this is the ACTUAL cache. that does all the work.
+ private Cache cache;
+
+ public SearchableCacheImpl(Cache cache)
+ {
+ this.cache = cache;
+ }
+
+ public List find(Query luceneQuery)
+ {
+ // TODO: Write up find() method. What does HS do when given the Lucene/Hibernate query ??
+
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Configuration getConfiguration()
+ {
+ return cache.getConfiguration();
+ }
+
+ public Node getRoot()
+ {
+ return cache.getRoot();
+ }
+
+ public void addCacheListener(Object listener)
+ {
+ cache.addCacheListener(listener);
+ }
+
+ public void removeCacheListener(Object listener)
+ {
+ cache.removeCacheListener(listener);
+ }
+
+ public Set getCacheListeners()
+ {
+ return cache.getCacheListeners();
+ }
+
+ public Object put(String fqn, Object key, Object value)
+ {
+ return cache.put(fqn, key, value);
+ }
+
+ public void put(String fqn, Map data)
+ {
+ cache.put(fqn, data);
+ }
+
+ public Object remove(String fqn, Object key)
+ {
+ return cache.remove(fqn, key);
+ }
+
+ public boolean removeNode(String fqn)
+ {
+ return cache.removeNode(fqn);
+ }
+
+ public Node getNode(String fqn)
+ {
+ return cache.getNode(fqn);
+ }
+
+ public Object get(String fqn, Object key)
+ {
+ return cache.get(fqn, key);
+ }
+
+ public void create() throws CacheException
+ {
+ cache.create();
+ }
+
+ public void start() throws CacheException
+ {
+ cache.start();
+ }
+
+ public void stop()
+ {
+ cache.stop();
+ }
+
+ public void destroy()
+ {
+ cache.destroy();
+ }
+
+ public CacheStatus getCacheStatus()
+ {
+ return cache.getCacheStatus();
+ }
+
+ public InvocationContext getInvocationContext()
+ {
+ return cache.getInvocationContext();
+ }
+
+ public void setInvocationContext(InvocationContext ctx)
+ {
+ cache.setInvocationContext(ctx);
+ }
+
+ public Address getLocalAddress()
+ {
+ return cache.getLocalAddress();
+ }
+
+ public List getMembers()
+ {
+ return cache.getMembers();
+ }
+
+ public void move(String nodeToMove, String newParent) throws NodeNotExistsException
+ {
+ cache.move(nodeToMove, newParent);
+ }
+
+ public String getVersion()
+ {
+ return cache.getVersion();
+ }
+
+ public Set getKeys(String fqn)
+ {
+ return cache.getKeys(fqn);
+ }
+
+ public void clearData(String fqn)
+ {
+ cache.clearData(fqn);
+ }
+
+ public void clearData(Fqn fqn)
+ {
+ cache.clearData(fqn);
+ }
+
+ public Set getKeys(Fqn fqn)
+ {
+ return cache.getKeys(fqn);
+ }
+
+ public Map getData(Fqn fqn)
+ {
+ return cache.getData(fqn);
+ }
+
+ public void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException
+ {
+ cache.move(nodeToMove, newParent);
+ }
+
+ public boolean removeRegion(Fqn fqn)
+ {
+ return cache.removeRegion(fqn);
+ }
+
+ public Region getRegion(Fqn fqn, boolean createIfAbsent)
+ {
+ return cache.getRegion(fqn, createIfAbsent);
+ }
+
+ public void evict(Fqn fqn)
+ {
+ cache.evict(fqn);
+ }
+
+ public void evict(Fqn fqn, boolean recursive)
+ {
+ cache.evict(fqn, recursive);
+ }
+
+ public Object get(Fqn fqn, Object key)
+ {
+ return cache.get(fqn, key);
+ }
+
+ public Node getNode(Fqn fqn)
+ {
+ return cache.getNode(fqn);
+ }
+
+ public boolean removeNode(Fqn fqn)
+ {
+ return cache.removeNode(fqn);
+ }
+
+ public Object remove(Fqn fqn, Object key)
+ {
+ return cache.remove(fqn, key);
+ }
+
+ public void put(Fqn fqn, Map data)
+ {
+ cache.put(fqn, data);
+ }
+
+ public void putForExternalRead(Fqn fqn, Object key, Object value)
+ {
+ cache.putForExternalRead(fqn, key, value);
+ }
+
+ public Object put(Fqn fqn, Object key, Object value)
+ {
+ return cache.put(fqn, key, value);
+ }
+
+ public Set getCacheListeners(Fqn region)
+ {
+ return cache.getCacheListeners(region);
+ }
+
+ public void removeCacheListener(Fqn region, Object listener)
+ {
+ cache.removeCacheListener(region, listener);
+ }
+
+ public void addCacheListener(Fqn region, Object listener)
+ {
+ cache.addCacheListener(region, listener);
+ }
+}
Added: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-03 12:50:34 UTC (rev 5939)
@@ -0,0 +1,37 @@
+package org.jboss.cache.search;
+
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeModified;
+import org.jboss.cache.notifications.annotation.NodeMoved;
+import org.jboss.cache.notifications.annotation.NodeRemoved;
+import org.jboss.cache.notifications.event.NodeEvent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: navin
+ * Date: Jun 3, 2008
+ * Time: 11:42:50 AM
+ * To change this template use File | Settings | File Templates.
+ */
+
+@CacheListener
+public class SearchableListener
+{
+
+ @NodeCreated
+ @NodeRemoved
+ @NodeModified
+ @NodeMoved
+ public void updateLuceneIndexes(NodeEvent event)
+ {
+ if (!event.isPre())
+ {
+ // TODO: Update Lucene Indexes. See Hibernate Search's FullTextEventListener class for details on what to do.
+ }
+ else
+ {
+ // ignore the event.
+ }
+ }
+}
16 years, 6 months
JBoss Cache SVN: r5938 - core/trunk/src/test/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 07:11:22 -0400 (Tue, 03 Jun 2008)
New Revision: 5938
Modified:
core/trunk/src/test/java/org/jboss/cache/FqnTest.java
Log:
Changed group
Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-06-03 11:10:06 UTC (rev 5937)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java 2008-06-03 11:11:22 UTC (rev 5938)
@@ -27,7 +27,7 @@
* @author <a href="mailto:bela@jboss.org">Bela Ban</a> May 9, 2003
* @version $Revision$
*/
-@Test(groups = "functional")
+@Test(groups = "unit")
public class FqnTest
{
private Cache<Object, Object> cache;
16 years, 6 months
JBoss Cache SVN: r5937 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-03 07:10:06 -0400 (Tue, 03 Jun 2008)
New Revision: 5937
Modified:
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
Log:
equals() and hashcode()
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-06-03 10:48:44 UTC (rev 5936)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2008-06-03 11:10:06 UTC (rev 5937)
@@ -157,6 +157,25 @@
return getFqn().compareTo(other.getFqn());
}
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ RegionImpl region = (RegionImpl) o;
+
+ if (fqn != null ? !fqn.equals(region.fqn) : region.fqn != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return (fqn != null ? fqn.hashCode() : 0);
+ }
+
public void putNodeEvent(EvictedEventNode event)
{
try
16 years, 6 months