Author: manik.surtani(a)jboss.com
Date: 2008-10-18 09:50:21 -0400 (Sat, 18 Oct 2008)
New Revision: 6982
Modified:
searchable/trunk/pom.xml
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/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Updated to JBC 3.0.0.CR1
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2008-10-17 18:11:32 UTC (rev 6981)
+++ searchable/trunk/pom.xml 2008-10-18 13:50:21 UTC (rev 6982)
@@ -25,7 +25,7 @@
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <version>2.2.0.GA</version>
+ <version>3.0.0.CR1</version>
</dependency>
<dependency>
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-10-17
18:11:32 UTC (rev 6981)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-10-18
13:50:21 UTC (rev 6982)
@@ -18,7 +18,7 @@
* 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;
@@ -26,10 +26,11 @@
import org.jboss.cache.Cache;
/**
- * This will be the most used interface in JBossCache searchable. It extends
Cache and therefore will have
- * the standard get(), put() and remove() methods. The additional method is the
createQuery method which people
- * will use to build their Hibernate Search queries from a luceneQuery -
Hibernate Search users will be very familiar
- * with this.
+ * This will be the most used interface in JBossCache searchable. It extends Cache and
therefore will have
+ * the standard get(), put() and remove() methods. The additional method is the
createQuery method which people
+ * will use to build their Hibernate Search queries from a luceneQuery - Hibernate Search
users will be very familiar
+ * with this.
+ *
* @author Navin Surtani (<a
href="mailto:nsurtani@redhat.com">nsurtani@redhat.com</a>)
* <p/>
*/
@@ -42,15 +43,14 @@
* @param luceneQuery - from {@link org.apache.lucene.search.Query}
* @return a CacheQuery instance from which the user can get a list/iterator object.
*/
- public CacheQuery createQuery(Query luceneQuery);
+ CacheQuery createQuery(Query luceneQuery);
/**
* Creates a CacheQuery from a lucene query and a class array.
*
- * @param classes - array of classes to be searched from.
+ * @param classes - array of classes to be searched from.
* @param luceneQuery - from {@link org.apache.lucene.search.Query}
* @return a CacheQuery instance from which the user can get a list/iterator object.
*/
- public CacheQuery createQuery(Query luceneQuery, Class... classes);
-
+ CacheQuery createQuery(Query luceneQuery, Class... classes);
}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-10-17
18:11:32 UTC (rev 6981)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-10-18
13:50:21 UTC (rev 6982)
@@ -18,7 +18,7 @@
* 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;
@@ -77,7 +77,7 @@
* Creates a CacheQuery object from a Lucene Query and a class array.
*
* @param luceneQuery - for lucene
- * @param classes array
+ * @param classes array
* @return CacheQuery object.
*/
@@ -115,8 +115,6 @@
*
* @param listener
*/
-
- //TODO: Does this have to be a CacheListener?
public void addCacheListener(Object listener)
{
cache.addCacheListener(listener);
@@ -127,8 +125,6 @@
*
* @param listener
*/
-
-
public void removeCacheListener(Object listener)
{
cache.removeCacheListener(listener);
@@ -145,7 +141,12 @@
return cache.getCacheListeners();
}
+ public V put(Fqn fqn, K key, V value)
+ {
+ return cache.put(fqn, key, value);
+ }
+
/**
* Puts something into the cache with a given Fqn, key and value.
*
@@ -160,33 +161,36 @@
return cache.put(fqn, key, value);
}
- /**
- * Puts something into the cache with a given Fqn and Map instance.
- *
- * @param fqn
- * @param data
- */
+ public void putForExternalRead(Fqn fqn, K key, V value)
+ {
+ cache.put(fqn, key, value);
+ }
+ public void put(Fqn fqn, Map<? extends K, ? extends V> data)
+ {
+ cache.put(fqn, data);
+ }
- public void put(String fqn, Map<K, V> data)
+ public void put(String fqn, Map<? extends K, ? extends V> data)
{
cache.put(fqn, data);
}
- /**
- * Removes something from the cache with a given Fqn and key.
- *
- * @param fqn
- * @param key
- * @return
- */
+ public V remove(Fqn fqn, K key)
+ {
+ return cache.remove(fqn, key);
+ }
-
public V remove(String fqn, K key)
{
return cache.remove(fqn, key);
}
+ public boolean removeNode(Fqn fqn)
+ {
+ return cache.removeNode(fqn);
+ }
+
/**
* Convenience method that takes a string representation of an Fqn. Otherwise
identical to removeNode(Fqn)
*
@@ -199,6 +203,11 @@
return cache.removeNode(fqn);
}
+ public Node<K, V> getNode(Fqn fqn)
+ {
+ return cache.getNode(fqn);
+ }
+
/**
* Gets a node from a String representation of a Fqn
*
@@ -211,6 +220,11 @@
return cache.getNode(fqn);
}
+ public V get(Fqn fqn, K key)
+ {
+ return cache.get(fqn, key);
+ }
+
/**
* Convenience method that allows for direct access to the data in a Node.
*
@@ -223,6 +237,26 @@
return cache.get(fqn, key);
}
+ public void evict(Fqn fqn, boolean recursive)
+ {
+ cache.evict(fqn, recursive);
+ }
+
+ public void evict(Fqn fqn)
+ {
+ cache.evict(fqn);
+ }
+
+ public Region getRegion(Fqn fqn, boolean createIfAbsent)
+ {
+ return cache.getRegion(fqn, createIfAbsent);
+ }
+
+ public boolean removeRegion(Fqn fqn)
+ {
+ return cache.removeRegion(fqn);
+ }
+
/**
* Lifecycle method that initializes configuration state, the root node, etc.
*
@@ -268,6 +302,7 @@
/**
* Gets where the cache currently is its lifecycle transitions.
+ *
* @return the CacheStatus. Will not return null.
*/
@@ -278,7 +313,7 @@
/**
* The current invocation context for the current invocation and cache instance.
- *
+ *
* @return the current invocation context for the current invocation and cache
instance
*/
public InvocationContext getInvocationContext()
@@ -299,7 +334,7 @@
/**
* Returns the local address of this cache in a cluster, or null if running in local
mode.
- *
+ *
* @return Returns the local address of this cache in a cluster, or null if running
in local mode.
*/
public Address getLocalAddress()
@@ -309,7 +344,7 @@
/**
* Returns a list of members in the cluster, or null if running in local mode.
- *
+ *
* @return Returns a list of members in the cluster, or null if running in local
mode.
*/
@@ -319,9 +354,14 @@
return cache.getMembers();
}
+ public void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException
+ {
+ cache.move(nodeToMove, newParent);
+ }
+
/**
* Moves a part of the cache to a different subtree. Takes Strings for convenience.
- *
+ *
* @param nodeToMove
* @param newParent
* @throws NodeNotExistsException
@@ -333,7 +373,7 @@
/**
* Returns the version of the cache as a string.
- *
+ *
* @return Returns the version of the cache as a string.
*/
public String getVersion()
@@ -341,6 +381,11 @@
return cache.getVersion();
}
+ public Map<K, V> getData(Fqn fqn)
+ {
+ return cache.getData(fqn);
+ }
+
/**
* Returns a set of attribute keys for the Fqn. Takes Strings for convenience.
*
@@ -353,197 +398,28 @@
return cache.getKeys(fqn);
}
- /**
- * Removes the keys and properties from a named node. Takes Strings for convenience.
- *
- * @param fqn
- */
+ public Set<K> getKeys(Fqn fqn)
+ {
+ return cache.getKeys(fqn);
+ }
public void clearData(String fqn)
{
cache.clearData(fqn);
}
- /**
- * Removes the keys and properties from a named node.
- * @param fqn
- */
-
- public void clearData(Fqn<?> fqn)
+ public void clearData(Fqn fqn)
{
cache.clearData(fqn);
}
- /**
- * Returns a set of attribute keys for the Fqn.
- *
- * @param fqn
- * @return
- */
- public Set getKeys(Fqn<?> fqn)
+ public void startBatch()
{
- return cache.getKeys(fqn);
+ cache.startBatch();
}
- /**
- * Retrieves a defensively copied data map of the underlying node.
- *
- * @param fqn
- * @return a defensively copied data map of the underlying node.
- */
- public Map getData(Fqn<?> fqn)
+ public void endBatch(boolean successful)
{
- return cache.getData(fqn);
+ cache.endBatch(successful);
}
-
- /**
- * Moves a part of the cache to a different subtree.
- *
- * @param nodeToMove
- * @param newParent
- * @throws NodeNotExistsException
- */
- public void move(Fqn<?> nodeToMove, Fqn<?> newParent) throws
NodeNotExistsException
- {
- cache.move(nodeToMove, newParent);
- }
-
- /**
- * Removes a region denoted by the Fqn passed in.
- *
- * @param fqn
- * @return True if the region did exist and was removed, false otherwise.
- */
-
- public boolean removeRegion(Fqn<?> fqn)
- {
- return cache.removeRegion(fqn);
- }
-
- /**
- * Retrieves a Region for a given Fqn.
- *
- * @param fqn
- * @param createIfAbsent
- * @return a MarshRegion. Null if none is found.
- */
- public Region getRegion(Fqn<?> fqn, boolean createIfAbsent)
- {
- return cache.getRegion(fqn, createIfAbsent);
- }
-
- /**
- * Eviction call that evicts the specified Node from memory.
- *
- * @param fqn
- */
-
- public void evict(Fqn<?> fqn)
- {
- cache.evict(fqn);
- }
-
- /**
- * Eviction call that evicts the specified Node from memory.
- *
- * @param fqn
- * @param recursive
- */
-
-
- public void evict(Fqn<?> fqn, boolean recursive)
- {
- cache.evict(fqn, recursive);
- }
-
- /**
- * Convenience method that allows for direct access to the data in a Node.
- *
- * @param fqn
- * @param key
- * @return
- */
-
-
- public V get(Fqn<?> fqn, K key)
- {
- return cache.get(fqn, key);
- }
-
- /**
- * A convenience method to retrieve a node directly from the cache.
- *
- * @param fqn
- * @return
- */
-
- public Node getNode(Fqn<?> fqn)
- {
- return cache.getNode(fqn);
- }
-
- /**
- * Removes a Node indicated by absolute Fqn.
- *
- * @param fqn
- * @return True if the node was removed, false if the node was not found.
- */
- public boolean removeNode(Fqn<?> fqn)
- {
- return cache.removeNode(fqn);
- }
-
- /**
- * Moves a part of the cache to a different subtree.
- *
- * @param fqn
- * @param key
- * @return
- */
- public V remove(Fqn<?> fqn, K key)
- {
- return cache.remove(fqn, key);
- }
-
- /**
- * Copies all of the mappings from the specified map to a Node.
- *
- * @param fqn
- * @param data
- */
-
-
- public void put(Fqn<?> fqn, Map<K, V> data)
- {
- cache.put(fqn, data);
- }
-
- /**
- * Under special operating behavior, associates the value with the specified key for a
node identified
- * by the Fqn passed in.
- * @param fqn
- * @param key
- * @param value
- */
-
- public void putForExternalRead(Fqn<?> fqn, K key, V value)
- {
- cache.putForExternalRead(fqn, key, value);
- }
-
- /**
- * Associates the specified value with the specified key for a Node in this cache.
- *
- *
- * @param fqn
- * @param key
- * @param value
- * @return
- */
-
-
- public V put(Fqn<?> fqn, K key, V value)
- {
- return cache.put(fqn, key, value);
- }
}
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-10-17
18:11:32 UTC (rev 6981)
+++
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2008-10-18
13:50:21 UTC (rev 6982)
@@ -1,11 +1,11 @@
package org.jboss.cache.search.blackbox;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.pojo.PojoCache;
@@ -29,7 +29,7 @@
* @author Navin Surtani (<a
href="mailto:nsurtani@redhat.com">nsurtani@redhat.com</a>)
*/
-@Test(groups = "functional", enabled = true)
+@Test(groups = "functional", enabled = false)
public class LocalPOJOCacheTest
{
SearchableCache searchableCache;
@@ -60,7 +60,7 @@
person2 = new Person();
person2.setName("BigGoat");
person2.setBlurb("Eats grass");
-
+
person3 = new Person();
person3.setName("MiniGoat");
person3.setBlurb("Eats cheese");