Permalink
Browse files

api cleanup, removed need for extra generic param

  • Loading branch information...
1 parent 181e1d4 commit 8ae094d2df04422fd71de78a9d266734a6d8daf5 @javasoze javasoze committed Mar 3, 2011
Showing with 285 additions and 341 deletions.
  1. +0 −10 .classpath
  2. +6 −0 .project
  3. +2 −2 .settings/org.maven.ide.eclipse.prefs
  4. +1 −2 zoie-core/src/main/java/proj/zoie/api/IndexReaderFactory.java
  5. +1 −3 zoie-core/src/main/java/proj/zoie/api/Zoie.java
  6. +2 −3 zoie-core/src/main/java/proj/zoie/api/indexing/AbstractZoieIndexable.java
  7. +2 −4 zoie-core/src/main/java/proj/zoie/api/indexing/AbstractZoieIndexableInterpreter.java
  8. +2 −4 zoie-core/src/main/java/proj/zoie/api/indexing/ZoieIndexable.java
  9. +2 −19 zoie-core/src/main/java/proj/zoie/api/indexing/ZoieIndexableInterpreter.java
  10. +1 −3 zoie-core/src/main/java/proj/zoie/hourglass/api/HourglassIndexable.java
  11. +2 −5 zoie-core/src/main/java/proj/zoie/hourglass/api/HourglassIndexableInterpreter.java
  12. +8 −9 zoie-core/src/main/java/proj/zoie/hourglass/impl/Box.java
  13. +9 −9 zoie-core/src/main/java/proj/zoie/hourglass/impl/Hourglass.java
  14. +19 −20 zoie-core/src/main/java/proj/zoie/hourglass/impl/HourglassReaderManager.java
  15. +2 −2 zoie-core/src/main/java/proj/zoie/hourglass/mbean/HourglassAdmin.java
  16. +1 −2 zoie-core/src/main/java/proj/zoie/impl/indexing/AbstractReaderCache.java
  17. +7 −7 zoie-core/src/main/java/proj/zoie/impl/indexing/DefaultReaderCache.java
  18. +5 −5 zoie-core/src/main/java/proj/zoie/impl/indexing/FileIndexableInterpreter.java
  19. +5 −6 zoie-core/src/main/java/proj/zoie/impl/indexing/NoopReaderCache.java
  20. +1 −3 zoie-core/src/main/java/proj/zoie/impl/indexing/ReaderCacheFactory.java
  21. +2 −2 zoie-core/src/main/java/proj/zoie/impl/indexing/SimpleZoieSystem.java
  22. +5 −6 zoie-core/src/main/java/proj/zoie/impl/indexing/SmartReaderCache.java
  23. +25 −27 zoie-core/src/main/java/proj/zoie/impl/indexing/ZoieSystem.java
  24. +3 −3 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/BaseSearchIndex.java
  25. +25 −26 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/BatchedIndexDataLoader.java
  26. +1 −1 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/DefaultRAMDiskIndexFactory.java
  27. +1 −1 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/DefaultRAMIndexFactory.java
  28. +10 −11 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/DelegateIndexDataConsumer.java
  29. +3 −3 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/DiskLuceneIndexDataLoader.java
  30. +1 −1 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/DiskSearchIndex.java
  31. +7 −8 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/LuceneIndexDataLoader.java
  32. +1 −1 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/RAMIndexFactory.java
  33. +4 −5 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/RAMLuceneIndexDataLoader.java
  34. +1 −1 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/RAMSearchIndex.java
  35. +15 −16 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/RealtimeIndexDataLoader.java
  36. +2 −3 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/SearchIndexManager.java
  37. +8 −9 zoie-core/src/main/java/proj/zoie/impl/indexing/luceneNRT/LuceneNRTDataConsumer.java
  38. +8 −9 zoie-core/src/main/java/proj/zoie/impl/indexing/luceneNRT/ThrottledLuceneNRTDataConsumer.java
  39. +4 −6 zoie-core/src/main/java/proj/zoie/mbean/ZoieIndexingStatusAdmin.java
  40. +10 −8 zoie-core/src/test/java/proj/zoie/test/HourglassTest.java
  41. +11 −11 zoie-core/src/test/java/proj/zoie/test/ZoieTest.java
  42. +7 −7 zoie-core/src/test/java/proj/zoie/test/ZoieTestCaseBase.java
  43. +2 −2 zoie-core/src/test/java/proj/zoie/test/ZoieThreadTest.java
  44. +5 −5 zoie-core/src/test/java/proj/zoie/test/data/DataInterpreterForTests.java
  45. +6 −6 zoie-core/src/test/java/proj/zoie/test/data/InRangeDataInterpreterForTests.java
  46. +3 −3 zoie-example/src/main/java/proj/zoie/example/service/impl/ExampleZoieSearchServiceImpl.java
  47. +19 −22 zoie-perf/src/main/java/proj/zoie/perf/indexing/LoopingIndexableInterpreter.java
  48. +13 −15 zoie-perf/src/main/java/proj/zoie/perf/indexing/WikiDocIndexableInterpreter.java
  49. +3 −3 zoie-perf/src/main/java/proj/zoie/perf/mbean/PerfZoieServiceAdmin.java
  50. +2 −2 zoie-perf/src/main/java/proj/zoie/perf/server/MonitoredZoieService.java
View
@@ -5,15 +5,5 @@
<classpathentry kind="src" path="zoie-core/src/test/java"/>
<classpathentry kind="src" path="zoie-solr/src/main/java"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry exported="true" kind="lib" path="lib/master/commons-logging.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/fastutil.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/log4j.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/lucene-highlighter.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/spring-webmvc.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/spring.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/test/junit.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/master/lucene-core.jar"/>
- <classpathentry kind="lib" path="lib/solr/solr-core.jar"/>
- <classpathentry kind="lib" path="lib/solr/solr-solrj.jar"/>
<classpathentry kind="output" path="output"/>
</classpath>
View
@@ -15,8 +15,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
@@ -1,5 +1,5 @@
-#Thu Mar 18 18:04:46 PDT 2010
-activeProfiles=
+#Wed Mar 02 15:11:04 PST 2011
+activeProfiles=pom.xml
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
@@ -16,7 +16,6 @@
* limitations under the License.
*/
import java.io.IOException;
-import java.io.Serializable;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
@@ -25,7 +24,7 @@
/**
* This interface is IndexReader instances are to be managed.
*/
-public interface IndexReaderFactory<R extends IndexReader, VALUE extends Serializable>
+public interface IndexReaderFactory<R extends IndexReader>
{
/**
@@ -1,12 +1,10 @@
package proj.zoie.api;
-import java.io.Serializable;
-
import javax.management.StandardMBean;
import org.apache.lucene.index.IndexReader;
-public interface Zoie<R extends IndexReader, D, V extends ZoieVersion, VALUE extends Serializable> extends DataConsumer<D, V>, IndexReaderFactory<ZoieIndexReader<R>, VALUE>
+public interface Zoie<R extends IndexReader, D, V extends ZoieVersion> extends DataConsumer<D, V>, IndexReaderFactory<ZoieIndexReader<R>>
{
void start();
void shutdown();
@@ -1,6 +1,5 @@
package proj.zoie.api.indexing;
-import java.io.Serializable;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,7 +18,7 @@
* limitations under the License.
*/
-public abstract class AbstractZoieIndexable<VALUE extends Serializable> implements ZoieIndexable<VALUE>
+public abstract class AbstractZoieIndexable implements ZoieIndexable
{
public static final String DOCUMENT_ID_PAYLOAD_FIELD="_ID";
@@ -40,7 +39,7 @@ public boolean hasStoreData()
}
@Override
- public VALUE getStoreValue()
+ public byte[] getStoreValue()
{
return null;
}
@@ -1,14 +1,12 @@
package proj.zoie.api.indexing;
-import java.io.Serializable;
/**
* @author "Xiaoyang Gu<xgu@linkedin.com>"
*
* @param <V> The type of the data to be interpreted.
- * @param <VALUE> The type of the data for the associated Key-Value Data store.
*/
-public abstract class AbstractZoieIndexableInterpreter<V, VALUE extends Serializable> implements ZoieIndexableInterpreter<V, VALUE>
+public abstract class AbstractZoieIndexableInterpreter<V> implements ZoieIndexableInterpreter<V>
{
- public abstract ZoieIndexable<VALUE> convertAndInterpret(V src);
+ public abstract ZoieIndexable convertAndInterpret(V src);
}
@@ -15,16 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import java.io.Serializable;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
/**
* Builder object to produce indexing requests.
* @param VALUE the generic type for the associated Key-Value store data. UID is the Key and type is always Long.
*/
-public interface ZoieIndexable<VALUE extends Serializable>
+public interface ZoieIndexable
{
/**
* document ID field name
@@ -91,5 +89,5 @@ public Analyzer getAnalyzer(){
* The method that returns the Data to be put in a Data Store associated with zoie. The Key is UID.
* @return the Data to be put into the data store.
*/
- VALUE getStoreValue();
+ byte[] getStoreValue();
}
@@ -1,26 +1,9 @@
package proj.zoie.api.indexing;
-import java.io.Serializable;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
/**
* Interface to translate from a data object to an indexable object.
*/
-public interface ZoieIndexableInterpreter<V, VALUE extends Serializable>{
- ZoieIndexable<VALUE> convertAndInterpret(V src);
+public interface ZoieIndexableInterpreter<V>{
+ ZoieIndexable convertAndInterpret(V src);
}
@@ -3,15 +3,13 @@
*/
package proj.zoie.hourglass.api;
-import java.io.Serializable;
-
import proj.zoie.api.indexing.ZoieIndexable;
/**
* @author "Xiaoyang Gu<xgu@linkedin.com>"
*
*/
-public abstract class HourglassIndexable<VALUE extends Serializable> implements ZoieIndexable<VALUE>
+public abstract class HourglassIndexable implements ZoieIndexable
{
public final boolean isDeleted()
{
@@ -1,7 +1,5 @@
package proj.zoie.hourglass.api;
-import java.io.Serializable;
-
import proj.zoie.api.indexing.ZoieIndexableInterpreter;
/**
@@ -26,10 +24,9 @@
*
* @param <V>
* Interface to translate from a data object to an indexable object.
- * @param <VALUE> the type of the data for the associated Key-Value data store.
*/
-public interface HourglassIndexableInterpreter<V, VALUE extends Serializable> extends ZoieIndexableInterpreter<V, VALUE>
+public interface HourglassIndexableInterpreter<V> extends ZoieIndexableInterpreter<V>
{
- HourglassIndexable<VALUE> convertAndInterpret(V src);
+ HourglassIndexable convertAndInterpret(V src);
}
@@ -1,7 +1,6 @@
package proj.zoie.hourglass.impl;
import java.io.IOException;
-import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@@ -14,12 +13,12 @@
import proj.zoie.api.indexing.IndexReaderDecorator;
import proj.zoie.impl.indexing.ZoieSystem;
-public class Box<R extends IndexReader, D, V extends ZoieVersion, VALUE extends Serializable>
+public class Box<R extends IndexReader, D, V extends ZoieVersion>
{
public static final Logger log = Logger.getLogger(Box.class.getName());
List<ZoieIndexReader<R>> _archives;
- List<ZoieSystem<R, D, V, VALUE>> _retiree;
- List<ZoieSystem<R, D, V, VALUE>> _actives;
+ List<ZoieSystem<R, D, V>> _retiree;
+ List<ZoieSystem<R, D, V>> _actives;
IndexReaderDecorator<R> _decorator;
/**
@@ -30,11 +29,11 @@
* @param actives
* @param decorator
*/
- public Box(List<ZoieIndexReader<R>> archives, List<ZoieSystem<R, D, V, VALUE>> retiree, List<ZoieSystem<R, D, V, VALUE>> actives, IndexReaderDecorator<R> decorator)
+ public Box(List<ZoieIndexReader<R>> archives, List<ZoieSystem<R, D, V>> retiree, List<ZoieSystem<R, D, V>> actives, IndexReaderDecorator<R> decorator)
{
_archives = new LinkedList<ZoieIndexReader<R>>(archives);
- _retiree = new LinkedList<ZoieSystem<R, D, V, VALUE>>(retiree);
- _actives = new LinkedList<ZoieSystem<R, D, V, VALUE>>(actives);
+ _retiree = new LinkedList<ZoieSystem<R, D, V>>(retiree);
+ _actives = new LinkedList<ZoieSystem<R, D, V>>(actives);
_decorator = decorator;
if (log.isDebugEnabled())
{
@@ -52,12 +51,12 @@ public void shutdown()
r.decZoieRef();
log.info("refCount at shutdown: " + r.getRefCount() + " " + r.directory());
}
- for (ZoieSystem<R, D, V, VALUE> zoie : _retiree)
+ for (ZoieSystem<R, D, V> zoie : _retiree)
{
zoie.shutdown();
}
// add the active index readers
- for (ZoieSystem<R, D, V, VALUE> zoie : _actives)
+ for (ZoieSystem<R, D, V> zoie : _actives)
{
while (true)
{
@@ -30,31 +30,31 @@
import proj.zoie.impl.indexing.ZoieSystem;
import proj.zoie.api.ZoieVersion;
-public class Hourglass<R extends IndexReader, D, V extends ZoieVersion, VALUE extends Serializable> implements Zoie<R, D, V, VALUE>
+public class Hourglass<R extends IndexReader, D, V extends ZoieVersion> implements Zoie<R, D, V>
{
public static final Logger log = Logger.getLogger(Hourglass.class);
private final HourglassDirectoryManagerFactory<V> _dirMgrFactory;
- private final ZoieIndexableInterpreter<D, VALUE> _interpreter;
+ private final ZoieIndexableInterpreter<D> _interpreter;
private final IndexReaderDecorator<R> _decorator;
private final ZoieConfig<V> _zConfig;
- private volatile ZoieSystem<R, D,V, VALUE> _currentZoie;
+ private volatile ZoieSystem<R, D,V> _currentZoie;
private volatile boolean _isShutdown = false;
final ReentrantReadWriteLock _shutdownLock = new ReentrantReadWriteLock();
private final ReentrantLock _consumeLock = new ReentrantLock();
- private final HourglassReaderManager<R, D, V, VALUE> _readerMgr;
+ private final HourglassReaderManager<R, D, V> _readerMgr;
private volatile V _currentVersion = null;
private long _freshness = 1000;
final HourGlassScheduler _scheduler;
public volatile long SLA = 4; // getIndexReaders should return in 4ms or a warning is logged
- public Hourglass(HourglassDirectoryManagerFactory<V> dirMgrFactory, ZoieIndexableInterpreter<D, VALUE> interpreter, IndexReaderDecorator<R> readerDecorator,ZoieConfig<V> zoieConfig)
+ public Hourglass(HourglassDirectoryManagerFactory<V> dirMgrFactory, ZoieIndexableInterpreter<D> interpreter, IndexReaderDecorator<R> readerDecorator,ZoieConfig<V> zoieConfig)
{
_zConfig = zoieConfig;
_dirMgrFactory = dirMgrFactory;
_scheduler = _dirMgrFactory.getScheduler();
_dirMgrFactory.clearRecentlyChanged();
_interpreter = interpreter;
_decorator = readerDecorator;
- _readerMgr = new HourglassReaderManager<R, D, V, VALUE>(this, _dirMgrFactory, _decorator, loadArchives());
+ _readerMgr = new HourglassReaderManager<R, D, V>(this, _dirMgrFactory, _decorator, loadArchives());
_currentVersion = _dirMgrFactory.getArchivedVersion();
_currentZoie = _readerMgr.retireAndNew(null);
_currentZoie.start();
@@ -85,16 +85,16 @@ public Hourglass(HourglassDirectoryManagerFactory<V> dirMgrFactory, ZoieIndexabl
log.info("load "+dirs.size()+" archived indices of " + getSizeBytes() +" bytes in " + (System.currentTimeMillis() - t0) + "ms");
return archives;
}
- ZoieSystem<R, D,V, VALUE> createZoie(DirectoryManager<V> dirmgr)
+ ZoieSystem<R, D,V> createZoie(DirectoryManager<V> dirmgr)
{
- return new ZoieSystem<R, D, V, VALUE>(dirmgr, _interpreter, _decorator, _zConfig);
+ return new ZoieSystem<R, D, V>(dirmgr, _interpreter, _decorator, _zConfig);
}
public ZoieConfig getzConfig()
{
return _zConfig;
}
- public ZoieSystem<R, D, V, VALUE> getCurrentZoie()
+ public ZoieSystem<R, D, V> getCurrentZoie()
{
return _currentZoie;
}
Oops, something went wrong.

0 comments on commit 8ae094d

Please sign in to comment.