Author: navssurtani
Date: 2008-06-19 18:23:38 -0400 (Thu, 19 Jun 2008)
New Revision: 6004
Removed:
searchable/trunk/src/test/java/TransformerTest.java
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
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
searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java
Log:
Javadocced stuff.
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java 2008-06-19
05:09:21 UTC (rev 6003)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQuery.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -6,7 +6,9 @@
/**
@author Navin Surtani - navin(a)surtani.org
- */
+
+
+*/
// TODO: Can we remove this?
public interface CacheQuery
{
@@ -23,7 +25,7 @@
/**
* Allows to use lucene filters.
- * Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach
+ * A preferred way is to use the @FullTextFilterDef approach
*
* @param filter The lucene filter.
* @return this for method chaining
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-06-19
05:09:21 UTC (rev 6003)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -34,10 +34,11 @@
/**
* @author Navin Surtani - navin(a)surtani.org
+ *
+ * Implementation class of the FullTextQuery interface in Hibernate Search.
*/
public class CacheQueryImpl implements FullTextQuery
{
- //TODO: Javadoc all these methods
private Cache cache;
private Class[] classes;
private Sort sort;
@@ -69,18 +70,35 @@
}
+ /**
+ *Allows to let lucene sort the results.
+ *
+ *
+ * @param sort
+ * @return
+ */
public FullTextQuery setSort(Sort sort)
{
this.sort = sort;
return this;
}
+ /**
+ * Allows to use lucene filters.
+ *
+ * @param filter
+ * @return
+ */
public FullTextQuery setFilter(Filter filter)
{
this.filter = filter;
return this;
}
+ /**
+ *
+ * @return The result size of the query.
+ */
public int getResultSize()
{
if (resultSize == null)
@@ -113,7 +131,7 @@
}
catch (SearchException e)
{
- log.warn("Unable to properly close searcher during lucene query:
" + e);
+ log.warn("Unable to properly close searcher during lucene query:
" + e);
}
}
}
@@ -121,24 +139,45 @@
return this.resultSize;
}
+ /**
+ * Defines the Database Query used to load the Lucene results
+ *
+ * @param criteria
+ * @return
+ */
public FullTextQuery setCriteriaQuery(Criteria criteria)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * Defines the Lucene field names projected and returned in a query result Each field
is converted back to it's object representation,
+ * an Object[] being returned for each "row" (similar to an HQL or a
Criteria API projection).
+ * @param strings
+ * @return
+ */
public FullTextQuery setProjection(String... strings)
{
- return null; //TODO: Generated method. Do we need this method?
+
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
- private void closeSearcher(Searcher searcher, ReaderProvider readerProvider) {
- Set<IndexReader> indexReaders = getIndexReaders( searcher );
+ private void closeSearcher(Searcher searcher, ReaderProvider readerProvider)
+ {
+ Set<IndexReader> indexReaders = getIndexReaders(searcher);
- for (IndexReader indexReader : indexReaders) {
- readerProvider.closeReader( indexReader );
+ for (IndexReader indexReader : indexReaders)
+ {
+ readerProvider.closeReader(indexReader);
}
}
+ /**
+ * Enable a given filter by its name.
+ *
+ * @param name
+ * @return
+ */
public FullTextFilter enableFullTextFilter(String name)
{
if (filterDefinitions == null)
@@ -159,11 +198,21 @@
return filterDefinition;
}
+ /**
+ * Disable a given filter by its name.
+ *
+ * @param name
+ */
public void disableFullTextFilter(String name)
{
filterDefinitions.remove(name);
}
+ /**
+ *
+ * @param firstResult
+ * @return
+ */
public FullTextQuery setFirstResult(int firstResult)
{
if (firstResult < 0)
@@ -174,380 +223,711 @@
return this;
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setReadOnly(boolean b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setCacheable(boolean b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCacheRegion(String s)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setTimeout(int i)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public String getQueryString()
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public Type[] getReturnTypes() throws HibernateException
{
- return new Type[0]; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public String[] getReturnAliases() throws HibernateException
{
- return new String[0]; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public String[] getNamedParameters() throws HibernateException
{
- return new String[0]; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public Iterator iterate() throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public ScrollableResults scroll() throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public List list() throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public Object uniqueResult() throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public int executeUpdate() throws HibernateException
{
- return 0; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
- public FullTextQuery setMaxResults(int maxResults) {
- if ( maxResults < 0 ) {
- throw new IllegalArgumentException( "'max' pagination parameter
less than 0" );
+ public FullTextQuery setMaxResults(int maxResults)
+ {
+ if (maxResults < 0)
+ {
+ throw new IllegalArgumentException("'max' pagination parameter less
than 0");
}
this.maxResults = maxResults;
return this;
}
- public FullTextQuery setFetchSize(int fetchSize) {
- if ( fetchSize <= 0 ) {
- throw new IllegalArgumentException( "'fetch size' parameter less
than or equals to 0" );
+ public FullTextQuery setFetchSize(int fetchSize)
+ {
+ if (fetchSize <= 0)
+ {
+ throw new IllegalArgumentException("'fetch size' parameter less
than or equals to 0");
}
this.fetchSize = fetchSize;
return this;
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setLockMode(String s, LockMode lockMode)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setComment(String s)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setFlushMode(FlushMode flushMode)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCacheMode(CacheMode cacheMode)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameter(int i, Object o, Type type)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameter(String s, Object o, Type type)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameter(int i, Object o) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameter(String s, Object o) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameters(Object[] objects, Type[] types) throws
HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameterList(String s, Collection collection, Type
type) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameterList(String s, Collection collection) throws
HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameterList(String s, Object[] objects, Type type)
throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setParameterList(String s, Object[] objects) throws
HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setProperties(Object o) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setProperties(Map map) throws HibernateException
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setString(int i, String s)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCharacter(int i, char c)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setBoolean(int i, boolean b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setByte(int i, byte b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setShort(int i, short i1)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setInteger(int i, int i1)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setLong(int i, long l)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setFloat(int i, float v)
{
throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setDouble(int i, double v)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setBinary(int i, byte[] bytes)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setText(int i, String s)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setSerializable(int i, Serializable serializable)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setLocale(int i, Locale locale)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setBigDecimal(int i, BigDecimal bigDecimal)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setBigInteger(int i, BigInteger bigInteger)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setDate(int i, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setTime(int i, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setTimestamp(int i, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCalendar(int i, Calendar calendar)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCalendarDate(int i, Calendar calendar)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setString(String s, String s1)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setCharacter(String s, char c)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setBoolean(String s, boolean b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setByte(String s, byte b)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
+
public org.hibernate.Query setShort(String s, short i)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setInteger(String s, int i)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setLong(String s, long l)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
public org.hibernate.Query setFloat(String s, float v)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setDouble(String s, double v)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setBinary(String s, byte[] bytes)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setText(String s, String s1)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setSerializable(String s, Serializable serializable)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setLocale(String s, Locale locale)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setBigDecimal(String s, BigDecimal bigDecimal)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setBigInteger(String s, BigInteger bigInteger)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setDate(String s, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setTime(String s, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setTimestamp(String s, Date date)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setCalendar(String s, Calendar calendar)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setCalendarDate(String s, Calendar calendar)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setEntity(int i, Object o)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public org.hibernate.Query setEntity(String s, Object o)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
+ /**
+ * This method is not supported in JBossCache Searchable and hence should not be
called.
+ *
+ */
public FullTextQuery setResultTransformer(ResultTransformer resultTransformer)
{
- return null; //TODO: Generated method. Do we need this method?
+ throw new UnsupportedOperationException("Not supported in
SearchableCache!");
}
private IndexSearcher buildSearcher(SearchFactoryImplementor
searchFactoryImplementor)
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java 2008-06-19
05:09:21 UTC (rev 6003)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/InvalidFqnException.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -4,6 +4,8 @@
/**
* @author Navin Surtani - navin(a)surtani.org
+ *
+ * Thrown when an invalid Fqn is passed into the generateId method in Transformer
*/
public class InvalidFqnException extends CacheException
{
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-06-19
05:09:21 UTC (rev 6003)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -7,12 +7,16 @@
import javax.transaction.Transaction;
/**
-@author Navin Surtani - navin(a)surtani.org
+ * @author Navin Surtani - navin(a)surtani.org
+
+ This class implements the TransactionContext interface in
org.hibernate.search.transaction.
+
+ It is used by the SearchableListener so that a TransactionContext instance can be
created.
+
*/
public class NodeModifiedTransactionContext implements TransactionContext
{
- //TODO: Javadoc all these methods
NodeModifiedEvent event;
public NodeModifiedTransactionContext(NodeModifiedEvent event)
@@ -20,16 +24,31 @@
this.event = event;
}
+ /**
+ * Returns a boolean value whether or not a transaction is in progress (JTA
transaction and in this case *not*
+ * an org.hibernate transaction).
+ * @return
+ */
public boolean isTxInProgress()
{
return (event.getTransaction() != null);
}
+ /**
+ * Returns a JTA transaction as an object.
+ * @return
+ */
+
public Object getTransactionIdentifier()
{
return event.getTransaction();
}
+ /**
+ * Registers a synchronization from one passed as a parameter.
+ *
+ * @param synchronization
+ */
public void registerSynchronization(Synchronization synchronization)
{
Transaction transaction = event.getTransaction();
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-19
05:09:21 UTC (rev 6003)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -6,17 +6,31 @@
/**
@author Navin Surtani - navin(a)surtani.org
+
+ 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.
+
*/
public interface SearchableCache extends Cache
{
/**
+ * Creates a FullTextQuery object from a luceneQuery.
*
* @param luceneQuery
* @return
*/
public FullTextQuery createQuery(Query luceneQuery);
+ /**
+ * Creates a FullTextQuery from a lucene query and a class array.
+ *
+ * @param luceneQuery
+ * @param classes
+ * @return
+ */
public FullTextQuery createQuery(Query luceneQuery, Class... classes);
}
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-19
05:09:21 UTC (rev 6003)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -12,14 +12,28 @@
*/
public class SearchableCacheFactory
{
- //TODO: Javadoc everything.
private SearchFactoryImpl searchFactory;
+ /**
+ * Creates a searchable cache from a cache object and a class array, without the
properties object.
+ *
+ * @param c
+ * @param classes
+ * @return
+ */
public SearchableCache createSearchableCache (Cache c, Class... classes)
{
return createSearchableCache(c, null, classes);
}
+ /**
+ * This method creates a searchable cache as well but requires the properties object.
+ *
+ * @param c
+ * @param properties
+ * @param classes
+ * @return
+ */
public SearchableCache createSearchableCache (Cache c, Properties properties, Class...
classes)
{
// assume cache is already created and running.
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-19
05:09:21 UTC (rev 6003)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -20,6 +20,8 @@
/**
@author Navin Surtani - navin(a)surtani.org
+
+ Implementation class for the SearchableCache interface.
*/
public class SearchableCacheImpl implements SearchableCache
{
@@ -27,7 +29,7 @@
private Cache cache;
private SearchFactoryImpl searchFactory;
- //TODO: Javadoc all these methods
+ //TODO: Does the impl class have to be javadocced?
public SearchableCacheImpl(Cache cache, SearchFactoryImpl searchFactory)
{
@@ -35,6 +37,7 @@
this.searchFactory = searchFactory;
}
+
public FullTextQuery createQuery(Query luceneQuery)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache);
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-19
05:09:21 UTC (rev 6003)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableListener.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -12,14 +12,23 @@
/**
* @author Navin Surtani - navin(a)surtani.org
+ *
+ * Class that listens for changes made to the cache so that the Lucene indexes can be
updated.
*/
@CacheListener
public class SearchableListener
{
- //TODO: Javadoc everything
private SearchFactoryImpl searchFactory;
+ /**
+ * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the
NodeModifiedEvent class.
+ *
+ *
+ * @param event
+ */
+
+
@NodeModified
public void updateLuceneIndexes(NodeModifiedEvent event)
{
@@ -38,6 +47,12 @@
}
}
+ /**
+ * If the modification type is PUT_MAP or PUT_DATA then this method will be called.
+ * Takes in the event as a parameter
+ *
+ * @param event
+ */
void handlePutData(NodeModifiedEvent event)
{
Map dataMap = event.getData();
@@ -55,6 +70,12 @@
}
+ /**
+ * If the modification type is DELETE_DATA then this method will be called.
+ * Takes in the event as a parameter
+ *
+ * @param event
+ */
void handleDeleteData(NodeModifiedEvent event)
{
Map dataMap = event.getData();
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java 2008-06-19
05:09:21 UTC (rev 6003)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/Transformer.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -4,10 +4,24 @@
/**
@author Navin Surtani - navin(a)surtani.org
- */
+
+* This class is one that does all the 'conversion' work between JBossCache and
Hibernate Search. This is where
+* users can switch from Fqn and key to a documentId and vice versa.
+*
+* If the Fqn is in the form /a/b/c and the key - which has to be a String - is keystring;
the documentId - which is also
+* a String - will be "Fqn=[/a/b/c]Key=[keystring]"
+*
+*/
public class Transformer
{
- //TODO: Javadoc everything
+ /**
+ * Takes in the documentId string from the user and will return the key from the Fqn,
key combination.
+ *
+ *
+ * @param docId
+ * @return
+ */
+
public static String getKey(String docId)
{
//docID comes in the format "Fqn=[/a/b/c]Key=[key]"
@@ -28,6 +42,14 @@
return key;
}
+ /**
+ * Takes in the documentId string from the user and will return the Fqn from the Fqn,
key combination.
+ *
+ * @param docId
+ * @return
+ */
+
+
public static Fqn getFqn(String docId)
{
//docId comes in the format "Fqn=[/a/b/c]Key=[key]"
@@ -46,6 +68,16 @@
return fqn;
}
+ /**
+ * Generates the documentId from an Fqn, key combination.
+ *
+ *
+ * @param fqn
+ * @param key
+ * @return
+ * @throws InvalidFqnException
+ */
+
public static String generateId(Fqn fqn, String key) throws InvalidFqnException
{
if (key == null) throw new InvalidFqnException("Key passed in cannot be
null!");
Deleted: searchable/trunk/src/test/java/TransformerTest.java
===================================================================
--- searchable/trunk/src/test/java/TransformerTest.java 2008-06-19 05:09:21 UTC (rev
6003)
+++ searchable/trunk/src/test/java/TransformerTest.java 2008-06-19 22:23:38 UTC (rev
6004)
@@ -1,53 +0,0 @@
-import org.jboss.cache.Fqn;
-import org.jboss.cache.search.Transformer;
-import org.testng.annotations.Test;
-
-/**
- * Created by IntelliJ IDEA.
- * User: navin
- * Date: Jun 4, 2008
- * Time: 3:52:58 PM
- * To change this template use File | Settings | File Templates.
- */
-
-@Test
-public class TransformerTest
-{
- public void testGenerateId()
- {
-
- Fqn fqn = Fqn.fromString("/a/b/c");
- String key = "key";
-
- String generatedId = Transformer.generateId(fqn, key);
-
- assert generatedId.contentEquals("Fqn=[/a/b/c]Key=[key]");
-
- assert ! generatedId.contentEquals("/ab/c/d");
- }
-
- public void testGetFqn()
- {
- Fqn fqn = Transformer.getFqn("Fqn=[/cat/dog/person]Key=[key]");
-
- Fqn expectedFqn = Fqn.fromString("/cat/dog/person");
-
- assert fqn.equals(expectedFqn);
-
- expectedFqn = Fqn.fromString("/dog/cat/person");
-
- assert !fqn.equals(expectedFqn);
-
- }
-
- public void testGetKey()
- {
- String key = Transformer.getKey("Fqn=[/a/b/c]Key=[thisIsMyKey]");
-
- assert key.contentEquals("thisIsMyKey");
-
- assert ! key.contentEquals("thisIsNotMyKey");
-
- }
-
-}
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java 2008-06-19
05:09:21 UTC (rev 6003)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/TransformerTest.java 2008-06-19
22:23:38 UTC (rev 6004)
@@ -5,12 +5,20 @@
/**
@author Navin Surtani - navin(a)surtani.org
+
+ Unit-test class for the Transformer class.
*/
@Test
public class TransformerTest
+ //TODO: How best to javadoc the exception methods?
+
{
- //TODO: Javadoc everything
+ /**
+ * Tests the generateId method.
+ *
+ */
+
public void testGenerateId()
{
@@ -24,6 +32,10 @@
assert ! generatedId.contentEquals("/ab/c/d");
}
+ /**
+ * Tests the getFqn method.
+ *
+ */
public void testGetFqn()
{
Fqn fqn = Transformer.getFqn("Fqn=[/cat/dog/person]Key=[key]");
@@ -38,6 +50,9 @@
}
+ /**
+ * Tests the getKey method.
+ */
public void testGetKey()
{
String key = Transformer.getKey("Fqn=[/a/b/c]Key=[thisIsMyKey]");